Realtime Socket Communication With z-way-server

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
coolbloke1324
Posts: 18
Joined: 29 Nov 2015 15:47

Realtime Socket Communication With z-way-server

Post by coolbloke1324 »

Whilst polling every second works ok, it would be way better to have a reatlime feed that we could connect to.

Is it possible to have a listener built into z-way-server that would allow a Node.js (or whatever) process to open a connection and then receive realtime notifications pushed from the z-way-server process?
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Realtime Socket Communication With z-way-server

Post by pz1 »

I do it the other way around; i.e. send status change events via UDP to a third party UDPListener. See Recipe section
coolbloke1324
Posts: 18
Joined: 29 Nov 2015 15:47

Re: Realtime Socket Communication With z-way-server

Post by coolbloke1324 »

pz1 wrote:I do it the other way around; i.e. send status change events via UDP to a third party UDPListener. See Recipe section
But do those changes get sent in realtime or is it still polling for changes internally?
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Realtime Socket Communication With z-way-server

Post by pz1 »

I don't know how it is handled within ZWay, because that part is not opensourced. Anyhow if I do change one of my binary switches, I do see almost immediately a status change on the Android client screen that is connected to my OpenRemote controller which runs on a Synology DS212+ (Raspi sends UDP message to Synobox). Fast enough for me, and much better than the 1s polling I had defined before on the Synobox. Besides the CPU load on RasPi is considerably lower
coolbloke1324
Posts: 18
Joined: 29 Nov 2015 15:47

Re: Realtime Socket Communication With z-way-server

Post by coolbloke1324 »

Hmm that seems like a really nice way to do it...

So where do you put that code? Is it in a "Load custom JavaScript code" app?

Instead of sending a UDP packet I'm going to setup a bash script to run wget to an HTTP listener localhost which will effectively send a message into a Node.js process running the HTTP listener.

Haven't thought it all through yet... might be a better way to do it :)
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Realtime Socket Communication With z-way-server

Post by pz1 »

coolbloke1324 wrote: So where do you put that code? Is it in a "Load custom JavaScript code" app?
See Recipe section
Post Reply