How to turn off light when door stays open

I have a door sensor in my pantry.
Door opens, light comes on, door shuts, light goes off......
Trouble is, my grand daughter comes over and leaves pantry door open.
How do you make this check if door is still open, and if the door is open for an amount of time, shut off? Thank you

Here’s how I would do this:

Trigger: Door Sensor contact open
On: Pantry Switch
Wait for event: Door Sensor contact closed -> Timeout X minutes
Off: Pantry Switch


Ok, that works, thank you. This is how I wrote it

1 Like


Note that the if/else condition is not required, and neither is the “close” trigger. They won’t do any harm, but don’t add any value either, just extra lines of code.