Hi,
since yesterday I am playing with this nice piece of work - and it really is working, I can control all my devices. But I expected a little more, hopefully its just because I don't know better:
- I wanted to make my own node.js server, because of different reasons, for building my own infrastructure and connecting to my public server etc. AND because AJAX and this way of polling really is absolutely no good solution to me for a home automation interface, I definitely want to use websockets!!
But in this forum and in the document I have found no example for how to access the documented zway JavaScript Object from my node.js program so that I can for example bind callback functions and respond directly to my websocket clients.
Is that possible in any way? At the moment I am struggling with creating a userModule, but to me it doesn't seem to be the right way for my purposes...
- I read about websocket support but I found no explanation about it, how does it work?
Thanks in advance!
node.js, server-side API and websockets...
Re: node.js, server-side API and websockets...
Seems you only need acces to the Z-Wave stack?Daedalus wrote:- I wanted to make my own node.js server, because of different reasons, for building my own infrastructure and connecting to my public server
Since 29-12-2016 I am no longer a moderator for this forum
Re: node.js, server-side API and websockets...
You could use the JSON interface, like I do, and put up your own server on the same/different hardware.
That said, I'd like to see a way of turning z-way-server into minimal mode without any HA support. It was possible in 1.4 (empty automation directory) but with 2.0 it seems trickier?
That said, I'd like to see a way of turning z-way-server into minimal mode without any HA support. It was possible in 1.4 (empty automation directory) but with 2.0 it seems trickier?
Re: node.js, server-side API and websockets...
There is a thread where Pofs suggested this, but he did not give the recipe at that time if I remember correctly. I guess you would need an alternative main.js that starts the Zwave stack and a few other things. Having the Expert UI in such a minimal setup would be a necessity I think.Mirar wrote:That said, I'd like to see a way of turning z-way-server into minimal mode without any HA support. It was possible in 1.4 (empty automation directory) but with 2.0 it seems trickier?
Since 29-12-2016 I am no longer a moderator for this forum
Re: node.js, server-side API and websockets...
OK, but how do you do it? Via HTTP request and localhost? Thats the only way I figured out till now but as far as I know it's not possible with that method to bind callback functions?Mirar wrote:You could use the JSON interface, like I do, and put up your own server on the same/different hardware.
I'm not sure, first thing I want to get running is to send and listen to events WITHOUT polling from my node.js program...pz1 wrote:Seems you only need acces to the Z-Wave stack?
Re: node.js, server-side API and websockets...
On this forum I have written a procedure to send a UDP message on every event. Maybe that can inspire you
Re: node.js, server-side API and websockets...
That would be great, I think. I only use Expert UI and JSON.pz1 wrote:There is a thread where Pofs suggested this, but he did not give the recipe at that time if I remember correctly. I guess you would need an alternative main.js that starts the Zwave stack and a few other things. Having the Expert UI in such a minimal setup would be a necessity I think.
I don't know if you need a different main.js. It would be enough with a setting in the Expert UI or a file somewhere (/etc/defaults/z-way-server, for instance) that stops main.js from loading and starting things not needed.
Re: node.js, server-side API and websockets...
Unfortunately, you need to poll. You'll get all the new information since the last timestamp.Daedalus wrote:OK, but how do you do it? Via HTTP request and localhost? That's the only way I figured out till now but as far as I know it's not possible with that method to bind callback functions?Mirar wrote:You could use the JSON interface, like I do, and put up your own server on the same/different hardware.
http://172.16.0.72:8083/ZWaveAPI/Data/1423075953
to get all new data since 19:52:33 CET today from Razberry on 172.16.0.72.
I poll twice a second. You'll get repeats, but it's totally manageable. (I do the same thing again from my Javascript in-browser UI to my own server.)
You will have to parse that JSON format yourself. But it's really quite feasible. (Although I might be biased, I'm an embedded programmer for a living. The hairy protocols and precisely timed bitbanging against buggy hardware you have to do sometimes...)
Re: node.js, server-side API and websockets...
Not necessarily as I argued in my answer aboveMirar wrote:Unfortunately, you need to poll.
Since 29-12-2016 I am no longer a moderator for this forum
Re: node.js, server-side API and websockets...
Oh, interesting hack.pz1 wrote:Not necessarily as I argued in my answer aboveMirar wrote:Unfortunately, you need to poll.
I'd like to see something like Kodi's stream of JSON data on TCP though. That would be very useful, and more reliable.