Calendar (builtin) automation triggers but condition not working

I have the following test automation:

alias: Test - Kalender Automation
description: ""
trigger:
  - platform: calendar
    event: start
    offset: "0:0:0"
    entity_id: calendar.home
condition: []
action:
  - service: notify.pushover
    data:
      message: "{{ trigger.calendar_event.summary }}"
mode: single

My intention is to act on a triggered event if it has a word in the summary.

Problem:
The automation is triggered ( I see the blue banner on trigger while watching the condition when the event comes) but the action is never executed.
IF the text in the notification has no template “test notification” I get the notification.
But if it has something as simple as “{{ trigger.calendar_event.summary }}” it is not send.

It should send a notification with the summary of the event.
I would then put “{{ trigger.calendar_event.summary is search(‘test’) }}” in a condition. Which doesn’t work as the condition is false.

Somehow the templates are not working.

Anybody? Is this supposed to work or am I doing it wrong.
I don’t think so as I’ve copied this from various forum posts. So I guess here is a bug somewhere.

Post the trace from the automation.

Are you testing the automation by waiting until a scheduled event in calendar.home starts?

That’s the only way to test this automation because its template references the trigger object which only exists when the Calendar Trigger is triggered by an event (not by any other means like using the Run command).

Correct, that’s exactly what I’m doing. And it is being triggered as the trigger can be seen getting the blue “trigger” band.
But the action isn’t working as I explained. Only normal text in a message is sent. When there is the template (as test to see what is passed from the trigger) or I try to use it in a condition the message is not sent.

Traces shows “no traces found”

That implies the automation was not triggered.

The presence, or absence, of traces is the authoritative record of an automation’s triggering activity.

Why does the blue banner say triggered, exactly at the time it should be??
Doesn’t seem right.
BTW I have copied this example exactly as described on numerous posts/videos and it is shown there exactly as it happens here: time comes blue banner shows and action is taken.

As I have said the problem is ONLY when i try to have a conditon referencing details of the trigger object OR if the same is in the notification. If the notification has only a text (such as “automation triggered”) the notification IS send.

So what you say is not true in this case.

  1. When you create an automation with the Automation Editor, it automatically assigns it an id property with a unique value. The Automation Editor doesn’t display id in visual mode or even in YAML mode but it’s present if one examines the contents of the automations.yaml file. For an automation with an id, Home Assistant will record a trace whenever it’s triggered.

  2. When you create an automation with a text editor, it won’t automatically assigns it an id property; you have to manually include it and assign it a unique value. If you don’t do that, Home Assistant will not produce a trace whenever the automation is triggered.

Automations created in YAML must have an id assigned in order for debugging traces to be stored.

Reference

Troubleshooting automations

If you created that automation using the Automation Editor, it was assigned an id and traces will be recorded whenever it triggers.

However, if an automation with an id is executed by any method other than by one of its own triggers (such as by using the Run command or the automation.trigger service call) the trigger variable will be undefined. Any reference within the automation to the undefined trigger variable will fail (and report an error in the Log).

I created it with the GUI…

Anyway as this isn’t working (as it should and actually I got one notification on try and on the next again none, it’s at least not reliable) I’ve deleted the calendar integration and stopped using it shelving the automations I had in mind…

Thx for all the replies.

Then the automation will have an automatically assigned id and traces will be generated when the automation is triggered. No traces means no triggering. This is true for almost any kind of trigger, not just the Calendar Trigger.

I and many others use the Calendar Trigger and it works as documented. There are numerous examples of its successful use throughout the forum. No one else has reported the problem you have described so it’s unclear why it’s happening exclusively for you.

It’s definitely weird. But it’s not working as intended:
I even tried this Blueprint: 📆 Calendar Notifications & Actions
Doesn’t work also…

It’s a standard HAOS install. Notjing fancy or extra.

Are you using a Local Calendar, Google Calendar, or something else?

Your topic title days “built-in” so that may mean the Local Calendar integration but I thought I would confirm it with you to be sure.

did you see this?

The discussion in that Issue ends with bobvandevijver saying he would create a PR.

I found the PR and it’s for the TwenteMilieu integration but it was never merged into a release version of Home Assistant.

However it started a discussion about improving the validation of scheduled calendar events. In other words, things like ensuring an event’s end time isn’t before its start time.

Yes, local calendar. But I also tried icloud one with same result.

In the meantime and since last post I’ve tried the following:
setup a fresh proxmox HA VM. Imported last backup. Install local calendar, installed above blueprint and did a test. received a message one time but not again in new tests. Same same.

Don’t forget that calendar events are detected periodically. During your tests, if you create an event that is scheduled within the next 15 minutes, odds are that it won’t be detected.

OK. Will try again with ones further apart.

That was the missing link! I had the tests scheduled within 5-10min. Testing with min 15min and all works.
Thx for sticking with this!

1 Like

You’re welcome!

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 has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.