MQTT Subscriber

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
ridewithstyle
Posts: 72
Joined: 02 Jan 2016 01:20

MQTT Subscriber

Post by ridewithstyle » 15 Apr 2019 19:17

Hi there,

this weekend I experimented a little with MQTT, set up mosquitto as broker and sucessfully published ZWay device status event to the broker.

Is it possible to subscribe from Zway to the MQTT broker and subscribe to topics? I would like to integrate MQTT Sensors into my ZWay rules and automation logic, but fail to see where I can get the MQTT updates into ZWay. Has anybody experience with mixing MQTT and Zway?

Thanks and best regards,
rws

User avatar
PoltoS
Posts: 4722
Joined: 26 Jan 2011 19:36

Re: MQTT Subscriber

Post by PoltoS » 19 Apr 2019 22:45

The MQTT app is a community contribution. Currently it supports only push mode.

You can improve it an publish your version or contact the the developer and ask if he can make the pull side too.

Basically it should not be hard - use websockets to subscribe and get updates. Also add devices on the fly once new features come. And use some block list not to import some features. Should not be that hard.

ridewithstyle
Posts: 72
Joined: 02 Jan 2016 01:20

Re: MQTT Subscriber

Post by ridewithstyle » 19 Apr 2019 22:51

Thanks for the clarification. I might take a look into the module, but as I don't speak the language that might take a while before I reach the point of contribution worthy code.

Best Regards,
rws

ridewithstyle
Posts: 72
Joined: 02 Jan 2016 01:20

Re: MQTT Subscriber

Post by ridewithstyle » 25 Jun 2019 16:44

Hi there,

Today I took the time and planned to dig a little into the MQTT Module and it turns out I can do everything I wanted without a single change of code.

Documentation of the Module says that you can set the values of the device you published by sending "on" or "off" to them, something I tried before but to no avail. What I previously missed was that you have to add "/set" to the topic and not just only keep the topic' name. So for my device "Ghost" in the room "Halloween" I send ZWay/Halloween/Ghost/set and "on" as message and there we are. I am able to set exported ZWay Devices via MQTT. Step one complete

Now how about devices, that are no ZWay Z-Wave devices? I just tried the "dummy device" as switch and exported the dummy device with the MQTT Module. Updating the device from any other MQTT Publisher via Topic ZWay/Room/Device/set value works like a charm and triggering the dummy device from ZWay itself results in a proper MQTT notification as well.
Step Two complete!

Now I can add my tons of cheap Halloween devices that are only powered up once per year without compromising my ZWave-Network. My previosly used Z-Uno devices resulted in poor network performance once they we powered down resulting in permanent timeouts of messages on ZWay. I am already up to NodeID 85 with only 45 active nodes because I constantly had to exclude powered down devices again.

Now the final missing piece is the dummy devices as a Sensor, so I can use MQTT nodes as sensor input for complex automation rules like "in case someone trips the IR then let the Ghost start howling".

Just thought I'd let you know in case someone else tries something similar, because it is actually quite comfortable

Best Regards,
rws

enbemokel
Posts: 258
Joined: 08 Aug 2016 17:36

Re: MQTT Subscriber

Post by enbemokel » 26 Jun 2019 10:03

Thanks

ridewithstyle
Posts: 72
Joined: 02 Jan 2016 01:20

Re: MQTT Subscriber

Post by ridewithstyle » 02 Jul 2019 23:59

Hi there,

A few more comments on the MQTT-Module.

The module has a field for base topic and two postfixes for getting the value and setting the value. This does not work with e.g. the Shelly 2.5, which accepts a setting value with

shellies/shellyswitch25-<deviceid>/relay/<i>/command

and reports the status via

shellies/shellyswitch25-<deviceid>/relay/<i>/

So the workaround is to add two MQTT modules, one as setter for values being updated BY ZWay and one instance with the correct catcher topic to report value updates from some other publisher TO Zway. This doubles the MQTT traffic on the server, but it works fine.

You have to ensure that each instance of the MQTT Module has its own unique ClientID, otherwise there will be frequent disconnects and reconnects and nothing works. The ZWay log will be hammered with errors which point directly to MQTT

I already raised an issue on github to let the developers know

Best Regards,
rws

Post Reply