Fixed via changing helper entity to Date + Time
I am still getting some errors.
2024-07-03 09:43:54.243 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: strptime got invalid input '2024-07-02' when rendering template '{{ strptime(states('input_datetime.upstairs_kitchen_water_filter_date_last_changed'), '%Y-%m-%d %H:%M:%S') + timedelta(days=states('input_number.upstairs_kitchen_water_filter_days_until_old') | int) }}' but no default was specified') while processing template 'Template<template=({{ strptime(states('input_datetime.upstairs_kitchen_water_filter_date_last_changed'), '%Y-%m-%d %H:%M:%S') + timedelta(days=states('input_number.upstairs_kitchen_water_filter_days_until_old') | int) }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.upstairs_kitchen_water_filter_change_date'
2024-07-03 09:43:54.244 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({% set upstairs_kitchen_water_filter_change_date = strptime(states('input_datetime.upstairs_kitchen_water_filter_date_last_changed'), '%Y-%m-%d %H:%M:%S') + timedelta(days=states('input_number.upstairs_kitchen_water_filter_days_until_old') | int) %} {{ (as_timestamp(upstairs_kitchen_water_filter_change_date) / 86400 - as_timestamp(now()) / 86400) | int }}) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2100, in strptime
return datetime.strptime(string, fmt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/_strptime.py", line 554, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/_strptime.py", line 333, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '2024-07-02' does not match format '%Y-%m-%d %H:%M:%S'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 603, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2616, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 394, in call
return __context.call(__obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2103, in strptime
raise_no_default("strptime", string)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1853, in raise_no_default
raise ValueError(
ValueError: Template error: strptime got invalid input '2024-07-02' when rendering template '{% set upstairs_kitchen_water_filter_change_date = strptime(states('input_datetime.upstairs_kitchen_water_filter_date_last_changed'), '%Y-%m-%d %H:%M:%S') + timedelta(days=states('input_number.upstairs_kitchen_water_filter_days_until_old') | int) %} {{ (as_timestamp(upstairs_kitchen_water_filter_change_date) / 86400 - as_timestamp(now()) / 86400) | int }}' 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 715, in async_render_to_info
render_info._result = self.async_render( # noqa: SLF001
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 605, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: strptime got invalid input '2024-07-02' when rendering template '{% set upstairs_kitchen_water_filter_change_date = strptime(states('input_datetime.upstairs_kitchen_water_filter_date_last_changed'), '%Y-%m-%d %H:%M:%S') + timedelta(days=states('input_number.upstairs_kitchen_water_filter_days_until_old') | int) %} {{ (as_timestamp(upstairs_kitchen_water_filter_change_date) / 86400 - as_timestamp(now()) / 86400) | int }}' but no default was specified
2024-07-03 09:43:54.246 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: strptime got invalid input '2024-07-02' when rendering template '{% set upstairs_kitchen_water_filter_change_date = strptime(states('input_datetime.upstairs_kitchen_water_filter_date_last_changed'), '%Y-%m-%d %H:%M:%S') + timedelta(days=states('input_number.upstairs_kitchen_water_filter_days_until_old') | int) %} {{ (as_timestamp(upstairs_kitchen_water_filter_change_date) / 86400 - as_timestamp(now()) / 86400) | int }}' but no default was specified') while processing template 'Template<template=({% set upstairs_kitchen_water_filter_change_date = strptime(states('input_datetime.upstairs_kitchen_water_filter_date_last_changed'), '%Y-%m-%d %H:%M:%S') + timedelta(days=states('input_number.upstairs_kitchen_water_filter_days_until_old') | int) %} {{ (as_timestamp(upstairs_kitchen_water_filter_change_date) / 86400 - as_timestamp(now()) / 86400) | int }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.upstairs_kitchen_water_filter_days_left'