Page 1 of 23

zwavejs2mqtt

Posted: Friday 06 August 2021 13:18
by heggink
For people out there who experience issues with the built-in OZW, there is now an alternative solution using zwavejs2mqtt.

A while back, I was facing a lot of issues with OZW and didn't like the fact that it's built into domoticz (e.g. every time you want a dzvents update, you are also forced to adopt all OZW updates unless you want to build from source). I got connected to @moroen and we discussed possible approaches. Since Home Assistant already switched to zwavejs2mqtt, we figured that this would provide a more future proof approach with great community support. We also agreed that it would be best to not recreate too much zwavejs functionality in domoticz to keep the plugin more manageable. zwavejs already has a great user interface so managing (including, deleting, ..) devices, creating groups and so on/forth we decided to keep within the zwavejs side but still provide bidirectional device integration to domoticz.

@moroen created a base plugin framework and did most of the heavy lifting, I helped with the connection side, adding devices and discussions on how to implement devices generically. Recently, @moroen made some more changes to 1) allow multiple instances of the plugin each with their own configured devices (so you can have sensors in one instance and plugs in another and not have to worry about the 256 device limit) and 2) to configure device types outside of the plugin to be more flexible adding devices without having to resort to python coding.

The plugin can be found at: https://github.com/moroen/ZWave-MQTT-plugin

Instructions on how to install are on that page. In essence, it's fairly simple: install and run zwavejs2mqtt (ideally in a docker container), install the plugin, restart domoticz and start adding devices.

Since I had quite a selection of devices, it took me a while before I had moved everything from OZW to zwavejs2mqtt. Keeping the shop open whilst in transition, I had to switch between OZW and zwavej2 about 3 times before I could stop OZW altogether. This is a bit of a hassle since OZW is pretty iffy about being shut down and started up again. That said, it was not a big hassle for me (despite my 150 devices in domoticz) and I have been a very happy camper since. zwavejs2mqtt has been incredibly stable, has allowed me to configure things correctly/properly for the first time in my zwave history and provides functionality that OZW just does not (like deleting dead nodes and those nodes staying dead forever, unlike OZW just recreating them and having to resort to editing zwave databases in the stick).

I am seriously pleased with it but that does not mean that there are potential bugs/issues. As always with open source, contributions are very welcome. So far at least, there have been no reported bugs for many weeks and zwavejs itself has also seen minor changes for months now underlining the stability of it. For me, the plugin has been working flawless for months, my last restart is now 25 days ago and even that was not related to zwavejs and the last plugin/zwavejs update also was months ago. Lastly, I can now update domoticz at will as it's completely independent of OZW. The only prerequisite is a working python plugin system (and there have been changes lately so be careful) and ensuring you stay within 256 individual devices per plugin instance.

For me, domoticz now truly is the integration and automation hub and that's goodness. Dzvents, python plugins and so on are great assets of domoticz. They are the key reason why I have not switched to Home Assistant. That said, if you would want to run HA next to domoticz, the beauty of zwavejs is that it allows you to do that seamlessly. I also have HA up and running (and struggle with the functionality and complexity) right next to domoticz without any issues wrt zwavejs.

Let me know if you have any questions/issues. Happy to help.

Herman

Re: zwavejs2mqtt

Posted: Friday 06 August 2021 13:42
by jake
This is very interesting! Thanks for all the hard work!

Re: zwavejs2mqtt

Posted: Saturday 07 August 2021 9:29
by rron
Thank you for the explended explination. After my holiday I will try this.
Thx

Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 12:26
by AllesVanZelf
Thank you Heggink! I'm testing right now!

Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 16:27
by rron
A stupid question but when I to install pip3 install -r requirements.txt I get an error pip3 command not found.

Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 17:09
by heggink
rron wrote:A stupid question but when I to install pip3 install -r requirements.txt I get an error pip3 command not found.
sudo apt-get install python3-pip
Should fix it

Sent from my SM-G980F using Tapatalk


Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 17:20
by rron
Thx, that did the trick. You also need to install the MQTT broker separately?

Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 17:22
by heggink
Yes. sudo apt install mosquitto I think...

Sent from my SM-G980F using Tapatalk


Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 17:25
by rron
Ok that looks ok to me. I need to buy an extra zwave dongle because I want to test it on a spare system. I don't want to mess up my production system.

Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 17:26
by heggink
I did the same but only after the move haha

