• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    reading relay state via WebSocket

    Official EVOK API
    2
    3
    1815
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      Boy Lenssen last edited by Boy Lenssen

      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 work

      And 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:

      http://192.168.1.16:8088/rest/all

      T 1 Reply Last reply Reply Quote 0
      • T
        tomas_hora administrators @Boy Lenssen last edited by tomas_hora

        @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.

        B 1 Reply Last reply Reply Quote 1
        • B
          Boy Lenssen @tomas_hora last edited by

          @tomas_hora Awesome! When I have time again for this project, I'll try it!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post