I am hoping you guys can help me work through the logic of a rule that I am trying to create. I currently have a rule using a global variable that mostly works, but I am trying to refine it to be better. I have a contact sensor, light switch and motion sensor.
Here is what I am trying to accomplish:
Only between Sunset and Sunrise:
- Open Patio Door turns on Patio Light to let dog out.
- Close Patio Door. Patio Light remains on.
- Open Patio Door to let dog in. Patio Light remains on.
- Close Patio Door. Patio Light turns off (only if no subsequent motion detected).
Here's the rub. Sometimes we interrupt this sequence by going out onto the patio after step 3-4 instead of letting the dog in. In that case, we do not want the light to turn off while we are out there. I'm trying to figure out how I can use the motion sensor to determine if we are on the patio and cancel turning off the light until the next door close event.
I'm thinking I need to do something like wait for the motion sensor to go inactive after the door closes, then see if it goes active during a certain period of time. If so, then do not turn off the light. I only want the light to turn on/off based on the door sensor. I only need the motion sensor to cancel the turning off of the light.
I hope I am explaining this well. Thanks in advance for any guidance you can provide.