Can somebody please help me, I’ve quite recently started encountering my home assistant crashing and rebooting and in the error log I have this:
Logger: homeassistant.helpers.event
Source: helpers/template.py:574
First occurred: 9 February 2024 at 19:04:45 (434 occurrences)
Last logged: 20:54:48
Error while processing template: Template<template=({{ state_attr(entity, 'distance') | round(1) | float(0) }} km) renders=264>
Error while processing template: Template<template=({{ state_attr(entity, 'distance') | round(1) | float(0) }} km) renders=268>
Error while processing template: Template<template=({{ state_attr(entity, 'distance') | round(1) | float(0) }} km) renders=272>
Error while processing template: Template<template=({{ state_attr(entity, 'distance') | round(1) | float(0) }} km) renders=276>
Error while processing template: Template<template=({{ state_attr(entity, 'distance') | round(1) | float(0) }} km) renders=280>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1656, in forgiving_round
value = round(float(value), precision)
^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 572, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2332, 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/src/homeassistant/homeassistant/helpers/template.py", line 1661, in forgiving_round
raise_no_default("round", value)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1637, in raise_no_default
raise ValueError(
ValueError: Template error: round got invalid input 'None' when rendering template '{{ state_attr(entity, 'distance') | round(1) }} km' but no default was specified
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 698, in async_render_to_info
render_info._result = self.async_render(
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 574, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: round got invalid input 'None' when rendering template '{{ state_attr(entity, 'distance') | round(1) }} km' but no default was specified
Maybe you have some hardware issue. I replaced my working server for i7 processor, 1 gen. And it started to crash and rebooting.
Going back to my old server everything was working fine. No more crashed no more reboots. I couldn’t find anything in the logs that make sense.
Logger: homeassistant.helpers.event
Source: helpers/template.py:574
First occurred: 9 February 2024 at 19:04:45 (621 occurrences)
Last logged: 11:35:22
Error while processing template: Template<template=({{ state_attr(entity, 'distance') | round(1, ) }} km) renders=2>
Error while processing template: Template<template=({{ state_attr(entity, 'distance') | round(1, 0) }} km) renders=2>
Error while processing template: Template<template=({{ state_attr(entity, "distance") | round(1, 0) }} Mi) renders=166>
Error while processing template: Template<template=({{ state_attr(entity, 'distance') | round(1, 0) }} km) renders=6>
Error while processing template: Template<template=({{ state_attr(entity, 'distance') | round(1, 0) }} km) renders=10>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1656, in forgiving_round
value = round(float(value), precision)
^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 572, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2332, 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/src/homeassistant/homeassistant/helpers/template.py", line 1661, in forgiving_round
raise_no_default("round", value)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1637, in raise_no_default
raise ValueError(
ValueError: Template error: round got invalid input 'None' when rendering template '{{ state_attr(entity, 'distance') | round(1) }} km' but no default was specified
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 698, in async_render_to_info
render_info._result = self.async_render(
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 574, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: round got invalid input 'None' when rendering template '{{ state_attr(entity, 'distance') | round(1) }} km' but no default was specified