@Tediore, I’m attempting to use the Furnace Filter Runtime Sensor but I’m seeing errors each time HA is restarted. The errors are;
2023-04-24 21:56:21.336 ERROR (MainThread) [homeassistant.components.history_stats.helpers] Error parsing template for field end
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1784, in forgiving_as_timestamp
return dt_util.as_timestamp(value)
File "/usr/src/homeassistant/homeassistant/util/dt.py", line 134, in as_timestamp
raise ValueError("not a valid date/time.")
ValueError: not a valid date/time.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 539, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2130, in _render_with_context
return template.render(**kwargs)
File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.10/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.10/site-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1787, in forgiving_as_timestamp
raise_no_default("as_timestamp", value)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1589, in raise_no_default
raise ValueError(
ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{{ as_timestamp(states('input_text.furnace_filter')) }}' 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/components/history_stats/helpers.py", line 39, in async_calculate_period
rendered = template.async_render()
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 541, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{{ as_timestamp(states('input_text.furnace_filter')) }}' but no default was specified
2023-04-24 21:56:21.340 ERROR (MainThread) [homeassistant.components.history_stats.coordinator] Error fetching Cooling before last filter change data: ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{{ as_timestamp(states('input_text.furnace_filter')) }}' but no default was specified
2023-04-24 21:56:21.350 ERROR (MainThread) [homeassistant.components.history_stats.helpers] Error parsing template for field end
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1784, in forgiving_as_timestamp
return dt_util.as_timestamp(value)
File "/usr/src/homeassistant/homeassistant/util/dt.py", line 134, in as_timestamp
raise ValueError("not a valid date/time.")
ValueError: not a valid date/time.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 539, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2130, in _render_with_context
return template.render(**kwargs)
File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.10/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.10/site-packages/jinja2/sandbox.py", line 393, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1787, in forgiving_as_timestamp
raise_no_default("as_timestamp", value)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1589, in raise_no_default
raise ValueError(
ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{{ as_timestamp(states('input_text.furnace_filter')) }}' 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/components/history_stats/helpers.py", line 39, in async_calculate_period
rendered = template.async_render()
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 541, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{{ as_timestamp(states('input_text.furnace_filter')) }}' but no default was specified
2023-04-24 21:56:21.353 ERROR (MainThread) [homeassistant.components.history_stats.coordinator] Error fetching Heating before last filter change data: ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{{ as_timestamp(states('input_text.furnace_filter')) }}' but no default was specified
I’m running;
Home Assistant 2023.4.6
Supervisor 2023.04.1
Operating System 10.0
Frontend 20230411.1 - latest
with Furnace filter runtime sensor version 0.96. Appreciate the sensor is a couple of years old and that there’s been many changes to HA since the sensors inception. I’ve looked through the code, found the offending lines but do not know how to adjust the code to correct the error.
Would you kindly point me in the correct direction?
With appreciation.