Skip to content

Instantly share code, notes, and snippets.

@pjanuario
Created April 6, 2020 21:26
Show Gist options
  • Save pjanuario/fd4b499aeeb663998f95706d022df68a to your computer and use it in GitHub Desktop.
Save pjanuario/fd4b499aeeb663998f95706d022df68a to your computer and use it in GitHub Desktop.
Homeassistant sunset automation
# 15m after the sunrise
# - Open the covers
# - Turn off ligths
- id: sunrise
alias: 'Sunrise automation'
trigger:
- platform: sun
event: sunrise
offset: '00:15:00'
action:
- entity_id: cover.living_room
service: cover.open_cover
- entity_id: light.outside_back
service: light.turn_off
# After sunset
# - Close the covers
# - Turn on outside lights
- id: sunset
alias: 'Sunset automation'
trigger:
- platform: sun
event: sunset
action:
#- delay: '00:{{ (range(1,10)|random|int) }}:00'
- entity_id: cover.living_room
service: cover.close_cover
- entity_id: light.living_room_center
service: light.turn_on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment