input_datetime: downstairs_last_filter_change: name: Downstairs Last Filter Change has_date: true has_time: true upstairs_last_filter_change: name: Upstairs Last Filter Change has_date: true has_time: true binary_sensor: - platform: template sensors: downstairs_ac_cooling: friendly_name: "Downstairs AC is Cooling" value_template: > {{ state_attr('climate.downstairs', 'hvac_action') == 'cooling' }} upstairs_ac_cooling: friendly_name: "Upstairs AC is Cooling" value_template: > {{ state_attr('climate.upstairs', 'hvac_action') == 'cooling' }} sensor: - platform: history_stats name: Downstairs AC Runtime Since Last Filter Change entity_id: binary_sensor.downstairs_ac_cooling state: 'on' type: time start: "{{ states('input_datetime.downstairs_last_filter_change') }}" end: "{{ now() }}" - platform: history_stats name: Upstairs AC Runtime Since Last Filter Change entity_id: binary_sensor.upstairs_ac_cooling state: 'on' type: time start: "{{ states('input_datetime.upstairs_last_filter_change') }}" end: "{{ now() }}" script: reset_filter_change_date: alias: Reset Downstairs Filter Change Date sequence: - service: input_datetime.set_datetime data: entity_id: input_datetime.downstairs_last_filter_change datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" automation: - alias: Notify Downstairs Filter Change Due description: "Notify when AC runtime exceeds threshold since last filter change" trigger: - platform: numeric_state entity_id: sensor.downstairs_ac_runtime_since_last_filter_change above: 800 action: - service: script.notify_engine data: title: "Home Maintenance Reminder" value1: "It's time to change your Downstairs AC filter." value2: "Runtime has exceeded 800 hours. Last changed {{ ((now() - states.input_datetime.downstairs_last_filter_change.last_changed).total_seconds() / 86400) | round(0) }} days ago." who: "Carlo" group: "maintenance" level: "active" - alias: Notify Upstairs Filter Change Due description: "Notify when AC runtime exceeds threshold since last filter change" trigger: - platform: numeric_state entity_id: sensor.upstairs_ac_runtime_since_last_filter_change above: 450 action: - service: script.notify_engine data: title: "Home Maintenance Reminder" value1: "It's time to change your Upstairs AC filter." value2: "Runtime has exceeded 450 hours. Last changed {{ ((now() - states.input_datetime.upstairs_last_filter_change.last_changed).total_seconds() / 86400) | round(0) }} days ago." who: "Carlo" group: "maintenance"