diff --git a/ism7mqtt/CHANGELOG.md b/ism7mqtt/CHANGELOG.md index 4f638c4..b88edf6 100644 --- a/ism7mqtt/CHANGELOG.md +++ b/ism7mqtt/CHANGELOG.md @@ -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: ``` diff --git a/ism7mqtt/config.yaml b/ism7mqtt/config.yaml index 0d5d838..6abd03e 100644 --- a/ism7mqtt/config.yaml +++ b/ism7mqtt/config.yaml @@ -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 @@ -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: diff --git a/ism7mqtt/run.sh b/ism7mqtt/run.sh index f75c382..1067992 100644 --- a/ism7mqtt/run.sh +++ b/ism7mqtt/run.sh @@ -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 diff --git a/ism7mqtt/translations/de.yaml b/ism7mqtt/translations/de.yaml index a9ffc02..935b283 100644 --- a/ism7mqtt/translations/de.yaml +++ b/ism7mqtt/translations/de.yaml @@ -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" diff --git a/ism7mqtt/translations/en.yaml b/ism7mqtt/translations/en.yaml index 9af58a5..28ade45 100644 --- a/ism7mqtt/translations/en.yaml +++ b/ism7mqtt/translations/en.yaml @@ -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"