Simple Sunrise Light
Home Assistant Script
Before the Alarm goes off in the morning and it is before sunrise, the dimmable light in the bedroom will gently brighten.
alias: bedroom sunrise light
sequence:
- if:
- condition: device
type: is_off
device_id: a7701bed7a2665599bfc7f73b66589a2
entity_id: light.bedroom_1_main_light
domain: light
- condition: state
entity_id: input_boolean.need_lights
state: "on"
then:
- data:
brightness_pct: 5
target:
device_id: a7701bed7a2665599bfc7f73b66589a2
action: light.turn_on
- repeat:
count: "50"
sequence:
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- if:
- condition: state
entity_id: light.bedroom_1_main_light
state: "off"
then:
- stop: Some one turned the light off
- target:
device_id: a7701bed7a2665599bfc7f73b66589a2
data:
brightness_step_pct: 1
action: light.turn_on
mode: single
The script above is called by our alarm script which also uses the following to turn on the radio at the correct time increasing the volume slowly.
alias: Radio 2 (Bedroom)
sequence:
- target:
entity_id:
- media_player.bedroom_sonos
data:
source: Radio 2
action: media_player.select_source
- metadata: {}
data:
volume_level: 0
target:
entity_id: media_player.bedroom_sonos
action: media_player.volume_set
- target:
entity_id:
- media_player.bedroom_sonos
data: {}
action: media_player.media_play
- data:
target_volume: 0.32
duration: 15
curve: logarithmic
target_player: media_player.bedroom_sonos
action: script.fade_the_volume_of_a_media_player
mode: single
icon: mdi:music
description: ""
.