If any of five contact sensors (doors) open OR any of two motion sensors detect motion
THEN
Turn on the garage light switch AND keep them on as long as any of the same two motion sensors keep detecting motion
ELSE
Turn off the garage light switch after 20 minutes delay regardless of if any of the contact sensors are still open
I can get the logic to trigger on the contact open/motion active events but running to turn off timer that can get interrupted by new motion is giving me trouble. TIA!
Probably should explain you need to ensure the actions are cancellable and the intention of the cancel actions step is to cancel any previous triggered instance of the rule, hopefully achieving what you are missing.
The Actions logic says (I think): Turn on the garage lights then set a delayed turn off of 20 minutes, unless motion A or B is active, then cancel that delayed off action.
I wonder if this says "cancel the turn off (delayed) action" or does it say "cancel the delay and go ahead with the turn off"?
I think you're going to get tripped up on that cancel delayed actions.
Here's a similar rule for garage door. If any door or motion gets triggered, then the lights turn on, but everything has to be closed and silent before they turn off.
Cancel delayed actions has to be used when the rule evaluates to false to keep the lights on.
[EDIT]
You could put the cancel delayed actions in the top if and eliminate the end if remove the second if and kepe the else-if at the bottom for the same result. This was a rule that I built early on and never corrected. But it still works.
This logic says "Did a door open or motion event happen? Then cancel any previous delay, send ON to the lights, send Off +20 min to the lights." "Did it trigger again? Rinse, repeat."
Tinkering with this a little more, looking for a way to avoid lots of unneeded ON actions, I moved the ON and OFF actions into conditional loops. I let the Cancel action trigger no matter what (seems harmless) but then check to see if the lights are already ON and if so, re-establish the OFF +20 min status and exit. If the lights are OFF, then I do both the ON and OFF + 20 actions.