Error while processing template - where to fix

Hello,

I get the following messages:

Logger: homeassistant.helpers.event
Source: helpers/template.py:370
First occurred: 15:19:16 (10 occurrences)
Last logged: 15:19:17

Error while processing template: Template("Main Brush: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.main_brush_left }}")
Error while processing template: Template("Side Brush: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.side_brush_left }}")
Error while processing template: Template("Filter: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.filter_left }}")
Error while processing template: Template("Sensor: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.sensor_dirty_left }}")
Error while processing template: Template("Battery: {{ states.vacuum.xiaomi_vacuum_cleaner.attributes.battery_level }}")
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 368, in async_render
    render_result = compiled.render(kwargs)
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.8/site-packages/jinja2/sandbox.py", line 407, in getattr
    value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'None' has no attribute 'attributes'

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 477, in async_render_to_info
    render_info._result = self.async_render(variables, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 370, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'attributes'

The xiaomi-entity is no longer available. My lovelace-card has been corrected after adding the vacuum cleaner directly using the integration.

Can anybody help me?

Best regards, Markus

did you ever get this fixed I have the same kind of error on a different template

Hi, sorry for late reply, I had templates that were referring the wrong (old) device … :frowning: