I want to trigger different events on if a list of events for the day contain certain strings. I have managed to use the calendar.get_events and filter to get a list of events for the day. So far I have not been able to come up with a conditional statement that will give me a true when checking for a string. When looking at the trace from the automation, I get to this and can’t ever get it to give me a result as true.
The automation has this code:
trigger:
- platform: time
at: "06:45:00"
condition: []
action:
- service: calendar.get_events
data:
duration:
hours: 72
minutes: 0
seconds: 0
response_variable: cal_events
target:
entity_id:
- calendar.fms_events_calendar
- if:
- condition: template
value_template: |-
false
{% for key, value in cal_events.items() %}
{% for event in value.events %}
{% if 'FMS' in states(event.summary) %}
true
{% endif %}
{% endfor %}
{% endfor %}
then: