diff --git a/zwave/DOCS.md b/zwave/DOCS.md index f2989f7..effd07f 100644 --- a/zwave/DOCS.md +++ b/zwave/DOCS.md @@ -17,6 +17,7 @@ Add-on configuration: ```yaml device: /dev/ttyUSB0 network_key: +instance: 1 ``` ### Option `device` @@ -25,6 +26,12 @@ network_key: ### Option `network_key` +### Option `instance` + +Zwave instance number as reported to MQTT. This corresponds with the +`instance_id` attribute of `ozw` services in Home Assistant. + + ## Known issues and limitations - You hardware need to be compatible with OpenZwave library @@ -46,4 +53,4 @@ In case you've found a bug, please [open an issue on our GitHub][issue]. [discord]: https://discord.gg/c5DvZ4e [forum]: https://community.home-assistant.io [issue]: https://github.com/home-assistant/hassio-addons/issues -[reddit]: https://reddit.com/r/homeassistant \ No newline at end of file +[reddit]: https://reddit.com/r/homeassistant diff --git a/zwave/config.json b/zwave/config.json index 2705cc0..6c13c70 100644 --- a/zwave/config.json +++ b/zwave/config.json @@ -15,7 +15,7 @@ }, "ports_description": { "1983/tcp": "ozw-admin port" - }, + }, "services": ["mqtt:want"], "discovery": ["ozw"], "auto_uart": true, @@ -29,7 +29,8 @@ }, "schema": { "device": "str", - "network_key": "password" + "network_key": "password", + "instance": "int(1,)" }, "image": "homeassistant/{arch}-addon-zwave" } diff --git a/zwave/rootfs/etc/services.d/zwave/run b/zwave/rootfs/etc/services.d/zwave/run index f12e1b8..82bccde 100644 --- a/zwave/rootfs/etc/services.d/zwave/run +++ b/zwave/rootfs/etc/services.d/zwave/run @@ -5,6 +5,9 @@ OZW_CONFIG=/data/ozw/config OZW_NETWORK_KEY=$(bashio::config 'network_key') OZW_DEVICE=$(bashio::config 'device') +bashio::config.has_value 'instance' \ + && OZW_INSTANCE="$(bashio::config 'instance')" || OZW_INSTANCE=1 + MQTT_PASSWORD="$(bashio::jq /data/auth.json ".ozw_password")" # Wait until mosqitto is up and running @@ -24,5 +27,5 @@ exec ozwdaemon \ --mqtt-server 127.0.0.1 \ --mqtt-port 1883 \ --mqtt-username ozw \ - --mqtt-instance 1 \ + --mqtt-instance "${OZW_INSTANCE}" \ --stop-on-failure