reading relay state via WebSocket
-
I have everything working now from my custom software and I love it. There is one thing I can't figure out yet, and that is how do I read the current state of a relay? I see it is possible via REST for instance, but not via WebSockets?
ws.send('{"cmd":"get","dev":"relay","circuit":"2_14"}')
doesn't seem to workAnd is there maybe a way to get all current states of inputs and relays? I need to know what the state is at startup, not when it changes. Otherwise I cannot check if the input value has changed
edit: if no one has a better idea, I'm going to call the rest API at start of the application and keep the state in my app:
-
@Boy-Lenssen Please try using cmd "get_state". Haven't tried but might work :)
Also see: https://github.com/UniPiTechnology/evok/pull/9 which is adding a support to get state of all devices. In the release, it will be done in similar way or maybe different command.
-
@tomas_hora Awesome! When I have time again for this project, I'll try it!