I have very simple trigger. It’s trigger properly, when aqi > 10 and then it sets fan speed to apropriate level. But I expected that trigger will follow the aqi and when it starts lets say with aqi >30, favorite level 10, when aqi will become 25, favorite level will change to 6 and so on.
So, my question is: how to make responsive trigger which change favorite level according to aqi?
It looks like once the trigger has been triggered, it’s not triggered again, until aqi>10. I need trigger, which is fired again and again until aqi > 10.
- alias: 'On salon pm>10'
trigger:
- above: '10'
entity_id: fan.salon
platform: numeric_state
value_template: '{{ state.attributes.aqi }}'
action:
- entity_id: fan.salon
service: fan.turn_on
- entity_id: fan.salon
service: fan.set_speed
data:
speed: favorite
- service: xiaomi_miio.fan_set_favorite_level
data_template:
entity_id: fan.salon
level: >
{% if state_attr('fan.salon', 'aqi') | int > 30 %}
10
{% elif state_attr('fan.salon', 'aqi') | int > 25 %}
6
{% elif state_attr('fan.salon', 'aqi') | int > 20 %}
5
{% elif state_attr('fan.salon', 'aqi') | int > 15 %}
4
{% else %}
3
{% endif %}