Last active
September 12, 2024 23:38
-
-
Save ajtatum/032be02873d460a76c885f3b5c0f6425 to your computer and use it in GitHub Desktop.
Home Assistant Calendar Notification Minutes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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