I’m just getting started with understanding how the automation works with HA, and setting up a basic outside lights on/off script.
So I want my lights to turn on 15 mins before sunset. Then turn off at midnight. Then turn on later the next morning about about 2 hours before sunrise and then back off at sunrise.
Can you do all of that in 1 script/rule? Or do I need to set up each one separately? I read that you case use ‘for’ to change the state for an XX minutes. But can you change the light to ON and then have go off later at a specific time all in 1 rule?
This is the first have for sunset. Do you need 2 separate?
automation:
- alias: Outside Lights on at Sunset
trigger:
platform: sun
event: sunset
offset: "-00:15:00"
action:
service: switch.turn_on
entity_id: switch.outside_garage_light_switch
entity_id: switch.frontporchlight_switch
- alias: Outside Lights off at 11pm midnight
trigger:
platform: time
at: "23:00:00"
action:
service: switch.turn_off
entity_id: switch.outside_garage_light_switch
entity_id: switch.frontporchlight_switch