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

    Switching relays in synchronous mode?

    Official EVOK API
    2
    3
    929
    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.
    • M
      majorcsa last edited by majorcsa

      Hi,

      I have several UniPi L203 and I would like to integrate it to another solution (HomeAssistant) which can use the Evok REST API. When I configure it to turn a relay on or off with POSTing the necessary URL and data it works fine. However then it tries to fetch the same resource with GET to see if the change was successful. However the EVOK API still reports the old status and it requires some time to reflect the real status.
      Would it be possible to have the POST in synchronous mode? I mean it would return the result only if the resource is really changed its status. This could be an additional parameter to the call, then the upcoming call could reflect the real status of the relay.

      Thanks,
      Csaba

      1 Reply Last reply Reply Quote 0
      • T
        TomasKnot last edited by TomasKnot

        Hi @majorcsa!

        Apologies for the late reply, we have been quite busy lately. A synchronous mode would be possible to implement, but unfortunately there are two issues with it - or rather there are two possible approaches, neither of which is ideal. The first option is to assume that the request has completed successfully, and only correct the actual state after the operation; the second being to delay the response until the operation is verified (as per your suggestion), but unfortunately due to the way our server is structured this would cause significant scheduling problems and could lead to the server being overwhelmed if other requests would arrive in the meantime.

        I am more inclined to implement the first option than the second, but only as an optional switch in the EVOK configuration file. It may take a little while before it is finished, as we are quite busy with other work at the moment. I'll post in this thread once a patched version of EVOK is out.

        Kind Regards

        1 Reply Last reply Reply Quote 0
        • T
          TomasKnot last edited by TomasKnot

          Hi @majorcsa,

          I have added this feature via a config file switch to the Master branch of EVOK. As I've mentioned before it may take a while to propagate to our releases and debian packages, but you should be able to test it out manually.

          I hope this helps,
          Kind Regards

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