I have the following automation:
# turn off only if below AQI value and in AUTO mode, not in silent or manual (favouri$
- alias: 'Auto off air purifier living room'
trigger:
platform: numeric_state
entity_id: 'fan.air_purifier_living_room'
value_template: "{{ state_attr('fan.air_purifier_living_room', 'aqi') }}"
below: 10
for:
minutes: 5
condition:
condition: and
conditions:
- condition: state
entity_id: 'fan.air_purifier_living_room'
state: 'on'
- condition: template
value_template: "{{ is_state_attr('fan.air_purifier_living_room', 'mode', 'auto') }}"
action:
- service: fan.turn_off
entity_id: 'fan.air_purifier_living_room'
The automation does not get triggered properly.
For example, this is the graph of the attribute âaqiâ:
As you can see, the trigger should fire, since the AQI is well lower than 10 and for a long time: the purifier went on at 20:00.
When I reload the automations or restart HA, nothing happens.
If I remove the
for:
minutes: 5
and reload the automations, the automation gets triggered as it should and the purifier goes off.
What could be the cause of the issue? the format I used was copied from the examples about triggering, it should be correct.
Thanks in advance.