EVOK: wget/POST api only works when control panel is open in browser

  • Re: Enabling counter mode for Neuron inputs via evok

    After discovering that counter_mode for digital inputs on Neuron S103 is actually enabled even though it is reported as disabled by evok POST api, I implemented my business logic as a simple bash script which uses wget as per the examples on the evok github page.

    It works nicely, but ONLY if I have a browser open on the "UNIPI control panel" page.

    As soon as I close the browser, all values are not updated anymore!
    Polling the counter value from my bash script always returns an old number (and old values of input states also), and as soon as I reopen the browser on the control panel I get a big jump in the counter in my app.

    It seems as if EVOK only updates its internal state if a websocket connection is in place.
    This seems horribly wrong to me: is it by design? Is there something wrong in my setup?

    Anyone else having this issue?
    Please advise.


  • administrators

    @rob Thanks a lot for the info. I will try to implement the fix soon, https://github.com/UniPiTechnology/evok/issues/14

  • @tomas, thank you for taking care of this issue.

    Let me add some more info:

    1. I tried also the python/JsonRPC approach and I can confirm it behaves the same way, it only updates the values while a websocket connection is in place.

    2. As a workaround, I am using the code from the python websocket example on the evok github page to open a websocket connection from bash. I let it run in background on the rpi and this is enough for my original bash script (also running locally) to get the right real-time values from the REST calls, without the need to keep a separate computer running with the browser open on the control panel webpage.

    3. In the output of the python websocket app I only see the temperature values updating, but no reflection of input and output state changes... I did not investigate further, but tomas you might want to take a look at that also.

    I must say I really like the neuron concept and its combination with Evok, programming a PLC with standard linux tools, it just feels... empowering :)
    Hoping the stable, official release for Neuron comes soon.

    Also, let me suggest to improve the documentation... I know, it's tedious and time consuming, but good documentation gives first time customers like me the feeling of a robust product with a solid company behind, and makes everything just easier to start with.
    Keep up the great work guys!!


  • This is causing me a problem too.....

  • administrators

    @Merv I saw your comment on github. I will get to it soon.

  • administrators

    @tomas_hora The issue should be fixed in one of the latest commits. Please check and let me know.

  • That's brilliant.
    I have some new micro SD cards on order, I'll do a clean new install and test once they arrive.


  • @tomas_hora Hi,
    I did a fresh Rasbian install, got the neuron online, did a
    git clone http.....
    set the permissions (as per the GIT page)
    started it up.


    I have my python monitoring program starting automatically as a service, and I had to put a little sleep command in it on start as it was trying to run before EVOK started. Runs great.

    Many thanks.

Log in to reply