Skip to content

Instantly share code, notes, and snippets.

@ajtatum
Last active September 12, 2024 23:38
Show Gist options
  • Save ajtatum/032be02873d460a76c885f3b5c0f6425 to your computer and use it in GitHub Desktop.
Save ajtatum/032be02873d460a76c885f3b5c0f6425 to your computer and use it in GitHub Desktop.
Home Assistant Calendar Notification Minutes
action:
- variables:
time_left: >
{% set event_start = as_timestamp(trigger.calendar_event.start) %} {%
set time_diff = (event_start - as_timestamp(now())) / 60 %} {% if
time_diff > 59 %}
1 hour
{% elif 29 <= time_diff < 59 %}
30 minutes
{% elif 14 <= time_diff < 29 %}
15 minutes
{% elif 4 <= time_diff < 14 %}
5 minutes
{% else %}
0 minutes
{% endif %}
calendar_message: "Hey you've got {{ time_left }} until {{ trigger.calendar_event.summary }}."
- action: notify.alexa_media_alexa_zigee
metadata: {}
data:
message: "{{ calendar_message }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment