Skip to content

Commit 9a8d57e

Browse files
committed
Ingress support added
1 parent 78457b6 commit 9a8d57e

14 files changed

Lines changed: 132 additions & 20 deletions

File tree

chirp2mqtt/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog -->
22

3+
## 1.1.144
4+
5+
- Ingress support added
6+
37
## 1.1.143
48

5-
- synchronized code with https://github.com/modrisb/chirp
9+
- Synchronized code with https://github.com/modrisb/chirp
610
- Upgrade to ghcr.io/hassio-addons/base:18.0.3, CHIRPSTACK_VERSION: 4.13.0
711

812
## 1.1.142

chirp2mqtt/DOCS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ Follow these steps to get the add-on installed on your system:
1111

1212
## How to use
1313

14-
Chirp2MQTT middleware add-on integrates ChirpStack server, Redis, PostgreSQL and small Python management component into single unit that could be installed on Home Assistant managed system with Mosquitto MQTT broker available at IP address core-mosquitto. Add-on allows to integrate LoraWAN devices into HA system via MQTT integration. Python management component registers all known and enabled in ChirpStack LoraWAN devices within MQTT, handles battery level set-up at service start, restores known sensor values and synchronize device list upon request. Device registration is handled via ChirpStack WWW interface and this may include updates in device Codec javascript code.
14+
Chirp2MQTT middleware add-on integrates ChirpStack server, Redis, PostgreSQL and small Python management component into single unit that could be installed on Home Assistant managed system with Mosquitto MQTT broker available at IP address core-mosquitto. Add-on allows to integrate LoRaWAN devices into HA system via MQTT integration. Python management component registers all known and enabled in ChirpStack LoRaWAN devices within MQTT, handles battery level set-up at service start, restores known sensor values and synchronize device list upon request. Device registration is handled via ChirpStack WWW interface and this may include updates in device Codec javascript code.
1515
Before add-on is installed you need to create Mosquitto MQTT broker user/password (remember that `homeassistant` or `addons` user names are reserved) with authority to subscribe/publish any topic. Recent version uses plain MQTT connection without any certificates on default port 1883.
1616

1717
The add-on need to be configured before started, see **Configuration** section for details. Start add-on, initial start-up requires more time that successive startups. There is option to restore ChirpStack PostgreSQL database from backup file in HA /share/chirp2mqtt/chirp_db, on success backup file is renamed to chirp_db.restored .
1818

19-
"Chirp2MQTT Bridge" device should show up as parent for all other LoraWAN devices managed by ChirpStack server. Bridge device exposes 'Reload devices' control to synchronize device list with server. Child devices are listed under "Connected devices". Child names are retrieved from ChirpStack server and must be managed from here. Integration uses LoRa deveui to identify device internally.
19+
"Chirp2MQTT Bridge" device should show up as parent for all other LoRaWAN devices managed by ChirpStack server. Bridge device exposes 'Reload devices' control to synchronize device list with server. Child devices are listed under "Connected devices". Child names are retrieved from ChirpStack server and must be managed from here. Integration uses LoRa deveui to identify device internally.
2020

2121
Add-on on start-up searches for specific configuration files in HA directories /share/chirp2mqtt/etc/chirpstack and /share/chirp2mqtt/etc/chirpstack-gateway-bridge and replaces default configuration files with those customized. Default ChirpStack configuration files assumes on Semtech interface on port 1700.
2222
Python management component ensures that ChirpStack have at least 1 tenant and 1 application in its database by creating missing objects.
@@ -98,7 +98,7 @@ Default value: 'None' .
9898

9999
### Option: `import_actions`
100100

101-
URL to git repository with LoraWAN device templates or 'none'. Repository is imported before ChirsStack starts. Parameter must be reset after importing to 'none', otherwise import will be started again on next add-on start-up. Chirp2MQTT automatically imports repository from HA directory /share/chirp2mqtt/lorawan-devices and marks import by creating file 'imported' to prevent continuous imports.
101+
URL to git repository with LoRaWAN device templates or 'none'. Repository is imported before ChirsStack starts. Parameter must be reset after importing to 'none', otherwise import will be started again on next add-on start-up. Chirp2MQTT automatically imports repository from HA directory /share/chirp2mqtt/lorawan-devices and marks import by creating file 'imported' to prevent continuous imports.
102102

103103
Default(initial) value: 'https://github.com/brocaar/lorawan-devices' .
104104

chirp2mqtt/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ RUN \
1818
apk --no-cache add python3 \
1919
&& apk --no-cache add py3-pip \
2020
&& pip3 install chirpstack-api paho-mqtt dukpy --break-system-packages \
21+
&& apk --no-cache add nodejs npm \
22+
&& npm install -g express \
23+
&& npm install -g http-proxy-middleware \
24+
&& sed -i 's/extend(/Object.assign(/g' /usr/local/lib/node_modules/http-proxy-middleware/node_modules/http-proxy/lib/http-proxy/index.js \
25+
&& sed -i 's/extend(/Object.assign(/g' /usr/local/lib/node_modules/http-proxy-middleware/node_modules/http-proxy/lib/http-proxy/common.js \
26+
&& npm install -g ipaddr.js \
2127
&& apk --no-cache add git redis postgresql16 postgresql16-contrib su-exec \
2228
&& sed -i 's/protected-mode yes/protected-mode no/' /etc/redis.conf \
2329
&& sed -i 's/^\(bind .*\)$/# \1/' /etc/redis.conf \

chirp2mqtt/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Home Assistant Add-on: ChirpStack add-on
22

3-
_Add-on to integrate ChirpStack LoraWAN server with HA via MQTT._
3+
_Add-on to integrate ChirpStack LoRaWAN server with HA via MQTT._
44

55
![Supports aarch64 Architecture][aarch64-shield]
66
![Supports amd64 Architecture][amd64-shield]

chirp2mqtt/config.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
22
name: Chirp2MQTT
3-
version: "1.1.143"
3+
version: "1.1.144"
44
slug: chirp2mqtt
5-
description: HA add-on to incorporatex ChirpStack LoraWan devices into MQTT integration
5+
description: HA add-on to incorporate ChirpStack LoRaWAN devices into MQTT integration
66
arch:
77
- armhf
88
- armv7
99
- aarch64
1010
- amd64
11+
ingress: true
1112
url: "https://github.com/modrisb/chirpha"
1213
startup: application
13-
webui: http://[HOST]:[PORT:8080]
14+
webui: http://[HOST]:[PORT:8099]
1415
boot: auto
1516
ports:
16-
8080/tcp: 8080
17+
8099/tcp: 8099
1718
1700/udp: 1700
1819
ports_description:
19-
8080/tcp: "ChirpStack server WEB UI port"
20+
8099/tcp: "ChirpStack server WEB UI port"
2021
1700/udp: "Port to receive LoraWAN packets"
2122
homeassistant: "2024.3.1"
2223
map:

chirp2mqtt/rootfs/etc/s6-overlay/s6-rc.d/chirpstack/run

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ if ! [ -f "$INITIALIZED" ]; then
105105
fi
106106
fi
107107

108-
# import LoraWan device templates if repository found on HA /share
108+
# import LoRaWAN device templates if repository found on HA /share
109109
if [ -f "$EXTPATH/$DEVICES" ]; then
110110
if ! [ -f "$IMPORTED" ]; then
111111
chirpstack -c /etc/chirpstack import-legacy-lorawan-devices-repository -d "$EXTPATH/$DEVICES" >/dev/null
@@ -115,10 +115,10 @@ if [ -f "$EXTPATH/$DEVICES" ]; then
115115
fi
116116
fi
117117

118-
# import LoraWan device templates from configured git repository - download and import
118+
# import LoRaWAN device templates from configured git repository - download and import
119119
IMPORT_ACTION=$(jq --raw-output '.import_actions // empty' $CONFILE)
120120
if ! [ "$IMPORT_ACTION" = "none" ]; then
121-
echo Importing LoraWan devices from: $IMPORT_ACTION
121+
echo Importing LoRaWAN devices from: $IMPORT_ACTION
122122
if [ -d "/data/temp" ]; then
123123
rm -r /data/temp
124124
fi

chirp2mqtt/rootfs/etc/s6-overlay/s6-rc.d/ingress/dependencies.d/base

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
cd /usr/local/bin
4+
./ha-proxy.js
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
longrun

chirp2mqtt/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/ingress

Whitespace-only changes.

0 commit comments

Comments
 (0)