0.88.x Google home wakeup light

Hi all,

with the latest new component for google home i made a small (and most possibly ugly) automation to turn on my lights when an alarm rings at one of my google homes.

I guess some of you could use this too

A new sensor is needed to get the current time, therefore we need to add this to our sensors: config

sensors:
  - platform: time_date
    display_options:
      - 'date'
      - 'time_utc'

Now here comes the ugly part.
This is the needed automation

- alias: 'Alarm Clock Bedroom'
  trigger:
    platform: template
    value_template: >
            {%- if states.sensor.google_home_alarm.state.split('T')[0] == states.sensor.date.state and '{}:{}'.format(*states.sensor.google_home_alarm.state.split('T')[1].split('+')[0].split(':')[:-1]) == states.sensor.time_utc.state -%}True
            {%- else -%}
            False
            {%- endif -%}
  action:
    - service: light.turn_on
      entity_id: light.livingroom
      data_template:
        transition: 60
        brightness: 255

Unfortunately the next alarm time is reported as a string and the format differs from date_time sensor. So i had to split the string myself.

Known Limitations

  • Google home sets the alarm in HH:MM:SS, i only check for HH:MM, therefore the lights might turn on up to 59 seconds before the alarm rings
  • UTC Date borders are not respected.
    When i created this, i had 00:25 after midnight, i live in a UTC+1 timezone. Which means, the alarm date was yesterday instead of today.
  • Alarms do not trigger the automation when UTC Date differs from local Date
    I guess this is a bug in the sensor and therefore a bug report should be opened, but for today i need some sleep. Will open it later on if this is an issue for any of you

I hope you can use this automation and feel free to add any improvements. I would really appreciate when someone could improve this.

Thanks for the reminder. I didn’t realize the Google Home component could detect alarm and timers. Now I can flash the lights upstairs if a timer goes off on a device downstairs.