Skip to content

Commit

Permalink
Allow configuration of an external MQTT broker
Browse files Browse the repository at this point in the history
  • Loading branch information
b3nn0 committed Nov 1, 2023
1 parent 29a644e commit afc54f0
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
1 change: 1 addition & 0 deletions ism7mqtt/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## What's Changed
- Allow configuration of an external MQTT broker
- Allow multiple instances of ism7mqtt to run.
Exmaple config for additional devices:
```
Expand Down
6 changes: 5 additions & 1 deletion ism7mqtt/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Ism7MQTT"
description: "Addon for direct communication with a Wolf ISM7 module"
version: "v0.0.14-2"
version: "v0.0.14-3"
slug: "ism7mqtt"
init: false
url: https://github.com/b3nn0/hassio-addon-ism7mqtt
Expand Down Expand Up @@ -33,6 +33,10 @@ schema:
ism7_ip: str
ism7_password: password
interval: int
mqtt_host: "str?"
mqtt_user: "str?"
mqtt_password: "password?"

debug_logging: bool

additional_devices:
Expand Down
18 changes: 15 additions & 3 deletions ism7mqtt/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@

export CONFIG_PATH=/data/options.json

export ISM7_MQTTHOST=$(bashio::services mqtt "host")
export ISM7_MQTTUSERNAME=$(bashio::services mqtt "username")
export ISM7_MQTTPASSWORD=$(bashio::services mqtt "password")
export DEBUG_LOGGING=$(bashio::config 'debug_logging')


export ISM7_MQTTHOST="$(bashio::config 'mqtt_host')"
export ISM7_MQTTUSERNAME="$(bashio::config 'mqtt_user')"
export ISM7_MQTTPASSWORD="$(bashio::config 'mqtt_password')"

if [[ "$ISM7_MQTTHOST" == "null" ]]; then
export ISM7_MQTTHOST="$(bashio::services mqtt 'host')"
export ISM7_MQTTUSERNAME="$(bashio::services mqtt 'username')"
export ISM7_MQTTPASSWORD="$(bashio::services mqtt 'password')"
echo "Reading config from MQTT broker add-on: $ISM7_MQTTHOST/$ISM7_MQTTUSERNAME"
else
echo "Using config from add-on configuration: $ISM7_MQTTHOST/$ISM7_MQTTUSERNAME"
fi



function start_ism7mqtt() {
export ISM7_HOMEASSISTANT_ID=$1
export ISM7_IP=$2
Expand Down
9 changes: 9 additions & 0 deletions ism7mqtt/translations/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,14 @@ configuration:
description: >-
Wenn weitere ISM7 Geräte vorhanden sind, können diese hier speizifiziert werden um mehrere ism7mqtt Instanzen zu starten.
Wie diese genau konfiguriert werden müssen ist hier beschrieben: https://github.com/b3nn0/hassio-addon-ism7mqtt/blob/main/README.md
mqtt_host:
name: "Externer MQTT Broker Adresse"
description: "Nur nötig wenn der Broker nicht als Home Assistant Addon läuft"
mqtt_user:
name: "Externer MQTT Broker Benutzer"
description: "Nur nötig wenn der Broker nicht als Home Assistant Addon läuft"
mqtt_password:
name: "Externer MQTT Broker Passwort"
description: "Nur nötig wenn der Broker nicht als Home Assistant Addon läuft"


9 changes: 9 additions & 0 deletions ism7mqtt/translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ configuration:
description: >-
If you have multiple ISM7 Devices, specify them here to start ism7mqtt multiple times.
See here for how to configure them: https://github.com/b3nn0/hassio-addon-ism7mqtt/blob/main/README.md
mqtt_host:
name: "External MQTT broker address"
description: "Only needed if the broker isn't running as a Home Assistant Addon"
mqtt_user:
name: "External MQTT broker user"
description: "Only needed if the broker isn't running as a Home Assistant Addon"
mqtt_password:
name: "External MQTT broker password"
description: "Only needed if the broker isn't running as a Home Assistant Addon"

0 comments on commit afc54f0

Please sign in to comment.