I created a handful of input helpers for manually tracking my whole-house water filter:
-
input_datetime
- for the last date it was changed -
input_number
- for how many days it should last -
input_text
- for tracking the brand/model -
input_number
- for tracking the pressure drop.
I then created a template sensor to bring all that in one place and include some calculations:
- sensor:
- name: "Whole House Water Filter Status"
unique_id: 'a2726167-fb6c-434e-b204-83208035ead9'
attributes:
expire_date: >
{% set span = timedelta(days=(states('input_number.whole_house_water_filter_lifetime')) |int(0)) %}
{% set expireDate = span + as_datetime(states('input_datetime.whole_house_water_filter_last_replaced')) %}
{{ expireDate.strftime('%x') }}
days_remaining: >
{% set span = timedelta(days=(states('input_number.whole_house_water_filter_lifetime')) |int(0)) %}
{% set expireDate = span + as_datetime(states('input_datetime.whole_house_water_filter_last_replaced')) %}
{{ (expireDate - as_datetime(states('sensor.date'))).days }}
last_changed: "{{ as_datetime(states('input_datetime.whole_house_water_filter_last_replaced')).strftime('%x') }}"
pressure_drop: "{{ states('input_number.whole_house_water_filter_pressure_drop') | int }}"
notes: "{{ states('input_text.whole_house_water_filter_notes') }}"
state: >
{% set span = timedelta(days=(states('input_number.whole_house_water_filter_lifetime')) |int(0)) %}
{% set expireDate = span + as_datetime(states('input_datetime.whole_house_water_filter_last_replaced')) %}
{% if expireDate > as_datetime(states('sensor.date')) %}
Ok
{% else %}
Expired
{% endif %}
Next, I plan to build some automation to remind me when the filter needs to be changed. I think I have a pretty good handle on how to do that, but what I’m struggling with is that once the filter is changed, I’d like a streamlined way of capturing the new input values - preferably, all at once in a single dialog.
I’ve scoured the forums and internet but have come up empty so far…any suggestions or pointers where to look?
Thank you!