Skip to content

Instantly share code, notes, and snippets.

@Didgeridrew
Created August 5, 2023 15:29
Show Gist options
  • Select an option

  • Save Didgeridrew/b2797852f273defcaad780a925906948 to your computer and use it in GitHub Desktop.

Select an option

Save Didgeridrew/b2797852f273defcaad780a925906948 to your computer and use it in GitHub Desktop.
HA - Trigger based on Alexa alarm with offset
alias: Pre-Alexa alarm trigger template
description: ""
trigger:
- platform: template
value_template: >-
{% set alarm_time = states('sensor.amanda_s_living_room_dot_next_alarm') |
as_datetime %}
{% if alarm_time != None %}
{% set mins_before = 2 %}
{{ now() >= alarm_time - timedelta(minutes=mins_before) }}
{% else %} False {% endif %}
condition: []
action:
- service: light.turn_on
data: {}
target:
entity_id: light.behind_tv
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment