moroen / ZWave-MQTT-plugin

A domoticz plugin for zwave over MQTT
4 stars 2 forks source link

Lint with black

IMPORTANT!

Please note that this plugin is currently on hold pending native MQTT (HA) autodiscovery integration in domoticz. This eliminates the need for this plugin. MQTT autodiscovery has been implemented for quite a number of devices already. Status can be followed on the mqtt_autodiscovery channel on slack.

ZWave-MQTT-plugin

A domoticz plugin for zwave over MQTT. If you are currently using OZW in domoticz:

Install and run zwavejs2mqtt in a docker container (https://github.com/zwave-js/zwavejs2mqtt/tree/master/docker)

The default way:

docker run --rm -it -p 8091:8091 -p 3000:3000 --device=/dev/ttyACM0 --mount source=zwavejs2mqtt,target=/usr/src/app/store zwavejs/zwavejs2mqtt:latest

Using persistent storage, started on system startup and running in the background (preferred): create a storage folder: /opt/zwavejs2mqtt/store

docker run -d --name zwavejs2mqtt --restart unless-stopped -v /opt/zwavejs2mqtt/store:/usr/src/app/store -p 8091:8091 -p 3000:3000 --device=/dev/ttyACM0  zwavejs/zwavejs2mqtt:latest

This will name the container zwavejs2mqtt and allow you to start, stop, inspect, remove, ... There are more options to run zwavejs2mqtt using docker. You are free to use whatever suits your needs (including docker-compose or even running outside of docker). In any case, replace /dev/ttyACM0 with your serial device

Configure zwavejs2mqtt

Open the browser http://localhost:8091.

Note: Specifying node names and locations in zwavejs2mqtt is not required, but recommended. This will generate somewhat sane names of the devices when they are added to domoticz.

Hint: To add all devices at once, enable the plugin in domoticz, and press "Save" in zwavejs2mqtt preferences. This will generate status messages for all devices.

Install and configure Zwave-MQTT-plugin

$ cd plugins
$ git clone https://github.com/moroen/ZWave-MQTT-plugin.git ZWave-MQTT
$ pip3 install -r requirements.txt

Add the ZWave-MQTT plugin to domoticz, and specify the IP of the MQTT broker

Usage

If you migrate from OZW, this will be a new plugin with new devices. Once you delete OZW in domoticz, your old devices are gone. If you need to retain history then you need to replace the old device (https://www.domoticz.com/wiki/Managing_Devices#Replace_device) with the new one if identical devices are created. New devices will be (automatically) added to domoticz (new names, new IDX) on the first status change. To add a device to domoticz, toggle the device by any means, like using the zwave control-planel of zwavejs2mqtt. Battery devices need to be woken up. You can also re-interview nodes and, worst case, re-include but that should not be needed.

Clean up

When everything functions currectly, delete the OZW hardware in domoticz. Please note that dzvents does not like multiple devices with the same name even if the hardware is disabled. Once you delete the OZW hardware, best to restart domoticz so all the new device names are picked up correctly. Also good to completely reboot to test total system startup (including zwavejs2mqtt service or docker container).

Implemented command classes