- Don’t divert a topic by changing it midstream.
https://community.home-assistant.io/guidelines
This is simple netiquette.
- Don’t divert a topic by changing it midstream.
https://community.home-assistant.io/guidelines
This is simple netiquette.
that didn’t trigger either… thanks anyway
I can’t reproduce your issue on my instance. I’m getting normal triggers with calendar events with a variety of accents and diacritics.
Run a test with the following so you can see exactly what the template is returning:
alias: Test Calendar with accents
description: ""
trigger:
- platform: calendar
event: start
offset: "0:0:0"
entity_id: calendar.rodina
condition: []
action:
- service: persistent_notification.create
data:
message: "{{ trigger.calendar_event.summary }}"
mode: single
When testing calendar event triggers make sure you follow the proper protocol so that the calendar is loaded before the trigger should fire. Calendars are normally only reloaded every 15 minutes, but they are also reloaded when an automation with a calendar trigger is reloaded. So you can either schedule your test event for more than 15 minutes in the future or reload your automation after the test event is created.
It’s probably the Google Calendar integration that updates seemingly whenever it damn chooses to. There are events I have deleted from it 20 minutes ago and it’s still not synced with HA.
Then again, even if I create the event inside HA and manually reloaded your test automation, it didn’t trigger anyway. Calendar entity is correct.
Manually triggering the automation reveals this in Traces:
Stopped because an error was encountered at 20. června 2023 v 22:13:40 (runtime: 0.02 seconds)
Error rendering data template: UndefinedError: 'dict object' has no attribute 'calendar_event'
Yeah, you cannot test automations that rely on calendar event triggers or other trigger variables using the “Run Automation” button or automation.trigger
service because those methods don’t create/populate the trigger
variable.
Okay the testing automation trigger fine, the event names are being passed correctly
What I ultimately want is a condition that would trigger with any variant such as “uklid”, “úklid” or “úklid #CLEANING LADY NAME#” so it’s actually helpful without requiring us to be super diligent with the event name.
Thanks for your help!
In that case you should combine the slugify
filter from my previous post with a search()
function… slugify
should strip the accents and and upper case letters making it so you only need a single search term to cover the variations.
alias: Calendar Uklid triggers Cleaning Mode
description: ""
trigger:
- platform: calendar
event: start
offset: "0:0:0"
entity_id: calendar.rodina
condition:
- condition: template
value_template: '{{ trigger.calendar_event.summary | slugify is search("uklid") }}'
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.cleaning_mode
mode: single
Perfect! Works and I can use this as a blueprint of sorts for other automations. Thank you
Is it possible to get this in Visual Editor ?
Yes, it’s just very annoying and inefficient to take and share 5 screen shots compared to using copy/paste once.
If you need one, there is a slightly dated but still informative video primer on translating between YAML and UI editor available on the ResinChem Tech Youtube channel.
Thanks. For the low-techie that I am, Yaml is frustrating. I’ll watch the video
Hey everyone,
I finally had the time to connect my iOS calendar to Home Assistant. I have a number of options and triggers for camera notification. One should be that I will get notified when there is someone at the entrance, when I am working from home. When stumbling across this post, I use the code as suggested in the solution, however the condition returns as false, even though the calendar name shows the entry.
This is the code
alias: Home Office
choose:
- conditions:
- condition: template
value_template: "{{ trigger.calendar_event.summary | slugify == 'Home Office' }}"
sequence:
- service: notify.mobile_app_oles_iphone
data:
data: {}
- service: tts.cloud_say
data:
cache: false
entity_id: media_player.sonos_one_sl
message: Jemand ist im Eingang gesehen worden.
options:
voice: KatjaNeural
The event Home Office is shown in the calendar.
I think I might need to specify the entity_id of the calendar, but I am unsure how to do this in a condition?
The filter slugify
will never return the string “Home Office”.
Hm, okay. How can I then check if the calendar shows Home Office as an event today?
If the summary of the event will always be exactly “Home Office” you can just remove the slugify
filter:
value_template: "{{ trigger.calendar_event.summary == 'Home Office' }}"
That’s what I have tried before, but the condition when being tested is still returning false.
I’ve also tried with eventS instead of event, no changes.
Post the entire configuration for the automation.
Quite a bulky one. It’s only about the alias: “Home Office”. The rest works fine.
alias: Benachrichtigung_Kameras
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.eingang_person_occupancy
to: "on"
id: Eingang
- platform: state
entity_id:
- binary_sensor.garten_person_occupancy
to: "on"
id: Garten_Person
enabled: true
- platform: state
entity_id:
- binary_sensor.garten_cat_occupancy
to: "on"
id: Garten_Katze
enabled: true
condition: []
action:
- alias: Eingang
if:
- condition: trigger
id:
- Eingang
then:
- service: camera.snapshot
data:
filename: /config/www/Eingang.jpg
target:
entity_id: camera.eingang
- alias: Malin
choose:
- conditions:
- condition: state
entity_id: person.malin
state: not_home
sequence:
- service: notify.mobile_app_malins_iphone
data:
data:
attachment:
url: /local/Eingang.jpg
message: Person erkannt
title: 📹 Eingang
- alias: Ole
choose:
- conditions:
- condition: state
entity_id: person.ole
state: not_home
sequence:
- service: notify.mobile_app_oles_iphone
data:
message: Person erkannt
title: 📹 Eingang
data:
attachment:
url: /local/Eingang.jpg
- alias: Nacht Wochentag
choose:
- conditions:
- condition: time
after: "22:00:00"
before: "06:00:00"
weekday:
- mon
- tue
- wed
- thu
- sun
- fri
sequence:
- service: notify.familie
data:
message: Person erkannt
title: 📹 Eingang
data:
attachment:
url: /local/Eingang.jpg
- alias: Nacht Wochenende
choose:
- conditions:
- condition: time
after: "23:30:00"
before: "08:00:00"
weekday:
- sat
sequence:
- service: notify.familie
data:
message: Person erkannt
title: 📹 Eingang
data:
attachment:
url: /local/Eingang.jpg
- alias: Home Office
choose:
- conditions:
- condition: template
value_template: "\"{{ trigger.calendar_events.summary == 'Home Office' }}\""
sequence:
- service: notify.mobile_app_oles_iphone
data:
data: {}
- service: tts.cloud_say
data:
cache: false
entity_id: media_player.sonos_one_sl
message: Jemand ist im Eingang gesehen worden.
options:
voice: KatjaNeural
- alias: Garten_Person
if:
- condition: trigger
id:
- Garten_Person
then:
- service: camera.snapshot
data:
filename: /config/www/Garten_Person.jpg
target:
entity_id: camera.garten
- alias: Malin
choose:
- conditions:
- condition: state
entity_id: person.malin
state: not_home
sequence:
- service: notify.mobile_app_malins_iphone
data:
data:
attachment:
url: /local/Garten_Person.jpg
message: Person erkannt
title: 📹 Garten
- alias: Ole
choose:
- conditions:
- condition: state
entity_id: person.ole
state: not_home
enabled: true
sequence:
- service: notify.mobile_app_oles_iphone
data:
message: Person erkannt
title: 📹 Garten
data:
attachment:
url: /local/Garten_Person.jpg
- alias: Nacht Wochentag
choose:
- conditions:
- condition: time
after: "22:00:00"
before: "06:00:00"
weekday:
- mon
- tue
- wed
- thu
- sun
sequence:
- service: notify.familie
data:
message: Person erkannt
title: 📹 Garten
data:
attachment:
url: /local/Garten_Person.jpg
- alias: Nacht Wochenende
choose:
- conditions:
- condition: time
after: "23:30:00"
before: "08:00:00"
weekday:
- fri
- sat
sequence:
- service: notify.familie
data:
message: Person erkannt
title: 📹 Garten
data:
attachment:
url: /local/Garten_Person.jpg
- alias: Garten_Katze
if:
- condition: trigger
id:
- Garten_Katze
then:
- service: camera.snapshot
data:
filename: /config/www/Garten_Katze.jpg
target:
entity_id: camera.garten
- alias: Malin
choose:
- conditions:
- condition: state
entity_id: person.malin
state: not_home
sequence:
- service: notify.mobile_app_malins_iphone
data:
data:
attachment:
url: /local/Garten_Katze.jpg
message: Katze erkannt
title: 📹 Garten
- alias: Ole
choose:
- conditions:
- condition: state
entity_id: person.ole
state: not_home
enabled: true
sequence:
- service: notify.mobile_app_oles_iphone
data:
message: Katze erkannt
title: 📹 Garte
data:
attachment:
url: /local/Garten_Katze.jpg
- alias: Nacht Wochentag
choose:
- conditions:
- condition: time
after: "22:00:00"
before: "06:00:00"
weekday:
- mon
- tue
- wed
- thu
- sun
sequence:
- service: notify.familie
data:
message: Katze erkannt
title: 📹 Garten
data:
attachment:
url: /local/Garten_Katze.jpg
- alias: Nacht Wochenende
choose:
- conditions:
- condition: time
after: "23:30:00"
before: "08:00:00"
weekday:
- fri
- sat
sequence:
- service: notify.familie
data:
message: Katze erkannt
title: 📹 Garten
data:
attachment:
url: /local/Garten_Katze.jpg
enabled: true
mode: single
This is why the Community Guidelines says to post the complete automation…
None of your triggers are Calendar Event triggers, so your trigger
variable will never contain the trigger.calendar_event.summary
property. You need to use the calendar.get_events
service call in your action block.
You might be able to just use a State condition that targets the calendar
entity, but that is only reliable if the target calendar never has concurrent/overlapping events.
Okay, so from what I understand:
Right?
If yes, how would I accomplish that? That goes far beyond what I did so far.