Hey everyone, I wanted to share my recent success with setting up a smart bathroom automation system. It’s been a bit of a journey, but it’s finally working perfectly!
The Challenge
I wanted to create an automation where the bathroom lights turn on when someone enters and turn off after 1 minute of inactivity. However, if the door is closed, the lights should stay on until the door is opened and no motion is detected. This seemed straightforward, but it took me a few days to get it right.
The Setup
I’m using a motion sensor and a door sensor for this setup. The motion sensor detects when someone enters the bathroom, and the door sensor checks if the door is closed. Here’s how I configured it:
- Motion Detection: When motion is detected, the lights turn on.
- Door Check: If the door is closed, the lights stay on indefinitely.
- Timeout: If the door is open, the lights turn off after 1 minute of no motion.
The Solution
After some trial and error, I realized the key was to use conditional logic in my automation. Here’s the breakdown:
yaml
alias: Bathroom Light Automation
trigger:
- platform: motion
entity_id: binary_sensor.motion_sensor
condition: - condition: state
entity_id: binary_sensor.door_sensor
state: ‘closed’
action: - service: light.turn_on
entity_id: light.bathroom_light - delay: 00:01:00
- service: light.turn_off
entity_id: light.bathroom_light
Key Learnings
- Conditional Logic: Using conditions in automations can save a lot of time and avoid unnecessary actions.
- Testing: Don’t skip testing each part of your automation separately before combining them.
- Patience: It might take a few tries, but persistence pays off!
Community Thanks
I want to thank everyone in this community for their helpful tips and guides. Without your support, I wouldn’t have been able to figure this out so quickly!
If anyone has questions or needs help with similar setups, feel free to reach out. I’m happy to share more details!
Cheers, [Your Name]