Hi all,
I 've tried integrate this forecast. I found in your code this comments
# The sampling_size values should add up to slightly less than the amount of sensor updates in the max_age time to work around Home Assistant's statistics integration
# e.g. a pressure sensor that updates every ~5 seconds in 180 minutes is 2160 updates, -12.5%, gives 1890 samples
I’m combine two temp value to one it means( netatmo outdoor temp (15min update) and aqara temp(5min) , pressure is taken from aqara(5min)
I 'm getting error in log regarding temp was unvailable or pressure
I think errors are from UI but it has depends on backend because in this time was short temp and some forecast null
Logger: homeassistant.helpers.event
Zdroj: helpers/template.py:633
Prvýkrát sa vyskytol: 28. decembra 2024 o 14:24:07 (732 výskytov)
Naposledy prihlásený: 19:50: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=2522>
Error while processing template: Template<template=({{states.sensor.local_forecast_neg_zam_detail.attributes.icons[0]}}) renders=2134>
Error while processing template: Template<template=(Rain: {{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=2382>
Error while processing template: Template<template=({{states.sensor.local_forecast_neg_zam_detail.attributes.icons[1]}}) renders=2134>
Error while processing template: Template<template=(Rain: {{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=2382>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 631, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2733, in _render_with_context
return template.render(**kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/jinja2/environment.py", line 939, 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 2352, 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 748, in async_render_to_info
render_info._result = self.async_render( # noqa: SLF001
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
variables, strict=strict, log_fn=log_fn, **kwargs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 633, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'temperature'
Logger: homeassistant.components.template.template_entity
Zdroj: components/template/template_entity.py:203
Integrácia: Template (dokumentácia, problémy)
Prvýkrát sa vyskytol: 28. decembra 2024 o 14:24:07 (613 výskytov)
Naposledy prihlásený: 19:50:32
TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'first_time'') while processing template 'Template<template=({# ultra short term temperature prognosis #} {% set temp = states.sensor.local_forecast.attributes.temperature|float(0)%} {%set temp_change = states.sensor.local_forecast_temperaturechange.state|float(0)%} {%set first_time = states.sensor.local_forecast_zambretti_detail.attributes.first_time[1]|float(0)%} {%set second_time = states.sensor.local_forecast_zambretti_detail.attributes.second_time[1]|float(0)%} {%if first_time>0%}{%set t_forecast = ((temp_change/60*first_time)+temp)|round(1)%}{%set interval = 0%} {%elif second_time>0%}{%set t_forecast = ((temp_change/60*second_time)+temp)|round(1)%}{%set interval = 1%} {%else%}{%set t_forecast = "unavailable"%}{%set interval = -1%}{%endif%} {{[t_forecast,interval]}}) renders=6546>' for attribute 'forecast_temp_short' in entity 'sensor.local_forecast'
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_zambretti_detail.attributes.forecast%} {%if forecast[0]==0 and forecast[1]==0 %}{%set rain_prob = [0,0]%} {%elif forecast[0]==2 and forecast[1]==1 %}{%set rain_prob = [60,10]%} {%elif forecast[0]==1 and forecast[1]==1 %}{%set rain_prob = [30,30]%} {%elif forecast[0]==1 and forecast[1]==0 %}{%set rain_prob = [10,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]%} {%elif forecast[0]>=2 and forecast[1]<2 %}{%set rain_prob = [50,10]%} {%else%}{%set rain_prob = [90,90]%}{%endif%} {{rain_prob}}) renders=4980>' for attribute 'rain_prob' in entity 'sensor.local_forecast_zambretti_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_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=5324>' for attribute 'icons' in entity 'sensor.local_forecast_zambretti_detail'
TemplateError('UndefinedError: str object has no element 0') 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=5300>' for attribute 'rain_prob' in entity 'sensor.local_forecast_neg_zam_detail'
TemplateError('UndefinedError: str object has no element 0') 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=5774>' for attribute 'icons' in entity 'sensor.local_forecast_neg_zam_detail'
Logger: homeassistant.components.template.template_entity
Zdroj: components/template/template_entity.py:203
Integrácia: Template (dokumentácia, problémy)
Prvýkrát sa vyskytol: 22:02:58 (9 výskytov)
Naposledy prihlásený: 22:02:58
TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'first_time'') while processing template 'Template<template=({# ultra short term temperature prognosis #} {% set temp = states.sensor.local_forecast.attributes.temperature|float(0)%} {%set temp_change = states.sensor.local_forecast_temperaturechange.state|float(0)%} {%set first_time = states.sensor.local_forecast_zambretti_detail.attributes.first_time[1]|float(0)%} {%set second_time = states.sensor.local_forecast_zambretti_detail.attributes.second_time[1]|float(0)%} {%if first_time>0%}{%set t_forecast = ((temp_change/60*first_time)+temp)|round(1)%}{%set interval = 0%} {%elif second_time>0%}{%set t_forecast = ((temp_change/60*second_time)+temp)|round(1)%}{%set interval = 1%} {%else%}{%set t_forecast = "unavailable"%}{%set interval = -1%}{%endif%} {{[t_forecast,interval]}}) renders=7244>' for attribute 'forecast_temp_short' in entity 'sensor.local_forecast'
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_zambretti_detail.attributes.forecast%} {%if forecast[0]==0 and forecast[1]==0 %}{%set rain_prob = [0,0]%} {%elif forecast[0]==2 and forecast[1]==1 %}{%set rain_prob = [60,10]%} {%elif forecast[0]==1 and forecast[1]==1 %}{%set rain_prob = [30,30]%} {%elif forecast[0]==1 and forecast[1]==0 %}{%set rain_prob = [10,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]%} {%elif forecast[0]>=2 and forecast[1]<2 %}{%set rain_prob = [50,10]%} {%else%}{%set rain_prob = [90,90]%}{%endif%} {{rain_prob}}) renders=5516>' for attribute 'rain_prob' in entity 'sensor.local_forecast_zambretti_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_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=5872>' for attribute 'icons' in entity 'sensor.local_forecast_zambretti_detail'
TemplateError('UndefinedError: str object has no element 0') 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=5850>' for attribute 'rain_prob' in entity 'sensor.local_forecast_neg_zam_detail'
TemplateError('UndefinedError: str object has no element 0') 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=6336>' for attribute 'icons' in entity 'sensor.local_forecast_neg_zam_detail'