Hello, I am testing with the local calendar feature. I created an event with a duration of “all day”. I also associated an automation that monitors the occurrence of this event. As a result, at 12:00:00 AM today, I observed 2 behaviors. The first at 12:00:00 AM and the second at 12:00:13 AM
data:
title: [Extérieur] Exécution réalisée Off_cd_matin_exterieur
message: |
Nouvel événement du calendrier :
Titre : {{ trigger.to_state.attributes.message }}
Description : {{ trigger.to_state.attributes.description }}
Début : {{ trigger.to_state.attributes.start_time }}
Fin : {{ trigger.to_state.attributes.end_time }}
{% if ‘Vacances’ in trigger.to_state.attributes.description %}
Le mot ‘Vacances’ est présent dans la description.
{% else %}
Le mot ‘Vacances’ n’est pas présent dans la description.
{% endif %}
data:
persistent: true
sticky: true
vibrationPattern: 100, 1000, 100, 1000
ttl: 0
priority: high
color: “#2DF56D”
clickAction: lovelace-accuweather/exterieur-
action: notify.mobile_app_sm_s928w
The “trigger…” variables were not recognized.
At 12:00:13 AM, the “trigger”:
trigger: state
entity_id:
calendar.vacances
from: “off”
to: “on”
enabled: true
and I got an execution as expected for the notify.
What I’m trying to understand is why the automation was requested at 12:00:00 AM and again at 12:00:13 AM for the same calendar entry.
data:
title: ⚠️ [Extérieur] Exécution réalisée Off_cd_matin_exterieur
message: |
Nouvel événement du calendrier :
Titre : {{ trigger.to_state.attributes.message }}
Description : {{ trigger.to_state.attributes.description }}
Début : {{ trigger.to_state.attributes.start_time }}
Fin : {{ trigger.to_state.attributes.end_time }}
{% if 'Vacances' in trigger.to_state.attributes.description %}
Le mot 'Vacances' est présent dans la description.
{% else %}
Le mot 'Vacances' n'est pas présent dans la description.
{% endif %}
data:
persistent: true
sticky: true
vibrationPattern: 100, 1000, 100, 1000
ttl: 0
priority: high
color: "#2DF56D"
clickAction: lovelace-accuweather/exterieur-
action: notify.mobile_app_sm_s928w
Your automation monitors calendar.vacances using a Calendar Trigger and a State Trigger. Why?
I recommend you remove the State Trigger.
The templates in your action refer to various properties of the trigger variable, like message in trigger.to_state.attributes.message, that do not exist when the State Trigger is triggered (or even the Calendar Trigger). That explains why you got an error message when the State Trigger was triggered.
data:
title: ⚠️ [Extérieur] Exécution réalisée Off_cd_matin_exterieur
message: |
Nouvel événement du calendrier :
Titre : {{ trigger.calendar_event.summary }}
Description : {{ trigger.calendar_event.description }}
Début : {{ trigger.calendar_event.start }}
Fin : {{ trigger.calendar_event.end }}
{% if 'Vacances' in trigger.calendar_event.description %}
Le mot 'Vacances' est présent dans la description.
{% else %}
Le mot 'Vacances' n'est pas présent dans la description.
{% endif %}
data:
persistent: true
sticky: true
vibrationPattern: 100, 1000, 100, 1000
ttl: 0
priority: high
color: "#2DF56D"
clickAction: lovelace-accuweather/exterieur-
action: notify.mobile_app_sm_s928w
Note that calendars are read once every 15 minutes. When testing, make sure you do not plan events less than 15 minutes away from the current time, or your trigger might not fire.
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.