As someone deeply passionate about optimizing my smart home setup, I’ve been working on streamlining my bathroom lighting automation. I initially set up three separate automations to handle motion detection, dimming after inactivity, and turning off after extended inactivity. While each automation worked individually, managing them as separate entities was cumbersome and inefficient.
The challenge was to consolidate these three automations into one cohesive system. After some research and experimentation, I found a way to achieve this by restructuring the triggers and actions within a single automation. Here’s a breakdown of the solution:
- Motion Detection: The automation triggers when motion is detected, turning the light on at full brightness (100% brightness, 500 color temperature).
- Dimming After Inactivity: After two minutes of no motion, the light dims to 75% brightness.
- Turning Off After Extended Inactivity: If no motion is detected for two and a half minutes, the light turns off completely.
Here’s the consolidated automation code:
plaintext
alias: Bathroom Lighting Automation
description: “”
trigger:
-
platform: state
entity_id:- binary_sensor.pir_toilet_beweging
from: “off”
to: “on”
condition:
action:
- binary_sensor.pir_toilet_beweging
-
service: light.turn_on
metadata: {}
data:
brightness_pct: 100
color_temp: 500
target:
entity_id: light.toilet
mode: single -
delay: 2:00:00
then:- service: light.turn_on
metadata: {}
data:
brightness_pct: 75
target:
entity_id: light.toilet
mode: single
- service: light.turn_on
-
delay: 2:30:00
then:- service: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.toilet
mode: single
- service: light.turn_off
This setup not only simplifies management but also ensures a seamless user experience. The key takeaway is that by carefully structuring triggers and delays, you can achieve complex automation behaviors without overwhelming your system with multiple separate automations.
I’d love to hear if others have tackled similar challenges or have tips for optimizing automations further! ![]()