home-assistant / home-assistant.io

:blue_book: Home Assistant User documentation
https://www.home-assistant.io
Other
5.03k stars 7.31k forks source link

Error rendering data template: UndefinedError: None has no element 0 #32223

Open Zubredo opened 7 months ago

Zubredo commented 7 months ago

Feedback

The blueprint does not work anymore. It shows the following errors in the logs:

Error while executing automation automation.conversation_agent_agenda_notification: Error rendering data template: UndefinedError: None has no element 0

`Logger: homeassistant.helpers.template Quelle: helpers/template.py:2558 Erstmals aufgetreten: 07:00:00 (3 Vorkommnisse) Zuletzt protokolliert: 21:43:36

Template variable error: None has no element 0 when rendering 'Time: {{ now() }} {%- if zone_entity is defined %} Latitude: {{ state_attr(zone_entity, 'latitude') | round(1) }} Longitude: {{ state_attr(zone_entity, 'longitude') | round(1) }} {% endif %} {%- if weather_entity is defined %} {%- set forecast = state_attr(weather_entity, 'forecast')[0] %} {%- set temperature_unit = state_attr(weather_entity, 'temperature_unit') -%} Weather: {{ forecast.condition }} ({{ forecast.temperature }}{{ temperature_unit }}, {{ forecast.precipitation }}% precipitation) {%- endif %} Calendar "{{ state_attr(calendar_entity, 'friendly_name') }}" events for the next {{ calendar_duration.hours }}: {%- if agenda.events %} {%- for event in agenda.events %} - Summary: {{ event.summary }} Start-End: {% if event.start is defined %}{{ event.start }} to {{ event.end }}{% else %}All Day{% endif %} {%- if event.descripton is defined %} Descripton: {{ event.descripton }} {% endif -%} {%- if event.location is defined %} Location: {{ event.location }} {% endif -%} {%- endfor %} {%- else %} - No upcoming events. {%- endif %} {{ prompt }}'`

URL

https://www.home-assistant.io/voice_control/assist_daily_summary/

Version

2024.4.2

Additional information

No response

Mio3000 commented 7 months ago

same here, a lot of templates stopped working with similar error or with:

Error while processing template: Template<template=({% if states('sensor.plastics_days')|float > 1 %} none {% elif is_state("calendar.plastics", "on") %} red {% else %} yellow {% endif %}) renders=336>
Error while processing template: Template<template=({% if states('sensor.plastics_days')|float > 1 %} Next due date in: {{states('sensor.plastics_days')}} days {% elif is_state("calendar.plastics", "on") %} Due day is Today {% else %} Due day is Tomorrow {% endif %}) renders=336>
Je-sse commented 7 months ago

That probably has to do with this change:

319433911-312867d0-9f1f-4fea-b008-d3c07631289b

xlyralycanx commented 6 months ago

Progress is appreciated but this has indefinitely ended part of my setup, as service call responses are not visible on the dashboard. I used to use the data in attributes on a markdown card, have no fix. I just adapted an automation to the new system, so not a total loss