I recently bought a glass lamp shade from AliExpress. This works great on my desk with WLED, but it gave me the idea to make a second lamp as a wake-up light.
Pretty simple here:
Once you have connected your light to Home Assistant, create an input_datetime helper via the frontend or in yaml.
Then, create an automation to set the datetime helper.
timestamp: "{{ as_timestamp(states('sensor.oneplus_8_pro_next_alarm')) - as_timestamp('1970-01-01T00:04:00.000Z') }}"
What I am doing here is getting the timestamp of my phone’s next alarm, minus 4 minutes. This means the script will start 4 minutes before the alarm triggers, and the script will be halfway by the time your alarm triggers.
Here is the full automation in yaml to paste and adjust:
alias: Wake Up Datetime
description: 'Sets datetime helper to next alarm'
trigger:
- platform: state
entity_id: sensor.oneplus_8_pro_next_alarm
condition:
- condition: not
conditions:
- condition: state
entity_id: sensor.oneplus_8_pro_next_alarm
state: unavaliable
action:
- service: input_datetime.set_datetime
data:
timestamp: >-
{{ as_timestamp(states('sensor.oneplus_8_pro_next_alarm')) -
as_timestamp('1970-01-01T00:04:00.000Z') }}
entity_id: input_datetime.next_wake_up
mode: single
Here is the full script I use, which:
alias: Wake Up Lamp
sequence:
- service: notify.mobile_app_oneplus_8_pro
data:
title: Wake up Routine
message: Clear to turn off lamp
data:
channel: Wake up Routine
color: '#FFC107'
priority: high
sticky: true
ttl: 0
- service: wled.effect
data:
effect: Sunrise
intensity: 220
palette: Sunset
speed: 120
entity_id: light.bedroom_lamp
- service: light.turn_on
data:
brightness: 10
entity_id: light.bedroom_lamp
- repeat:
count: '245'
sequence:
- delay: '00:00:02'
- service: light.turn_on
data:
brightness: '{{ state_attr(''light.bedroom_lamp'', ''brightness'') + 1 }}'
entity_id: light.bedroom_lamp
mode: restart
This whole script takes about 8 minutes in total.
Pretty simple this one, trigger the script at the date and time that we set in the helper.
alias: Wake Up Routine
description: ''
trigger:
- platform: time
at: input_datetime.next_wake_up
condition: []
action:
- service: script.wake_up_lamp
data: {}
mode: restart
So you’ve got up, turned off your alarm and now want to turn off the lamp? You could automate this by using the next alarm change again, but instead, lets turn off the lamp using the mobile app dismissed event instead.
alias: Wake up Routine Complete
description: ''
trigger:
- platform: event
event_type: mobile_app_notification_cleared
event_data:
title: Wake up Routine
condition: []
action:
- service: script.turn_off
data: {}
entity_id: script.wake_up_lamp
- delay: '00:00:02'
- type: turn_off
device_id: 75c8258ae843e73d8d8f5426d57f4e41
entity_id: light.bedroom_lamp
domain: light
mode: restart
This simply looks for the event with the title of the notification we used before and cancels the script, then turns off the lamp.
And that’s it, 100% Home Assistant only automations to wake you up in the morning!
Let me know what you think and throw me any suggestions or improvements via the usual social links