Hi,
Recently I’m getting multiple errors on diferentes templates while processing the template. Below you can find the log:
> Logger: homeassistant.helpers.event
> Source: helpers/template.py:645
> First occurred: 2:04:12 AM (4 occurrences)
> Last logged: 2:04:12 AM
>
> Error while processing template: Template<template=({% set T1 = states.climate.termostato_salon.attributes.temperature | float %} {% if T1|is_number %} {{ (T1 ) | round(1) }} {% else %} {{ this.state }} {% endif %}) renders=2>
> Traceback (most recent call last):
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 643, in async_render
> render_result = _render_with_context(self.template, compiled, **kwargs)
> File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2756, in _render_with_context
> return template.render(**kwargs)
> ~~~~~~~~~~~~~~~^^^^^^^^^^
> File "/usr/local/lib/python3.13/site-packages/jinja2/environment.py", line 1295, in render
> self.environment.handle_exception()
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
> File "/usr/local/lib/python3.13/site-packages/jinja2/environment.py", line 942, 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 2375, 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 760, 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 645, in async_render
> raise TemplateError(err) from err
> homeassistant.exceptions.TemplateError: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'temperature'
And this is my template sensor:
{% set T1 = states.climate.termostato_salon.attributes.temperature | float %}
{% if T1|is_number %}
{{ (T1 ) | round(1) }}
{% else %}
{{ this.state }}
{% endif %}
Is there any thing wrong with the template? It’s working perfectly most of the time.