Disable automations when door is closed
Prevent frustration when motion-based lighting turns off while you’re sitting still in the bathroom or bedroom. This automation uses a door sensor to intelligently override motion timeout behavior.
- Sitting on toilet
- Taking a shower
- Lying in bed reading
- Working at desk
- Result: Lights turn off unexpectedly, leaving you in the dark
- Door closed = Someone is inside, keep lights on
- Door open = Room is empty (after motion timeout), safe to turn off lights
Use cases
Private Spaces
- Bathroom - People sitting still on toilet or in shower
- Bedroom - Guest room during naps or sleep
- Reading Nook - Sitting still while reading
Work & Entertainment
- Home Office - Working at computer without much movement
- Media Room - Watching movies in reclined position
Products needed
Essential Equipment
- Full Support: Home Assistant, SmartThings (with SharpTools), Hubitat, HomeSeer - These platforms support variables or virtual switches needed for this automation
- Limited Support: Alexa, Google Home (use workarounds), Apple HomeKit (requires Homebridge for full functionality)
Automation setup
Scenario 1: Bathroom (Keep Lights On When Door Closed)
Original automation (problem): Trigger: No motion for 5 minutes → Action: Turn off bathroom light → Issue: Turns off while someone is sitting still inside
Improved automation (solution):
Triggers
- No motion detected for 5 minutes
Conditions
- Door is OPEN (not closed)
Actions
- Turn off bathroom light
Logic: Only turn off lights if: (1) No motion detected for 5 minutes AND (2) Door is open (meaning no one is inside)
Scenario 2: Guest Room (Delay After Entry)
Prevent lights from turning on automatically when guests are resting:
Triggers
- Guest room motion detected
Conditions
- Door has been open for 5+ minutes
Actions
- Turn on guest room light
Logic: If guest leaves room and returns within 5 minutes, lights don't turn on automatically. Helpful for naps, early bedtimes, and privacy.
Platform-specific examples
Home Assistant
SmartThings
Hubitat
Advanced features
Manual disable mode
Add a physical button to manually disable all automations in a room:
- Trigger: Disable button pressed
- Action: Toggle automation disabled mode
- Condition: Add to all automations: mode is OFF
Visual indicator
Use LED strip or smart bulb to show automation status:
- When disabled: Set status light to red
- When enabled: Set status light to green
- Trigger: Automation mode changes
Time-based auto-resume
Automatically re-enable automations after a set period:
- Trigger: Disabled mode has been ON for 2 hours
- Action: Turn off disabled mode (re-enable)
- Prevents accidentally leaving automations disabled
Common issues and solutions
Lights still turn off when door closed
- Check door sensor state in app (is "closed" showing as 'on' or 'off'?)
- Verify condition logic matches your sensor's behavior
- Confirm automation is actually using the condition
- Reverse the door state condition if needed
Door sensor not reliable
- Reposition for better alignment
- Replace battery
- Adjust door latch/strike plate
- Use tilt sensor instead of contact sensor
Related automations: