I had an automation that filled in the events for today in an input_text
entity so I could show the events inside a markdown in a readable fashion. This always worked, but somehow the events are now empty.
When I try this out in the devtool it is hard to capture the errors as you cannot both do get_events
, put it in a variable and run the set_value
service, but the problem seems to be inside the set_value
because that one gives errors in the devtools about the data…
the part that is run is the following:
- service: calendar.get_events
data:
duration:
hours: 13
minutes: 0
seconds: 0
response_variable: familiecal
target:
entity_id:
- calendar.home_assistant_all_day_excluded
- service: input_text.set_value
data_template:
value: >-
{% for event in familiecal.events %}<ha-icon
icon="mdi:calendar-heart-outline"></ha-icon> {{as_timestamp(event.start,
default=0) | timestamp_custom('%d/%m %H:%M') }} {{
event.summary}}{{'<br>'}} {% endfor %}
target:
entity_id: input_text.familielist
If I test the set_value
part in the devtools it results in the message that the syntax is wrong:
service: input_text.set_value
target:
entity_id:
- input_text.familielist
device_id: []
area_id: []
data_template:
value: >-
{% for event in familiecal.events %}
<ha-icon icon="mdi:calendar-heart-outline"></ha-icon>
{{as_timestamp(event.start, default=0) | timestamp_custom('%d/%m %H:%M') }}
{{event.summary}}{{'<br>'}}
{% endfor %}
Deze service vereist een veld value, die moet worden aangegeven onder data:
(Loosely translated to: This service requires a field value, this must be given under data:)
I think the problem resides inside the fact that I changed the list_events
to get_events
which supports multiple calendars and will always include the calendar listed inside the output. Can somebody point me to how I can change the set_value
to take this into account?
The output of get_events
:
calendar.home_assistant_all_day_excluded:
events:
- start: "2023-12-08T12:00:00+01:00"
end: "2023-12-08T18:00:00+01:00"
summary: Ziggo monteur komt langs
- start: "2023-12-08T16:30:00+01:00"
end: "2023-12-08T17:15:00+01:00"
summary: "Jaylah: zwemles bij Rudy 16:30-17:15"
location: Zwembad
vs the output of list_events
:
events:
- start: "2023-12-08T12:00:00+01:00"
end: "2023-12-08T18:00:00+01:00"
summary: Ziggo monteur komt langs
- start: "2023-12-08T16:30:00+01:00"
end: "2023-12-08T17:15:00+01:00"
summary: "Jaylah: zwemles bij Rudy 16:30-17:15"
location: Zwembad