Hello everyone,
I would like to share some of my Home Assistant automation scripts with you. These scripts have been instrumental in streamlining my smart home setup, and I hope they can be useful for you as well. I’m still learning, so I’d appreciate any feedback or suggestions for improvement!
Here are a few examples of what I’ve set up:
1. Midnight Lights Off
This automation turns off my Christmas lights at midnight and sends me a notification.
markdown
- id: midnight_turn_off
alias: Turn things off at Midnight
initial_state: True
trigger:
platform: time
at: ‘00:00:00’
action:- service: light.turn_off
data:
entity_id: light.christmas_lights - service: notify.ios_jack_iphone
data:
title: “Home Assistant”
message: “Christmas Lights are turned off.”
- service: light.turn_off
2. Reduce Brightness at Midnight
This one reduces the brightness of several LED lights at midnight, ensuring a softer glow during the night.
markdown
- id: reduce_brightness_of_lights_at_midnight
alias: Reduce brightness of lights at midnight
initial_state: True
trigger:
platform: time
at: ‘00:00:00’
action:- service: light.turn_on
data:
entity_id: light.kitchen_led
rgb_color: [0,0,255]
transition: 1
brightness_pct: 25 - service: light.turn_on
data:
entity_id: light.kitchen_table_led
rgb_color: [0,0,255]
transition: 1
brightness_pct: 25 - service: notify.ios_jack_iphone
data:
title: “Home Assistant”
message: “Kitchen LED, Kitchen Table LED brightness reduced to 25%.”
- service: light.turn_on
3. Lights Off at 2AM
This automation turns off specific lights at 2AM, helping to maintain a quiet and energy-efficient home during the early hours.
markdown
- id: 2am_turn_off
alias: Turn things off at 2AM
initial_state: True
trigger:
platform: time
at: ‘02:00:00’
action:- service: light.turn_off
data:
entity_id:
- light.table_lights
- light.spot_lights
- light.balcony_led
transition: 1 - service: notify.ios_jack_iphone
data:
title: “Home Assistant”
message: “Table, Spot and Balcony Lights are off.”
- service: light.turn_off
4. Lights Off at Sunrise
This automation ensures that certain lights are turned off as soon as the sun rises, making the most of natural light.
markdown
- id: sunrise_turn_off
alias: Turn things off at Sunrise
initial_state: True
trigger:
platform: sun
event: sunrise
action:- service: light.turn_off
data:
entity_id:
- light.flower_lights
- light.kitchen_led
- light.kitchen_table_led
- light.xiaomi_gateway_office
- light.xiaomi_gateway_hallway
- light.office_yeelight_strip
transition: 1 - service: notify.ios_jack_iphone
data:
title: “Home Assistant”
message: “Flower, Kitchen LED, Table LED Office and Hallway Lights are off.”
- service: light.turn_off
If you have any suggestions on how I can optimize these automations or make them more efficient, I’d love to hear them! For example, can I combine some of the repetitive actions into a single script? I’m also curious if there are alternative ways to configure these automations with fewer rules or characters.
Looking forward to your feedback and ideas! ![]()