Input State remains the same

  • I made some changes to the API according to my requirements, I am able to control the relays the ways I wanted but when I check the input state using the command result = map(lambda dev: dev.full(), Devices.by_int(INPUT)) which I'm running it in a while loop but when the state of the input changes outside the result displayed doesn't change at all. It stays the same, but when I run it in the LoadAllHandler function, the state change is visible. It would be great if you guys could tell me where I'm going wrong.

  • administrators

    The evok itself is not designed to handle the logic of your application. That's why we call it API.

    It is using Tornado which means the server itself runs in one loop so you need to have all the program behavior ready before it is called mainLoop.start(). So if you run an infinite loop anywhere in evok, you stop everything else (reading, setting, all APIs, ...).

    So I suggest using that APIs, it is much more easier to implement and you have the same functionality. But if you would REALLY want to do it in evok, you would have to prepare your program in a function, all tasks that would take more time would have to be decorated as coroutines and the call has to be yielded in order not to stop the main loop. The logic behind this is a little bit complicated to describe in one post :)