Open derjoerg opened 6 months ago
2024-01-02 14:33:08.032 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{"more details on neg_zam forecast", states.sensor.local_forecast.attributes.forecast_neg_zam[1]|int(0)+1}}) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 569, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2247, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1943, in forgiving_int_filter
result = jinja2.filters.do_int(value, default=default, base=base)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/jinja2/filters.py", line 957, in do_int
return int(value)
^^^^^^^^^^
jinja2.exceptions.UndefinedError: None has no element 1
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 695, in async_render_to_info
render_info._result = self.async_render(
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 571, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: None has no element 1
2024-01-02 14:33:08.034 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({% set z = states.sensor.local_forecast.attributes.forecast_neg_zam[1]|int(0)+1%} {# translate zambretti number to forecast icons: [next 6 h, next 12 h]#} {%if z == 1%}{%set forecast = [0,0]%} {%elif z == 2%}{%set forecast = [1,1]%} {%elif z == 3%}{%set forecast = [2,1]%} {%elif z == 4%}{%set forecast = [1,2]%} {%elif z == 5%}{%set forecast = [2,2]%} {%elif z == 6%}{%set forecast = [2,1]%} {%elif z == 7%}{%set forecast = [2,1]%} {%elif z == 8%}{%set forecast = [1,4]%} {%elif z == 9%}{%set forecast = [4,2]%} {%elif z == 10%}{%set forecast = [4,4]%} {%elif z == 11%}{%set forecast = [2,2]%} {%elif z == 12%}{%set forecast = [3,1]%} {%elif z == 13%}{%set forecast = [3,3]%} {%elif z == 14%}{%set forecast = [2,2]%} {%elif z == 15%}{%set forecast = [4,5]%} {%elif z == 16%}{%set forecast = [4,4]%} {%elif z == 17%}{%set forecast = [2,2]%} {%elif z == 18%}{%set forecast = [2,4]%} {%elif z == 19%}{%set forecast = [2,2]%} {%elif z == 20%}{%set forecast = [5,5]%} {%elif z == 21%}{%set forecast = [2,4]%} {%elif z == 22%}{%set forecast = [4,4]%} {%elif z == 23%}{%set forecast = [4,4]%} {%elif z == 24%}{%set forecast = [6,4]%} {%elif z == 25%}{%set forecast = [6,6]%} {%endif%} {{forecast}}) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 569, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2247, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1943, in forgiving_int_filter
result = jinja2.filters.do_int(value, default=default, base=base)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/jinja2/filters.py", line 957, in do_int
return int(value)
^^^^^^^^^^
jinja2.exceptions.UndefinedError: None has no element 1
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 695, in async_render_to_info
render_info._result = self.async_render(
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 571, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: None has no element 1
2024-01-02 14:33:08.035 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({# give approx. values for rain probability #} {%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%if forecast[0]<2 and forecast[1]<2 %}{%set rain_prob = [0,0]%} {%elif forecast[0]==1 and forecast[1]>=2 %}{%set rain_prob = [20,60]%} {%elif forecast[0]==2 and forecast[1]==2 %}{%set rain_prob = [50,50]%} {%elif forecast[0]==2 and forecast[1]>2 %}{%set rain_prob = [50,70]%} {%else%}{%set rain_prob = [90,90]%}{%endif%} {{rain_prob}}) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 569, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2247, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/usr/local/lib/python3.11/site-packages/jinja2/sandbox.py", line 303, 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 695, in async_render_to_info
render_info._result = self.async_render(
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 571, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast'
2024-01-02 14:33:08.037 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%set conditions = [('mdi:weather-sunny','mdi:weather-night'),('mdi:weather-partly-cloudy', 'mdi:weather-night-partly-cloudy'),('mdi:weather-partly-rainy','mdi:weather-partly-rainy'),('mdi:weather-cloudy','mdi:weather-cloudy'),('mdi:weather-rainy','mdi:weather-rainy'),('mdi:weather-pouring','mdi:weather-pouring'),('mdi:weather-lightning-rainy','mdi:weather-lightning-rainy')]%} {# [State][day/night], available states: sunny (0), partlycloudy(1), partlycloudyrain(2), cloudy(3), rainy(4), pouring(5), lightning-rainy(6) #} {%if is_state('sun.sun', 'below_horizon')==true%}{%set daynight=1%}{%else%}{%set daynight=0%}{%endif%} {%set now = conditions[forecast[0]|int(0)][daynight|int(0)]%} {%set later = conditions[forecast[1]|int(0)][daynight|int(0)]%} {{(now,later)}}) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 569, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2247, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/usr/local/lib/python3.11/site-packages/jinja2/sandbox.py", line 303, 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 695, in async_render_to_info
render_info._result = self.async_render(
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 571, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast'
2024-01-02 14:33:08.041 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: None has no element 1') while processing template 'Template<template=({{"more details on neg_zam forecast", states.sensor.local_forecast.attributes.forecast_neg_zam[1]|int(0)+1}}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.local_forecast_neg_zam_detail'
2024-01-02 14:33:08.041 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: None has no element 1') while processing template 'Template<template=({% set z = states.sensor.local_forecast.attributes.forecast_neg_zam[1]|int(0)+1%} {# translate zambretti number to forecast icons: [next 6 h, next 12 h]#} {%if z == 1%}{%set forecast = [0,0]%} {%elif z == 2%}{%set forecast = [1,1]%} {%elif z == 3%}{%set forecast = [2,1]%} {%elif z == 4%}{%set forecast = [1,2]%} {%elif z == 5%}{%set forecast = [2,2]%} {%elif z == 6%}{%set forecast = [2,1]%} {%elif z == 7%}{%set forecast = [2,1]%} {%elif z == 8%}{%set forecast = [1,4]%} {%elif z == 9%}{%set forecast = [4,2]%} {%elif z == 10%}{%set forecast = [4,4]%} {%elif z == 11%}{%set forecast = [2,2]%} {%elif z == 12%}{%set forecast = [3,1]%} {%elif z == 13%}{%set forecast = [3,3]%} {%elif z == 14%}{%set forecast = [2,2]%} {%elif z == 15%}{%set forecast = [4,5]%} {%elif z == 16%}{%set forecast = [4,4]%} {%elif z == 17%}{%set forecast = [2,2]%} {%elif z == 18%}{%set forecast = [2,4]%} {%elif z == 19%}{%set forecast = [2,2]%} {%elif z == 20%}{%set forecast = [5,5]%} {%elif z == 21%}{%set forecast = [2,4]%} {%elif z == 22%}{%set forecast = [4,4]%} {%elif z == 23%}{%set forecast = [4,4]%} {%elif z == 24%}{%set forecast = [6,4]%} {%elif z == 25%}{%set forecast = [6,6]%} {%endif%} {{forecast}}) renders=4>' for attribute 'forecast' in entity 'sensor.local_forecast_neg_zam_detail'
2024-01-02 14:33:08.042 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast'') while processing template 'Template<template=({# give approx. values for rain probability #} {%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%if forecast[0]<2 and forecast[1]<2 %}{%set rain_prob = [0,0]%} {%elif forecast[0]==1 and forecast[1]>=2 %}{%set rain_prob = [20,60]%} {%elif forecast[0]==2 and forecast[1]==2 %}{%set rain_prob = [50,50]%} {%elif forecast[0]==2 and forecast[1]>2 %}{%set rain_prob = [50,70]%} {%else%}{%set rain_prob = [90,90]%}{%endif%} {{rain_prob}}) renders=4>' for attribute 'rain_prob' in entity 'sensor.local_forecast_neg_zam_detail'
2024-01-02 14:33:08.042 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast'') while processing template 'Template<template=({%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%set conditions = [('mdi:weather-sunny','mdi:weather-night'),('mdi:weather-partly-cloudy', 'mdi:weather-night-partly-cloudy'),('mdi:weather-partly-rainy','mdi:weather-partly-rainy'),('mdi:weather-cloudy','mdi:weather-cloudy'),('mdi:weather-rainy','mdi:weather-rainy'),('mdi:weather-pouring','mdi:weather-pouring'),('mdi:weather-lightning-rainy','mdi:weather-lightning-rainy')]%} {# [State][day/night], available states: sunny (0), partlycloudy(1), partlycloudyrain(2), cloudy(3), rainy(4), pouring(5), lightning-rainy(6) #} {%if is_state('sun.sun', 'below_horizon')==true%}{%set daynight=1%}{%else%}{%set daynight=0%}{%endif%} {%set now = conditions[forecast[0]|int(0)][daynight|int(0)]%} {%set later = conditions[forecast[1]|int(0)][daynight|int(0)]%} {{(now,later)}}) renders=4>' for attribute 'icons' in entity 'sensor.local_forecast_neg_zam_detail'
2024-01-02 14:33:08.042 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback _async_at_core_state.<locals>._matched_event(<Event homeassistant_start[L]>) at /usr/src/homeassistant/homeassistant/helpers/start.py:37
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 616, in state
numerical_value = int(value)
^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'unknown'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 619, in state
numerical_value = float(value)
^^^^^^^^^^^^
ValueError: could not convert string to float: 'unknown'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/core.py", line 1236, in _onetime_listener
self._hass.async_run_job(listener, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 719, in async_run_job
return self.async_run_hass_job(HassJob(target), *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 671, in async_run_hass_job
hassjob.target(*args)
File "/usr/src/homeassistant/homeassistant/helpers/start.py", line 40, in _matched_event
hass.async_run_hass_job(at_start_job, hass)
File "/usr/src/homeassistant/homeassistant/core.py", line 671, in async_run_hass_job
hassjob.target(*args)
File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 478, in _async_template_startup
result_info.async_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1035, in async_refresh
self._refresh(None)
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1215, in _refresh
self.hass.async_run_hass_job(self._job, event, updates)
File "/usr/src/homeassistant/homeassistant/core.py", line 671, in async_run_hass_job
hassjob.target(*args)
File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 429, in _handle_results
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 745, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 845, in _async_write_ha_state
state, attr = self._async_generate_attributes()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 786, in _async_generate_attributes
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 751, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 623, in state
raise ValueError(
ValueError: Sensor sensor.local_forecast_pressure has device class 'None', state class 'None' unit 'hpa' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unknown' (<class 'str'>)
2024-01-02 14:33:08.065 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'forecast' is undefined when rendering '{% set z = states.sensor.local_forecast.attributes.forecast_neg_zam[1]|int(0)+1%} {# translate zambretti number to forecast icons: [next 6 h, next 12 h]#} {%if z == 1%}{%set forecast = [0,0]%} {%elif z == 2%}{%set forecast = [1,1]%} {%elif z == 3%}{%set forecast = [2,1]%} {%elif z == 4%}{%set forecast = [1,2]%} {%elif z == 5%}{%set forecast = [2,2]%} {%elif z == 6%}{%set forecast = [2,1]%} {%elif z == 7%}{%set forecast = [2,1]%} {%elif z == 8%}{%set forecast = [1,4]%} {%elif z == 9%}{%set forecast = [4,2]%} {%elif z == 10%}{%set forecast = [4,4]%} {%elif z == 11%}{%set forecast = [2,2]%} {%elif z == 12%}{%set forecast = [3,1]%} {%elif z == 13%}{%set forecast = [3,3]%} {%elif z == 14%}{%set forecast = [2,2]%} {%elif z == 15%}{%set forecast = [4,5]%} {%elif z == 16%}{%set forecast = [4,4]%} {%elif z == 17%}{%set forecast = [2,2]%} {%elif z == 18%}{%set forecast = [2,4]%} {%elif z == 19%}{%set forecast = [2,2]%} {%elif z == 20%}{%set forecast = [5,5]%} {%elif z == 21%}{%set forecast = [2,4]%} {%elif z == 22%}{%set forecast = [4,4]%} {%elif z == 23%}{%set forecast = [4,4]%} {%elif z == 24%}{%set forecast = [6,4]%} {%elif z == 25%}{%set forecast = [6,6]%} {%endif%} {{forecast}}'
2024-01-02 14:33:08.097 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'forecast' is undefined when rendering '{% set z = states.sensor.local_forecast.attributes.forecast_neg_zam[1]|int(0)+1%} {# translate zambretti number to forecast icons: [next 6 h, next 12 h]#} {%if z == 1%}{%set forecast = [0,0]%} {%elif z == 2%}{%set forecast = [1,1]%} {%elif z == 3%}{%set forecast = [2,1]%} {%elif z == 4%}{%set forecast = [1,2]%} {%elif z == 5%}{%set forecast = [2,2]%} {%elif z == 6%}{%set forecast = [2,1]%} {%elif z == 7%}{%set forecast = [2,1]%} {%elif z == 8%}{%set forecast = [1,4]%} {%elif z == 9%}{%set forecast = [4,2]%} {%elif z == 10%}{%set forecast = [4,4]%} {%elif z == 11%}{%set forecast = [2,2]%} {%elif z == 12%}{%set forecast = [3,1]%} {%elif z == 13%}{%set forecast = [3,3]%} {%elif z == 14%}{%set forecast = [2,2]%} {%elif z == 15%}{%set forecast = [4,5]%} {%elif z == 16%}{%set forecast = [4,4]%} {%elif z == 17%}{%set forecast = [2,2]%} {%elif z == 18%}{%set forecast = [2,4]%} {%elif z == 19%}{%set forecast = [2,2]%} {%elif z == 20%}{%set forecast = [5,5]%} {%elif z == 21%}{%set forecast = [2,4]%} {%elif z == 22%}{%set forecast = [4,4]%} {%elif z == 23%}{%set forecast = [4,4]%} {%elif z == 24%}{%set forecast = [6,4]%} {%elif z == 25%}{%set forecast = [6,6]%} {%endif%} {{forecast}}'
I'm also having similar errors thrown in the Home Assistant log, such as the following:
Logger: homeassistant.helpers.event
Source: helpers/template.py:575
First occurred: 8:28:21 PM (26 occurrences)
Last logged: 8:40:17 PM
Error while processing template: Template<template=({% set z = states.sensor.local_forecast.attributes.forecast_neg_zam[1]|int(0)+1%} {# translate zambretti number to forecast icons: [next 6 h, next 12 h]#} {%if z == 1%}{%set forecast = [0,0]%} {%elif z == 2%}{%set forecast = [1,1]%} {%elif z == 3%}{%set forecast = [2,1]%} {%elif z == 4%}{%set forecast = [1,2]%} {%elif z == 5%}{%set forecast = [2,2]%} {%elif z == 6%}{%set forecast = [2,1]%} {%elif z == 7%}{%set forecast = [2,1]%} {%elif z == 8%}{%set forecast = [1,4]%} {%elif z == 9%}{%set forecast = [4,2]%} {%elif z == 10%}{%set forecast = [4,4]%} {%elif z == 11%}{%set forecast = [2,2]%} {%elif z == 12%}{%set forecast = [3,1]%} {%elif z == 13%}{%set forecast = [3,3]%} {%elif z == 14%}{%set forecast = [2,2]%} {%elif z == 15%}{%set forecast = [4,5]%} {%elif z == 16%}{%set forecast = [4,4]%} {%elif z == 17%}{%set forecast = [2,2]%} {%elif z == 18%}{%set forecast = [2,4]%} {%elif z == 19%}{%set forecast = [2,2]%} {%elif z == 20%}{%set forecast = [5,5]%} {%elif z == 21%}{%set forecast = [2,4]%} {%elif z == 22%}{%set forecast = [4,4]%} {%elif z == 23%}{%set forecast = [4,4]%} {%elif z == 24%}{%set forecast = [6,4]%} {%elif z == 25%}{%set forecast = [6,6]%} {%endif%} {{forecast}}) renders=2>
Error while processing template: Template<template=({# give approx. values for rain probability #} {%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%if forecast[0]<2 and forecast[1]<2 %}{%set rain_prob = [0,0]%} {%elif forecast[0]==1 and forecast[1]>=2 %}{%set rain_prob = [20,60]%} {%elif forecast[0]==2 and forecast[1]==2 %}{%set rain_prob = [50,50]%} {%elif forecast[0]==2 and forecast[1]>2 %}{%set rain_prob = [50,70]%} {%else%}{%set rain_prob = [90,90]%}{%endif%} {{rain_prob}}) renders=2>
Error while processing template: Template<template=({%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%set conditions = [('mdi:weather-sunny','mdi:weather-night'),('mdi:weather-partly-cloudy', 'mdi:weather-night-partly-cloudy'),('mdi:weather-partly-rainy','mdi:weather-partly-rainy'),('mdi:weather-cloudy','mdi:weather-cloudy'),('mdi:weather-rainy','mdi:weather-rainy'),('mdi:weather-pouring','mdi:weather-pouring'),('mdi:weather-lightning-rainy','mdi:weather-lightning-rainy')]%} {# [State][day/night], available states: sunny (0), partlycloudy(1), partlycloudyrain(2), cloudy(3), rainy(4), pouring(5), lightning-rainy(6) #} {%if is_state('sun.sun', 'below_horizon')==true%}{%set daynight=1%}{%else%}{%set daynight=0%}{%endif%} {%set now = conditions[forecast[0]|int(0)][daynight|int(0)]%} {%set later = conditions[forecast[1]|int(0)][daynight|int(0)]%} {{(now,later)}}) renders=2>
Error while processing template: Template<template=({# figure out if forecast is olf if yes add 6h -> next intervall #} {%set halftime = 6*60-(as_timestamp(now()) - as_timestamp(states.sensor.local_forecast_neg_zam_detail.last_changed))/60%} {%if halftime<0%}{%set correction = 6+((halftime/60)|float(0))%}{%else%}{%set correction = 0%}{%endif%} {%set time_offset_first = 3+correction%}{#time from last forecast update to the first forecast state #} {%set time_to = time_offset_first*60-(as_timestamp(now()) - as_timestamp(states.sensor.local_forecast_neg_zam_detail.last_changed))/60%} {{[(as_timestamp(now())+time_to*60)| timestamp_custom('%H:%M'), time_to|round(2)]}}{# [time of first state, minutes to first state] #}) renders=2>
Error while processing template: Template<template=({# figure out if forecast is olf if yes add 6h -> next intervall #} {%set halftime = 6*60-(as_timestamp(now()) - as_timestamp(states.sensor.local_forecast_neg_zam_detail.last_changed))/60%} {%if halftime<0%}{%set correction = 6+((halftime/60)|float(0))%}{%else%}{%set correction = 0%}{%endif%} {%set time_offset_second = 9+correction%}{#time from last forecast update to the first forecast state #} {%set time_to = time_offset_second*60-(as_timestamp(now()) - as_timestamp(states.sensor.local_forecast_neg_zam_detail.last_changed))/60%} {{[(as_timestamp(now())+time_to*60)| timestamp_custom('%H:%M'), time_to|round(2)]}}{# [time of first state, minutes to first state] #}) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 573, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2364, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
jinja2.exceptions.UndefinedError: None has no element 0
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 699, in async_render_to_info
render_info._result = self.async_render(
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 575, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: None has no element 0
The card on my dashboard also looks like this:
The only thing that updates is the pressure forecast, and only very erratically.
I'm assuming this is being caused by the sensor.local_forecast_zambretti_detail entity never being populated (it's always in an unknown state). I poked at the weather_forecast.yaml to see what would cause that, but I don't know enough about jinja to fully comprehend it, and there are no associated errors in the log to go off of, beside what the lovelace card generates. I've removed my wind speed and direction sensors (and set them to 0), but that made no difference; as of right now I only have sensors for pressure in hPa, temperature in °C, and humidity entered.
This is happening with Home Assistant Core 2024.4.0.dev, but I'm assuming the issue goes back to ~2024.1.x given when this issue was first filed.
Edit I realized Home Assistant had actually made a mistake at some point in the past, and had added my pressure sensor entity, which is in pascals, set as hectopascals without doing any conversion. I removed the entity and re-added it with pascals as the unit of measurement, and now it's correctly being converted from Pa -> hPa.
I then removed the weather_forecast.yaml, ran a database purge to clear out the entities, and restarted Home Assistant. After re-adding the weather_forecast.yaml, the forecast card now shows 'Stormy'. I'll leave it running overnight to see if it's working properly now.
I'm fairly sure at this point that these errors are caused by sensor values that screw with the math in the forecast. It was still broken this morning but after making sure the Home Assistant is giving values like 1008.00hPa instead of 1008.0000hPa for the pressure sensor (by setting suggested_display_precision: 0), the forecast seems to actually be working. sensor.local_forecast_zambretti_detail is still unknown, so I'll check back in 6-12 hours to see if that changes
Also, very relatedly, it may be worth explicitly documenting what this integration needs for sensor values/units of measurement/precision requirements to prevent easily fixed errors like this.
Edit:
Looks like it's working fine now ¯\ (ツ)/¯:
Hi, I think I have the same problem as you, did you set the pressure with a value without a decimal point? And the suit temperature sensor? A number only after the decimal point? Thank you
yes, for pressure it's xxxx.xxhPa (two decimal points; in my case, w/ suggested_display_precision set to 0), and temperature it's xx.x°C (one decimal point, which I think is the default w/ temperature entities in HA). as I noted above, my pressure sensor is in raw pascals, but Home Assistant automatically converted it to hectopascals with unit_of_measurement set to 'Pa', and device_class set to 'atmospheric_pressure'.
another important thing I found, to prevent Home Assistant trying to do math with empty strings, is to make sure your sensors have availability_template set to something like:
availability_template: "{{ states('sensor.outdoor_temperature') | is_number }}"
this also goes for the forecast temperature/pressure sensor entities, and subsequently the temp/pressure change statistics entities. the latter is easy to work around, but the former is not, due to how Home Assistant's statistics integration 'works'.
in regard to that last point, I've been working on some fixes to the weather_forecast.yaml integration that might help alleviate the garbage forecast data and logspam within <3hr of the integration starting up. if I can get something I'm happy with, I'll open up a PR with those changes (and some others I've made).
Thanks for working out the bugs. With the latest updates the integration broke a bit. I am happy to test out and integrate the PR but sadly I dont have much time at the moment to fix it myself :)
Thank you francistheodorecatte for your information. In fact, I noticed that my simple aqara sensor shows the pressure in hpa, so I think it's the right way. The sensor has two decimal points after the decimal point.
This is how I set up my sensor. Despite this approach, however, it seems that the forecast is wrong. Now you tell me that the weather is rainy and that rain is forecast, when in fact it is clear and we are in a moment of high pressure... So I think I did something wrong.
Now I'll try to install the package with the updates and see what happens..
UPDATE: I waited for 3/4 hours and now it seems to be better
Although there are still many errors in the log:
Registratore: homeassistant.helpers.event Fonte: helpers/template.py:575 Prima occorrenza: 15:14:18 (54 occorrenze) Ultima registrazione: 15:14:30
Error while processing template: Template<template=({%set forecast = states.sensor.local_forecast_zambretti_detail.attributes.forecast%} {%set conditions = [('mdi:weather-sunny','mdi:weather-night'),('mdi:weather-partly-cloudy', 'mdi:weather-night-partly-cloudy'),('mdi:weather-partly-rainy','mdi:weather-partly-rainy'),('mdi:weather-cloudy','mdi:weather-cloudy'),('mdi:weather-rainy','mdi:weather-rainy'),('mdi:weather-pouring','mdi:weather-pouring'),('mdi:weather-lightning-rainy','mdi:weather-lightning-rainy')]%} {# [State][day/night], available states: sunny (0), partlycloudy(1), partlycloudyrain(2), cloudy(3), rainy(4), pouring(5), lightning-rainy(6) #} {%if is_state('sun.sun', 'below_horizon')==true%}{%set daynight=1%}{%else%}{%set daynight=0%}{%endif%} {%set now = conditions[forecast[0]|int(0)][daynight|int(0)]%} {%set later = conditions[forecast[1]|int(0)][daynight|int(0)]%} {{(now,later)}}) renders=2>
Error while processing template: Template<template=({{"More details on neg_zam forecast", states.sensor.local_forecast.attributes.forecast_neg_zam[1]|int(0)+1}}) renders=2>
Error while processing template: Template<template=({% set z = states.sensor.local_forecast.attributes.forecast_neg_zam[1]|int(0)+1%} {# translate zambretti number to forecast icons: [next 6 h, next 12 h] #} {%if z == 1%}{%set forecast = [0,0]%} {%elif z == 2%}{%set forecast = [1,1]%} {%elif z == 3%}{%set forecast = [2,1]%} {%elif z == 4%}{%set forecast = [1,2]%} {%elif z == 5%}{%set forecast = [2,2]%} {%elif z == 6%}{%set forecast = [2,1]%} {%elif z == 7%}{%set forecast = [2,1]%} {%elif z == 8%}{%set forecast = [1,4]%} {%elif z == 9%}{%set forecast = [4,2]%} {%elif z == 10%}{%set forecast = [4,4]%} {%elif z == 11%}{%set forecast = [2,2]%} {%elif z == 12%}{%set forecast = [3,1]%} {%elif z == 13%}{%set forecast = [3,3]%} {%elif z == 14%}{%set forecast = [2,2]%} {%elif z == 15%}{%set forecast = [4,5]%} {%elif z == 16%}{%set forecast = [4,4]%} {%elif z == 17%}{%set forecast = [2,2]%} {%elif z == 18%}{%set forecast = [2,4]%} {%elif z == 19%}{%set forecast = [2,2]%} {%elif z == 20%}{%set forecast = [5,5]%} {%elif z == 21%}{%set forecast = [2,4]%} {%elif z == 22%}{%set forecast = [4,4]%} {%elif z == 23%}{%set forecast = [4,4]%} {%elif z == 24%}{%set forecast = [6,4]%} {%elif z == 25%}{%set forecast = [6,6]%} {%endif%} {{forecast}}) renders=2>
Error while processing template: Template<template=({# give approx. values for rain probability #} {%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%if forecast[0]<2 and forecast[1]<2 %}{%set rain_prob = [0,0]%} {%elif forecast[0]==1 and forecast[1]>=2 %}{%set rain_prob = [20,60]%} {%elif forecast[0]==2 and forecast[1]==2 %}{%set rain_prob = [50,50]%} {%elif forecast[0]==2 and forecast[1]>2 %}{%set rain_prob = [50,70]%} {%else%}{%set rain_prob = [90,90]%}{%endif%} {{rain_prob}}) renders=2>
Error while processing template: Template<template=({%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%set conditions = [('mdi:weather-sunny','mdi:weather-night'),('mdi:weather-partly-cloudy', 'mdi:weather-night-partly-cloudy'),('mdi:weather-partly-rainy','mdi:weather-partly-rainy'),('mdi:weather-cloudy','mdi:weather-cloudy'),('mdi:weather-rainy','mdi:weather-rainy'),('mdi:weather-pouring','mdi:weather-pouring'),('mdi:weather-lightning-rainy','mdi:weather-lightning-rainy')]%} {# [State][day/night], available states: sunny (0), partlycloudy(1), partlycloudyrain(2), cloudy(3), rainy(4), pouring(5), lightning-rainy(6) #} {%if is_state('sun.sun', 'below_horizon')==true%}{%set daynight=1%}{%else%}{%set daynight=0%}{%endif%} {%set now = conditions[forecast[0]|int(0)][daynight|int(0)]%} {%set later = conditions[forecast[1]|int(0)][daynight|int(0)]%} {{(now,later)}}) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 573, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2364, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, 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 303, in getitem
return obj[argument]
~~~^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast_zambretti'
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 699, in async_render_to_info
render_info._result = self.async_render(
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 575, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast_zambretti'
Registratore: homeassistant.components.template.template_entity
Fonte: components/template/template_entity.py:199
integration: Template (documentazione, problemi)
Prima occorrenza: 15:14:30 (14 occorrenze)
Ultima registrazione: 15:14:30
TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast'') while processing template 'Template<template=({%set forecast = states.sensor.local_forecast_zambretti_detail.attributes.forecast%} {%set conditions = [('mdi:weather-sunny','mdi:weather-night'),('mdi:weather-partly-cloudy', 'mdi:weather-night-partly-cloudy'),('mdi:weather-partly-rainy','mdi:weather-partly-rainy'),('mdi:weather-cloudy','mdi:weather-cloudy'),('mdi:weather-rainy','mdi:weather-rainy'),('mdi:weather-pouring','mdi:weather-pouring'),('mdi:weather-lightning-rainy','mdi:weather-lightning-rainy')]%} {# [State][day/night], available states: sunny (0), partlycloudy(1), partlycloudyrain(2), cloudy(3), rainy(4), pouring(5), lightning-rainy(6) #} {%if is_state('sun.sun', 'below_horizon')==true%}{%set daynight=1%}{%else%}{%set daynight=0%}{%endif%} {%set now = conditions[forecast[0]|int(0)][daynight|int(0)]%} {%set later = conditions[forecast[1]|int(0)][daynight|int(0)]%} {{(now,later)}}) renders=4>' for attribute 'icons' in entity 'sensor.local_forecast_zambretti_detail'
TemplateError('UndefinedError: None has no element 1') while processing template 'Template<template=({{"More details on neg_zam forecast", states.sensor.local_forecast.attributes.forecast_neg_zam[1]|int(0)+1}}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.local_forecast_neg_zam_detail'
TemplateError('UndefinedError: None has no element 1') while processing template 'Template<template=({% set z = states.sensor.local_forecast.attributes.forecast_neg_zam[1]|int(0)+1%} {# translate zambretti number to forecast icons: [next 6 h, next 12 h] #} {%if z == 1%}{%set forecast = [0,0]%} {%elif z == 2%}{%set forecast = [1,1]%} {%elif z == 3%}{%set forecast = [2,1]%} {%elif z == 4%}{%set forecast = [1,2]%} {%elif z == 5%}{%set forecast = [2,2]%} {%elif z == 6%}{%set forecast = [2,1]%} {%elif z == 7%}{%set forecast = [2,1]%} {%elif z == 8%}{%set forecast = [1,4]%} {%elif z == 9%}{%set forecast = [4,2]%} {%elif z == 10%}{%set forecast = [4,4]%} {%elif z == 11%}{%set forecast = [2,2]%} {%elif z == 12%}{%set forecast = [3,1]%} {%elif z == 13%}{%set forecast = [3,3]%} {%elif z == 14%}{%set forecast = [2,2]%} {%elif z == 15%}{%set forecast = [4,5]%} {%elif z == 16%}{%set forecast = [4,4]%} {%elif z == 17%}{%set forecast = [2,2]%} {%elif z == 18%}{%set forecast = [2,4]%} {%elif z == 19%}{%set forecast = [2,2]%} {%elif z == 20%}{%set forecast = [5,5]%} {%elif z == 21%}{%set forecast = [2,4]%} {%elif z == 22%}{%set forecast = [4,4]%} {%elif z == 23%}{%set forecast = [4,4]%} {%elif z == 24%}{%set forecast = [6,4]%} {%elif z == 25%}{%set forecast = [6,6]%} {%endif%} {{forecast}}) renders=4>' for attribute 'forecast' in entity 'sensor.local_forecast_neg_zam_detail'
TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast'') while processing template 'Template<template=({# give approx. values for rain probability #} {%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%if forecast[0]<2 and forecast[1]<2 %}{%set rain_prob = [0,0]%} {%elif forecast[0]==1 and forecast[1]>=2 %}{%set rain_prob = [20,60]%} {%elif forecast[0]==2 and forecast[1]==2 %}{%set rain_prob = [50,50]%} {%elif forecast[0]==2 and forecast[1]>2 %}{%set rain_prob = [50,70]%} {%else%}{%set rain_prob = [90,90]%}{%endif%} {{rain_prob}}) renders=4>' for attribute 'rain_prob' in entity 'sensor.local_forecast_neg_zam_detail'
TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast'') while processing template 'Template<template=({%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%set conditions = [('mdi:weather-sunny','mdi:weather-night'),('mdi:weather-partly-cloudy', 'mdi:weather-night-partly-cloudy'),('mdi:weather-partly-rainy','mdi:weather-partly-rainy'),('mdi:weather-cloudy','mdi:weather-cloudy'),('mdi:weather-rainy','mdi:weather-rainy'),('mdi:weather-pouring','mdi:weather-pouring'),('mdi:weather-lightning-rainy','mdi:weather-lightning-rainy')]%} {# [State][day/night], available states: sunny (0), partlycloudy(1), partlycloudyrain(2), cloudy(3), rainy(4), pouring(5), lightning-rainy(6) #} {%if is_state('sun.sun', 'below_horizon')==true%}{%set daynight=1%}{%else%}{%set daynight=0%}{%endif%} {%set now = conditions[forecast[0]|int(0)][daynight|int(0)]%} {%set later = conditions[forecast[1]|int(0)][daynight|int(0)]%} {{(now,later)}}) renders=4>' for attribute 'icons' in entity 'sensor.local_forecast_neg_zam_detail'
Is it possible that with the 2024.3.2 core update it stopped working? 😢
I'm on 2024.4.0.dev, and the integration is working fine. the fact your lovelace card is populated means it's pretty much working for you too, so this is likely an intermittent logspam thing caused by sensors going unavailable/expiring.
my outdoor sensors are 433MHz Oregon Scientific gear going through rtl_433; with the non-ideal antenna placement I have, occasionally of the sensors won't update for a while, expire, and cause the integration to throw errors. I added the following to the Home Assistant config of all the weather sensors this integration uses to help limit the logspam (so the integration and lovelace card only throw roughly one error each when this occurs):
availability_template: "{{ states('sensor.outdoor_humidity') | is_number }}"
without that, Home Assistant will try to do math with empty strings (as the state for an expired/dead entity is always set to '') or possibly divide by zero. if that's happening, there should be corresponding log entries where it says something along the lines of:
ValueError: could not convert string to float: ''
I would double check the history of all the sensor entities you're using, especially your barometer, and make sure they're not expiring or otherwise going into an unknown state. if they are, fix that first.
Thanks Francis for your help, this morning I updated HA and now the package doesn't seem to work anymore..
My sensor is a stupid aqara temperature and humidity integrated on HA via Zigbee2MQTT so the value should always maintain it even if it goes offline I think..
These are the errors I found in the registry:
Registratore: homeassistant.helpers.event
Fonte: helpers/template.py:575
Prima occorrenza: 15:41:12 (119 occorrenze)
Ultima registrazione: 17:49:25
Error while processing template: Template<template=(~ {{states.sensor.local_forecast_zambretti_detail.attributes.second_time[0]}}) renders=34>
Error while processing template: Template<template=(Pioggia: {{states.sensor.local_forecast_zambretti_detail.attributes.rain_prob[1]}}% {%if states.sensor.local_forecast.attributes.forecast_temp_short[1] == 1%}{{states.sensor.local_forecast.attributes.forecast_temp_short[0]}}°C{%endif%}) renders=34>
Error while processing template: Template<template=(- {%if states.sensor.local_forecast.attributes.forecast_temp_short[1] >= 0%}{{states.sensor.local_forecast.attributes.temperature}}°C{%endif%}) renders=86>
Error while processing template: Template<template=(Pioggia: {{states.sensor.local_forecast_neg_zam_detail.attributes.rain_prob[0]}}% {%if states.sensor.local_forecast.attributes.forecast_temp_short[1] == 0%}{{states.sensor.local_forecast.attributes.forecast_temp_short[0]}}°C{%endif%}) renders=58>
Error while processing template: Template<template=(Pioggia: {{states.sensor.local_forecast_neg_zam_detail.attributes.rain_prob[1]}}% {%if states.sensor.local_forecast.attributes.forecast_temp_short[1] == 1%}{{states.sensor.local_forecast.attributes.forecast_temp_short[0]}}°C{%endif%}) renders=58>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 573, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2364, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 4, in top-level template code
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2037, in forgiving_float_filter
return float(value)
^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'temperature'
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 699, in async_render_to_info
render_info._result = self.async_render(
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 575, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'temperature'
Registratore: homeassistant.components.template.template_entity
Fonte: components/template/template_entity.py:199
integration: Template ([documentazione](https://www.home-assistant.io/integrations/template), [problemi](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+template%22))
Prima occorrenza: 15:41:12 (17 occorrenze)
Ultima registrazione: 17:45:20
TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast'') while processing template 'Template<template=({# give approx. values for rain probability #} {%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%if forecast[0]<2 and forecast[1]<2 %}{%set rain_prob = [0,0]%} {%elif forecast[0]==1 and forecast[1]>=2 %}{%set rain_prob = [20,60]%} {%elif forecast[0]==2 and forecast[1]==2 %}{%set rain_prob = [50,50]%} {%elif forecast[0]==2 and forecast[1]>2 %}{%set rain_prob = [50,70]%} {%else%}{%set rain_prob = [90,90]%}{%endif%} {{rain_prob}}) renders=4>' for attribute 'rain_prob' in entity 'sensor.local_forecast_neg_zam_detail'
TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'forecast'') while processing template 'Template<template=({%set forecast = states.sensor.local_forecast_neg_zam_detail.attributes.forecast%} {%set conditions = [('mdi:weather-sunny','mdi:weather-night'),('mdi:weather-partly-cloudy', 'mdi:weather-night-partly-cloudy'),('mdi:weather-partly-rainy','mdi:weather-partly-rainy'),('mdi:weather-cloudy','mdi:weather-cloudy'),('mdi:weather-rainy','mdi:weather-rainy'),('mdi:weather-pouring','mdi:weather-pouring'),('mdi:weather-lightning-rainy','mdi:weather-lightning-rainy')]%} {# [State][day/night], available states: sunny (0), partlycloudy(1), partlycloudyrain(2), cloudy(3), rainy(4), pouring(5), lightning-rainy(6) #} {%if is_state('sun.sun', 'below_horizon')==true%}{%set daynight=1%}{%else%}{%set daynight=0%}{%endif%} {%set now = conditions[forecast[0]|int(0)][daynight|int(0)]%} {%set later = conditions[forecast[1]|int(0)][daynight|int(0)]%} {{(now,later)}}) renders=4>' for attribute 'icons' in entity 'sensor.local_forecast_neg_zam_detail'
TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{ states('sensor.psv_ultimo_mese')|replace(',', '.')|float }}' but no default was specified') while processing template 'Template<template=({{ states('sensor.psv_ultimo_mese')|replace(',', '.')|float }}) renders=6>' for attribute '_attr_native_value' in entity 'sensor.costo_gas_attuale'
TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{ states('sensor.psv_ultimo_mese')|replace(',', '.')|float }}' but no default was specified') while processing template 'Template<template=({{ states('sensor.psv_ultimo_mese')|replace(',', '.')|float }}) renders=10>' for attribute '_attr_native_value' in entity 'sensor.costo_gas_attuale'
TemplateError('ValueError: Template error: float got invalid input 'unknown' when rendering template '{% if states('sensor.piante_garage_illuminazione') == 'unavailable' %} N/A {% elif states('sensor.piante_garage_illuminazione') | float < 7000 %} {{ states('sensor.piante_garage_temperatura') }} {% else %} Sole {% endif %}' but no default was specified') while processing template 'Template<template=({% if states('sensor.piante_garage_illuminazione') == 'unavailable' %} N/A {% elif states('sensor.piante_garage_illuminazione') | float < 7000 %} {{ states('sensor.piante_garage_temperatura') }} {% else %} Sole {% endif %}) renders=10>' for attribute '_attr_native_value' in entity 'sensor.temperatura_condizionale_garage'
if you just updated HA, try dumping your browser cache by hitting shift+f5 on your dashboard first, but it looks like your temperature entity is the current problem, as pressure_change statistics entity (and therefore the barometer entity) are working properly. if you haven't already, explicitly set the following in your temperature entity's config:
unit_of_measurement: '°C'
device_class: 'temperature'
and doublecheck sensor.local_forecast_temperature
and sensor.local_forecast_temperaturechange
entities aren't unknown/dead.
explicitly setting the unit of measurement and device class for sensor entities as per this list has fixed a lot of integration/automation problems for me in the past, including with this integration.
Thanks Francis. So now it seems to work again, but I haven't changed anything!
My temperature sensor seems to already be configured correctly..
I tried setting this up earlier this week and it didn't work for me so I moved on until I had more time. The attributes of the sensor were never populated so it never worked properly. I've just gone through all the attributes and changed the format to the "new" format e.g. states('sensor.x') instead of states.sensor.x.state and it's now working.
Hi,
I receive several errors in home-assistant.log when using these sensors. Nevertheless, when I check the different parts in the developer-tools everything is working.
Am I do something wrong?