Open stovedoctor opened 1 month ago
Hey there @home-assistant/core, mind taking a look at this feedback as it has been labeled with an integration (calendar
) you are listed as a code owner for? Thanks!
It's a two part example. One to fetch calender events, and another to send a notification of those events.
You would need this code snippet from further up on the page:
action: calendar.get_events
target:
entity_id:
- calendar.school
- calendar.work
data:
duration:
hours: 24
response_variable: agenda
Which fetches 24 hours of calendar events and stores them in agenda
After that action you could then use the newly created agenda
variable to send the notification:
action: notify.nina
data:
title: Daily agenda for {{ now().date() }}
message: >-
Your school calendar for today:
{% for event in agenda["calendar.school_calendar"]["events"] %}
{{ event.start}}: {{ event.summary }}<br>
{% endfor %}
Your work calendar for today:
{% for event in agenda["calendar.work_calendar"]["events"] %}
{{ event.start}}: {{ event.summary }}<br>
{% endfor %}
Created an example automation via the UI to demonstrate.
Trigger is every morning at 7am:
It will use get_events to pull all calendar events for the next 24 hours and send a notification to my phone:
Example of the notification:
Thank you
Feedback
Can someone please explain a little? what is "for event in agenda" in the template ?