1) Give a description of the problem
I want to create a motion trigger for my stairs that turns the lights on and then turns them off after a set time. This has been somewhat successful with my two motion sensors, one at the top and one at the bottom. The issue I am running into is with turning them off. I create a trigger that checks both sensors are inactive for at least 15 seconds and then the piston sets the wakeup time. However, if motion changes back to active within that wakeup timer, the piston still executes the off command for my lights. I looked into the task cancellation policy and maybe implementing some sort of loop to fix this, but am coming up empty handed. Below I will list the ideal scenarios, any guidance would be greatly appreciated.
2) What is the expected behaviour?
Senario A.
1). Motion is inactive on both sensors for 15 seconds.
2.) Wakeup time is set.
3.)No motion occurs and lights off command is sent.
Senario B.
1). Motion is inactive on both sensors for 15 seconds.
2.) Wakeup time is set.
3). Motion changes active within the wakeup time, task cancelled.
4). Once motion is inactive for 15 seconds the turn off of the lights is allowed to move forward.
3) What is happening/not happening?
Action is set to default task cancelation, but motion changing to active does not cancel the task, lights turn off anyway.