Page 1 of 4

websocket client

Posted: 16 Nov 2015 00:02
by geirgp
Does the z-way device api support websockets or anything else that would let me listen to changes without hammering the server with poll requests?

Re: websocket client

Posted: 17 Nov 2015 23:21
by PoltoS
yes, please try rc17 with sockets.websocket. See https://github.com/Z-Wave-Me/Z-Way-Manu ... wayDev.pdf for more info

This is a bit experimental for now, but works so far. Would be cool to have some feedback too.

Re: websocket client

Posted: 18 Nov 2015 09:50
by geirgp
Ok, that's great. I already tried connecting to z-way via web sockets, but couldn't figure on which url/path this is exposed by z-way. I cannot find this in the pdf you are referring to either, the example is just generic and connects to "ws://echo.websocket.org" instead of the z-way server.

What would be the correct url for connecting to z-way over a websocket?

Re: websocket client

Posted: 19 Nov 2015 11:48
by past
Looks like there is client only sockets. That sad.

Re: websocket client

Posted: 21 Nov 2015 14:33
by KarlNickel
@PoltoS:
Could you please provide a working example how to connect to Z-Way using websockets? The documentation really is too generic :cry:

Re: websocket client

Posted: 21 Nov 2015 19:56
by pofs
Z-way currently supports just websocket client (well, it also has built-in websocket server, but it is intended for push notifications only, and is not scriptable).
Even if we add full websocket server later (but I still doubt its usefulness), it will be there only for integration with other services. Z-way itself will never be controllable via websockets.

Re: websocket client

Posted: 21 Nov 2015 23:37
by KarlNickel
Thanks for your reply. What kind of push notification do you mean? Is it possible to receive device updates - and if yes, how can I use it? Because this is the only use case I really need.

Re: websocket client

Posted: 22 Nov 2015 18:45
by geirgp
push notifications would be sufficient for my use, no problem using the normal rest api for control. I just want to be notified about device updates as soon as they happen, yet avoid hammering the server with GET requests..

Re: websocket client

Posted: 22 Nov 2015 23:46
by pofs
Just connect to ws://razberry-ip:8083 from client-side js, and you'll receive everything pushed with ws.push() call from server-side js (ws is a global instance of WebServer object, which serves 8083 port).

Re: websocket client

Posted: 23 Nov 2015 00:37
by KarlNickel
I didn't looked very deep inside the code of the home automation part of Z-Way on GitHub. But I guess have to code a server side module which listens to any kind of update and makes a ws.push(), right?