HA sees my iCal iCloud calendars. I have a school year calendar which I would like to use to trigger events rather than work days since there are days/weeks/months where there is no work day. I’ve been reading all day and trying to get an event to fire when there is “work day” as an all day event in the calendar. The automation “trigger” only has a start/stop. How do I set “work days (or whatever) as the condition before firing actions? I tried the template condition {{ ‘workday’ in trigger.calendar_event.summary }} but that doesn’t work. I get an error “
In get this: UndefinedError: ‘trigger’ is undefined”
The trigger variable exists only if your automation was triggered by its Calendar Trigger. If you use another means to test it (the Run command or automation.trigger service call) the trigger variable will be undefined.
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic is resolved. This helps other users find answers to similar questions.
For more information about the Solution tag, refer to guideline 21 in the FAQ.
Tip:
It’s the post that answers/solves the question/problem that is marked with the Solution tag. You marked your own post but it doesn’t contain information that explains why your automation failed to trigger.
I think I was too eager and when I was originally testing, it was a workday and the notification said it was a workday. Poor troubleshooting on my part, I should have waited.
I don’t think it’s reading today’s calendar_event.summary.
Basically, I’m trying to do the same thing here as this thread. I have a separate calendar that my wife uses for school (teacher.) There are 4 kinds of “days” she works. When those days are not present in the calendar, she isn’t working. All the morning automations should be turned off or other “vacation” automations should fire.
Her work days are “Red Day”, “Blue Day”, “CCR Day”, and “Purple Day”. These are all day events in the calendar.
How do I best do this automation? I see the link below has a relatable situation but am not sure how to proceed.
alias: Work day
description: ""
trigger:
- platform: calendar
event: start
offset: "0:0:0"
entity_id: calendar.rhs_sy22_23
condition:
- condition: template
value_template: >
{% set days = ['Red Day', 'Blue Day', 'Purple Day', 'CCR Day'] %}
{{ days | select('in', trigger.calendar_event.summary) | list | count > 0 }}
action:
- service: notify.persistent_notification
data:
message: "It's a workday."
mode: single
Are the scheduled events All Day events? Or are they events with start and stop times?
If they are All Day events, the trigger occurs at midnight (start of the new day) so you can’t add a Time Condition restricting the time for ‘after 05:00’ because then you won’t get a notification.
No notification. I’m wondering if it’s because it’s an Apple Calendar and not a Google Calendar? Should that even matter? It’s an iCal format and HA sees it.