I have a fundamental question. Best to 1st. give as an example. Assume I have the following code:
If motion_sensor#1 changes to active
switch on light.
If motion_sensor#1 changes to inactive
wait for 20 min.
switch off light.
If this is in 1 piston, then as I enter - the motion_sensor#1 detects me and turns on the light. Now, I sit quietly for (say) 3 min. and the sensor changes to inactive. The piston - when triggered realizes it and goes to if condition #2 and triggers the wait for 20 min. after which will switch off the light.
In between (this 30 min wait) however, I start to move around and each time the 1st. IF condition triggers OR the piston is in a limbo state as it’s waiting (wait - 20 min. condition)?
What I fail to understand is how will the system realize that wait for 20 min. now is no more valid since I continue to be in the room - moving?
Please assist in understanding this fundamental architecture.