Morning automation setup can be both exciting and a bit tricky. I recently set up a Hue motion sensor to turn on my kitchen lights in the morning, but it was triggering multiple times between 3 AM and 9 AM. After some research and tweaking, I found a solution that works perfectly! Here’s how I did it:
-
Understanding the Problem: The motion sensor was firing every time I moved within the specified time window. To prevent multiple triggers, I needed to set a time-based condition and ensure it only activates when the family is home.
-
Setting Up the Automation: I used the Rule Machine to create a trigger based on the motion sensor’s state. The key was adding a time condition to limit the trigger to once within the desired timeframe.
-
Testing and Adjustments: After setting it up, I tested different scenarios to ensure it worked as intended. The automation now triggers the lights once when the first motion is detected in the morning, and it respects the time constraints perfectly.
Here’s the YAML configuration I used:
yaml
- id: ‘morning_motion’
alias: ‘Morning Motion’
trigger:- platform: state
entity_id: sensor.hall_motion_sensor
to: ‘on’
condition:
condition: and
conditions:- condition: time
before: ‘09:00:00’
after: ‘03:00:00’ - condition: state
entity_id: group.family
state: ‘home’
action:
- condition: time
- service: notify.pushbullet
data:
message: ‘Good Morning’
target: ‘device/Google Pixel 2’ - service: script.good_morning
- platform: state
If you’re setting up a similar automation, consider these tips:
- Test Thoroughly: Always test your automation with different scenarios to ensure it behaves as expected.
- Use Conditions Wisely: Time and state conditions can help prevent unnecessary triggers.
- Adjust Based on Feedback: Pay attention to how the automation performs and tweak it as needed.
I hope this helps anyone looking to set up a morning automation! Let me know if you have questions or need further assistance.