Sent from my SM-G980F using Tapatalk


Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 17:30
by rron
I don want to mess up the production before my holidays. :D

Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 17:53
by heggink
Good thinking!

Sent from my SM-G980F using Tapatalk


Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 21:00
by solarboy
This is such a good concept and thank you for all this hard work. Definitely going to try it soon. Why is it better to use a "docker" and what is a "docker" ?
Also, I have been thinking it would be a good idea to have a spare Aeotec stick; do you think I would be able to run a separate Zwave network on the same Rpi using a second Stick and slowly migrating devices one by one while keeping a fully operational system ?

Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 21:07
by heggink
Docker is a type of container technology. There's others as well.
You could compare it to a virtual machine running on your system. The beauty of containers is that anyone can build a container for a specific function. That container then 'contains' everything you need to run that function. In this case, ask the prerequisites (required packages to run) are installed in the container and therefore don't conflict with packages installed outside the container.
It's like its own system but then for a specific function (eg zwavejs).
That also makes updating very easy as you only need to delete the container and recreate it with the latest image. Persistent storage (settings and such) can be stored outside the container.
There are docker containers for zwavejs, zigbee, domoticz, dashticz and so on/forth.

Sent from my SM-G980F using Tapatalk


Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 21:13
by solarboy
Brilliant, thanks for that, I have a lot more reading to do ! Apologies for editing my last message while you were replying.

Re: zwavejs2mqtt

Posted: Sunday 08 August 2021 21:24
by heggink
solarboy wrote:This is such a good concept and thank you for all this hard work. Definitely going to try it soon. Why is it better to use a "docker" and what is a "docker" ?
Also, I have been thinking it would be a good idea to have a spare Aeotec stick; do you think I would be able to run a separate Zwave network on the same Rpi using a second Stick and slowly migrating devices one by one while keeping a fully operational system ?
Having a spare stick is always good as it is possible to backup your current stick in case of emergency and restore the database to a new stick.

Whether it makes sense to gradually move, I can't say as it very much depends on your environment and the number of devices. I had quite a number devices that were difficult to access so decided to switch big bang. Your situation may well differ.

You can definitely have 2 sticks on 1 system, one serving ozw and one for zwavejs. The only challenge is that Linux will randomly number them so you need a udev rule using the serial number of the stick to identify the 2 and assign the proper stick to each service (there are other ways but I like/prefer the udev rule approach). Let me know if you need help with that. It's quite simple.

And you would obviously need to exclude device by device from ozw and include in zwavejs but that's logical.

Sent from my SM-G980F using Tapatalk


Re: zwavejs2mqtt

Posted: Monday 09 August 2021 0:36
by mgugu
I confirm that mutiple zwave controllers can work at the same time in the same area.
I run 2 controllers on different Pi's. First one is a Z-Stick Gen5 used directly by Domoticz via OZW, second one, used for new devices, is a SA413 Zwave 500 USB connected to a zwavejs2mqtt container.
This configuration is running without any problem for 2 month.
Concerning backup,for the Z-Stick Gen5 controller, I used to do it in WIndows with AEOTEC backup tool.
For the SA413 I did not find a dedicated backup tool. Any idea ?

Re: zwavejs2mqtt

Posted: Monday 09 August 2021 16:31
by AllesVanZelf
I disable OpenZwave in Domoticz.
Activate ZwaveJS2MQTT plugin.
In ZwaveJS2MQTT at http://ip-adres:8091 I configured Zwave. All Zwave devices show up there. And In there I've set up MQTT broker.
Do I leave the Prefix at zwave?
I've also set a MQTT username and password here. Needed in my Mosquitto server.
Is there a possibility to enter the username and password in the plugin too so this plugin can read from the mosquitto server?

Re: zwavejs2mqtt

Posted: Monday 09 August 2021 23:08
by heggink
The current plugin does not support a user name and password but it should not be too difficult to implement I think. Can you create a change request in GitHub (or better, do a pull request )? I know moroen is a bit busy but Lets see. I run mqtt passwordless (as does moroen apparently) so we may not be able to test.

Sent from my SM-G980F using Tapatalk


Re: zwavejs2mqtt

Posted: Monday 09 August 2021 23:14
by AllesVanZelf
I created an issue: here.
How do I create a change request?
Pull request is far out of my scope.