Home Assistant Alarm Clock

It took me a bit to get an alarm clock going in Home Assistant. I also wanted to try waking up to the light gradually turning on instead of sound. The first thing you will need two input booleans in the configuration.yaml, one for time, and one for turning the alarm on and off.

input_datetime:
  alarm_clock:
    name: Alarm Clock
    has_time: true

input_boolean:
  alarm_clock_on:
    name: Alarm Clock On
    initial: on
    icon: mdi:alarm-check

The automation triggers when whatever the time that it is set to in the input_datetime boolean hits. I also have two conditions for it to only work when the input_boolean is on, and only if either one of us is home. The two scripts it runs are for the light, and for casting home assistant to a google hub that sits next to the bed.

- id: '1572295081823'
  alias: Light Alarm Clock
  description: ''
  trigger:
  - platform: template
    value_template: '{{ states(''sensor.time'') == (state_attr(''input_datetime.alarm_clock'',
      ''timestamp'') | int | timestamp_custom(''%H:%M'', False)) }}'
  condition:
  - condition: and
    conditions:
    - condition: state
      entity_id: group.device_tracker_us
      state: home
    - condition: state
      entity_id: input_boolean.alarm_clock_on
      state: 'on'
  action:
  - data:
      entity_id: script.1572118413981
    service: script.turn_on
  - data:
      entity_id: script.1572133152814
    service: script.turn_on

Here is what the script for turning on the light looks like in the gui. It starts off pretty dim and red, then tries to mimic a sunrise in 5 minutes. I would say i prefer waking up this way instead of to a playlist, maybe I’ll have a playlist kick on after the light wakes us up.

Home Assistant Alarm Clock

If you have telegram setup, you can also have it do telegram things like telling you if the alarm is off, or have it ask you if you would like to turn on the home assistant alarm clock Sunday night and off on Fridays after the week is over.

- id: '1573417282799'
  alias: Alarm Clock Status Change
  description: ''
  trigger:
  - entity_id: input_boolean.alarm_clock_on
    platform: state
  condition: []
  action:
    service: notify.group
    data_template:
      message: Alarm Clock is {{trigger.to_state.state}}