Evaluate if a condition with a timeout has become false

Hello, I am new to Apilio and am not sure if I am doing things right…

For boolean variables that are always true and matching conditions that use a timeout to only be true for a certain amount of time, what is the best way to evaluate if the condition has become false? The use case is similar to the examples that use motion detectors that only send a true condition.

I currently use a logic block the uses an OR condition with several other booleans and then performs the desired action when the entire block evaluates to false. I end up doing this because NOT is not supported for complex conditions for the logic block and one cannot create a condition that checks the value of another condition that has a delay. Simplified example:

CURRENTLY:
If OR(lights_paused, lights_are_off,motion_detected)
True: Do nothing
False: turn_lights_off

IF NOT WERE SUPPORTED:
If AND(NOT(lights_paused) ,NOT(lights_are_off),NOT(motion_detected)
True: turn_lights_off
Flase: Do nothing

IF CONDITIONS COULD CHECK OTHER CONDITIONS:
If AND(lights_not_paused,lights_are_on,motion_not_detected)
True: turn_lights_off
False: Do nothing

I ask this mostly from a code readability point of view and in anticipation of writing more complex conditions. To me, the logic seems clearest in the last block above if we could use conditions to check the state of other conditions in the context of a timeout. Or perhaps I’m going about this all wrong.

Perhaps if we could comment our code/logic blocks if the logic seems not straightforward, that would be a simple fix.

Thanks for your time.

2 Likes

I think @pebneter should allow for the “NOT” operator in the complex conditions section of Logicblocks. Otherwise it is sometimes very complex to use conditions with timeout or delay.

2 Likes