All Events from EventBus in Script

Discussions about Z-Way software and Z-Wave technology in general
geirgp
Posts: 42
Joined: 22 Oct 2015 19:16

Re: All Events from EventBus in Script (via MQTT)

Post by geirgp »

bc-109 wrote: When I bought a Razberry, I didn't want to buy a "home automation software". I wanted to buy a "Z-Wave transceiver", with an API, so that I can control it from my software
That's exactly the same reason why I bought the Razberry. If I wanted a home automation platform I would have bought something like Fibaro HC2 or the Zipabox instead. Subscribing to events is a feature I also hoped was available as ZWay seemed to be a bit more hacker/developer focused.

I'm having a similar struggle where I want to integrate zway with MQTT (2-way):
1. publish all zwave device events to mqtt topics
2. react to specific mqtt topics and execute commands on zwave devices

I need this to be implemented in the most generic way (i.e. no need to re-configure anything when I add/remove z-wave devices). I don't want to maintain any mapping-files.

All in all, requirements sound pretty similar to your UDP/event needs. My main problem though is limited JS knowledge and time (day job + family), but at some point I hope to have a working solution.

On another note, I'm not sure why you would use UDP for transmitting events: to me UDP is, by definition, an unreliable protocol - on top of being quite low level. Unless you've already ruled it out I would recommend taking a look at MQTT instead. It's a lightweight publish/subscribe messaging protocol, simle to set up and use. My impression is that it's widely used in the HA/IoT communities.

My goal is to use MQTT as a central hub for interfacing with all my devices regardless of their protocol (z-wave, wifi, http, philips hue...). This means that my chosen rule-engine (openHAB) for smart home logic can control all devices as it already speaks MQTT.

Let me know if you find a generic way of listening to zway events for any/all zway devices, AND/OR if you should choose to go down the MQTT way instead of UDP :)
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: All Events from EventBus in Script

Post by pz1 »

@geirgp
Over the past year UDP has proven to be more stable in my installation then the underlying Z-Wave mesh network ;)

MQTT indeed seems an interesting protocol for both sending and receiving events in Zway. Since the work is not trivial, I think focus should be on the ZWay virtual device level, and not restricted to the Z-Wave device level. An other consideration is the message format. I would keep that as simple as possible; {sensor,value} pairs.

For MQTT, I am experimenting with LoraWAN and Node-RED (see Recipes) interfacing to both ZWay and OpenRemote. The latter works. For Zway I have as yet to make a UDPListener.

For somebody knowing the bowels of Zway it wouldn't be overly complex to create at least a UDP sender of all Events.
Unfortunately I lack those skills. In the meantime I am pretty happy with Node-RED to do some proof of concept exercises for my own interfaces.
bc-109
Posts: 10
Joined: 01 Jan 2016 00:11

Re: All Events from EventBus in Script

Post by bc-109 »

Hi,
My goal is to use MQTT as a central hub for interfacing with all my devices regardless of their protocol (z-wave, wifi, http, philips hue...). This means that my chosen rule-engine (openHAB) for smart home logic can control all devices as it already speaks MQTT.
Interesting setup :-) I had exactly the same approach some years ago, but using xPL protocol, and a xPL HUB.

I don't know MQTT. I know roughly what it is, but I never got time to go deeper. But I may use it in the future.

I'm actually using a "zibase" as a Z-Wave transceiver. It communicates through UDP. Then, I wrote an UDP-to-xPL gateway, so that all my network can interact with Z-Wave peripherals.

Of course, as sais before, UDP was just a suggestion. Because I already used it succesfully in such a setup, and it's a simple way to forward data asynchronously.

But I would have no problem using any other protocol such as MQTT.

The only requirement is being able to receive events asynchronously, with a standardized protocol, without having to go into the Z-Way code, and without having to program in JS.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: All Events from EventBus in Script

Post by pz1 »

@geirgp
I noticed in this thread that you did consider Websockets. Did you look more into that?
geirgp
Posts: 42
Joined: 22 Oct 2015 19:16

Re: All Events from EventBus in Script

Post by geirgp »

@pz1 no I did not due to @pofs' response in that thread "Z-way currently supports just websocket client" which indicates you would have to make a module for it anyway.

I asked about the websocket support as I was considering writing an external application which would bridge zway with mqtt by connecting to zway using web sockets. since that seemingly requires a custom module which listens to all devices and handles websockets server I canned that idea. it would be easier to just write the mqtt module instead.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: All Events from EventBus in Script

Post by pz1 »

thanks
bc-109
Posts: 10
Joined: 01 Jan 2016 00:11

Re: All Events from EventBus in Script

Post by bc-109 »

Hi,

As I said before, I had a try to OpenZWave, and the Python-OpenZWave wrapper. As I'm a Python programmer, that's perfect for me. I can do what I need to do, and I can receive asynchronous events very simply : I just have to "map" my Python fonction to the corresponding event.

I'm writing an OpenZWave-to-XPL gateway, because all my setup is already using XPL. But I may have a look at mqtt in a near future :-)
past
Posts: 32
Joined: 11 Sep 2013 22:54

Re: All Events from EventBus in Script

Post by past »

I found https://github.com/olliephillips/tinyMQTT. Pure mqtt implementation in JS. Anyone has try this?
goodfield
Posts: 1
Joined: 21 Apr 2016 22:02

Re: All Events from EventBus in Script

Post by goodfield »

Hi,

looking for a solution to add MQTT capability to my RazBerry i found this thread ... wasn't excited about any existing solution, cause i wanted to have it as simple as possible and a solution with push and no pull mechanism.

Thats why i looked for MQTT JS implementations (tooo lazy to implement it by myself) i could port to the Z-Way Home Automation engine ... finally i found one ... and used it to create a Z-Way module:

https://github.com/goodfield/zway-mqtt

It's not complete but works for me, if anyone want's to try it, i'm happy for any feedback :D

David
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: All Events from EventBus in Script (via MQTT)

Post by pz1 »

@ goodfield
David, I just noticed that Robin Eggenkamp has published a MQTT app in the ZWay online appstore. See here the description: http://developer.z-wave.me/?uri=public#/web/apps. He kindly acknowledges your work as you can see from the github link.
Post Reply