Skip to content

Instantly share code, notes, and snippets.

@LarsBergqvist
Last active November 8, 2021 18:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LarsBergqvist/4be63207213ccc0135640490978032c9 to your computer and use it in GitHub Desktop.
Save LarsBergqvist/4be63207213ccc0135640490978032c9 to your computer and use it in GitHub Desktop.
Home Assistant automation for turning lights on and off based on sunset and sunrise
automation:
- alias: Turn on garden lights when sun sets
trigger:
platform: sun
event: sunset
action:
service: switch.turn_on
entity_id: switch.garden_lights
- alias: Turn off garden lights when sun rises
trigger:
platform: sun
event: sunrise
action:
service: switch.turn_off
entity_id: switch.garden_lights
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment