Hi! I use this automation to alert me when a heat recovery fan’s filter needs cleaning:
- alias: bathroom_fan_clean_filter
mode: single
trigger:
- platform: template
value_template: '{{ is_state_attr("fan.bathroom", "filter_alarm", true) }}'
id: id_filter_alarm
action:
- choose:
- conditions: '{{ trigger.id == "id_filter_alarm" }}'
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.clean_bathroom_fan_filter
- service: notify.mobile_app_person
data:
title: Clean filter
message: The bathroom fan filter needs cleaning.
- service: persistent_notification.create
data:
title: Clean filter
message: The bathroom fan filter needs cleaning.
notification_id: bathroom_fan_clean_filter
This works no problem - however I’d like to extend this automation as follows:
- Remind me daily to clean the filter once the filter alarm triggers.
- Check that the filter alarm is turned off once the filter has been cleaned and replaced. If it hasn’t alert me to the problem.
alias: bathroom_fan_clean_filter
mode: single
trigger:
- platform: template
value_template: '{{ is_state_attr("fan.bathroom", "filter_alarm", true) }}'
id: id_filter_alarm
- platform: time
at: '19:00:00'
id: id_time
- platform: state
entity_id: input_boolean.clean_bathroom_fan_filter
from: 'on'
on: 'off'
id: id_filter_cleaned
action:
- choose:
- conditions: '{{ trigger.id == "id_filter_alarm" }}'
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.clean_bathroom_fan_filter
- service: notify.mobile_app_person
data:
title: Clean filter
message: The bathroom fan filter needs cleaning.
- service: persistent_notification.create
data:
title: Clean filter
message: The bathroom fan filter needs cleaning.
notification_id: bathroom_fan_clean_filter
- conditions:
- '{{ trigger.id == "id_time" }}'
- '{{ is_state_attr("fan.bathroom", "filter_alarm", true) }}'
- >-
{% set last = states.input_boolean.clean_bathroom_fan_filter.last_changed %}
{{ is_state("input_boolean.clean_bathroom_fan_filter", "on") and last is none or as_timestamp(last)|timestamp_custom("%j")|int != now().strftime("%j")|int }}
sequence:
- service: notify.mobile_app_person
data:
title: Clean filter
message: The bathroom fan filter needs cleaning.
- service: persistent_notification.create
data:
title: Clean filter
message: The bathroom fan filter needs cleaning.
notification_id: bathroom_fan_clean_filter
- conditions: '{{ trigger.id == "id_filter_cleaned" }}'
sequence:
- service: dukaone.reset_filter_timer
data:
entity_id: fan.bathroom
- wait_template: '{{ is_state("input_boolean.clean_bathroom_fan_filter", "off") and is_state_attr("fan.bathroom", "filter_alarm", false) }}'
timeout: '00:00:20'
- choose:
- conditions: '{{ not wait.completed }}'
sequence:
- service: notify.mobile_app_person
data:
title: Filter cleaned
message: The bathroom fan filter has been cleaned.
- service: persistent_notification.create
data:
title: Filter cleaned
message: The bathroom fan filter has been cleaned.
notification_id: bathroom_fan_filter_cleaned
default:
- service: notify.mobile_app_person
data:
title: Fan filter error
message: There was an error reseting the bathroom fan filter.
- service: persistent_notification.create
data:
title: Fan filter error
message: There was an error reseting the bathroom fan filter.
notification_id: bathroom_fan_filter_cleaned
But I’m getting this error in my logs:
Logger: homeassistant.config
Source: config.py:454
First occurred: 19:16:18 (1 occurrences)
Last logged: 19:16:18
Invalid config for [automation]: [True] is an invalid option for [automation]. Check: automation->True. (See /config/configuration.yaml, line 259).
I’ve tried removing the two instances of true
from the automation but that doesn’t seem to help and I don’t understand why the first iteration works but the second doesn’t. What am I missing?