Automation Examples Using the Sun


Turn on the living room lights 45 minutes before sunset if anyone home

1
2
3
4
5
6
7
8
9
10
11
12
automation:
  trigger:
    platform: sun
    event: sunset
    offset: "-00:45:00"
  condition:
    platform: state
    entity_id: group.all_devices
    state: home
  action:
    service: homeassistant.turn_on
    entity_id: group.living_room_lights

Natural wake up light

Note, Philips Hue is currently the only light platform that support transitions.

1
2
3
4
5
6
7
8
9
10
automation:
  trigger:
    platform: time
    after: "07:15:00"
  action:
    service: light.turn_on
    entity_id: light.bedroom
    data:
      # 900 seconds = 15 minutes
      transition: 900