Bonjour,
j’utilise deux intégrations (méteofrance et accuweather)
depuis quelques mois je n’ai plus les attributs forecast dans le sensor weather et ca me genere un message d’erreur dans la log car j’ai un sensor template basé dessus :
2024-11-15 08:56:16.371 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ states.weather.maville_via_meteofrance.attributes.forecast[0].temperature|float(0)|round(2) }}) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 633, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2735, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 304, in getitem
return obj[argument]
~~~^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 750, in async_render_to_info
render_info._result = self.async_render( # noqa: SLF001
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 635, in async_render
raise TemplateError(err) from err
Pour autant vi j’affiche l’entité dans l’interface j’ai bien des prévisions météo.
mon sensor template est comme suit :
weather_temp_max:
friendly_name: Température max du jour
value_template: >-
{{ states.weather.maville_via_meteofrance.attributes.forecast[0].temperature|float(0)|round(2) }}
weather_temp_min:
friendly_name: Température min du jour
value_template: >-
{{ states.weather.maville_via_meteofrance.attributes.forecast[0].templow|float(0)|round(0) }}
Avez vous une idée de comment je peux recuperer les forecast ?
merci !