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

    reading relay state via WebSocket

    Scheduled Pinned Locked Moved Official API - Evok
    3 Posts 2 Posters 2.8k Views
    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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post