Trigger Automations When a Specific Echo Device's Alarm Goes Off

You no longer need to do a timestamp conversion, you can use timedelta instead:

alias: alexa alarm
description: test
trigger:
  - platform: template
    value_template: >
      {% set alarm_time = states('sensor.echo_dot_next_alarm') | as_datetime %}
      {{ now() >= alarm_time - timedelta(seconds = 2) }}
action:
  - service: notify.alexa_media_echo_dot
    data:
      message: alarm will trigger soon
      data:
        type: tts
mode: single
2 Likes