Sensor template after update

Hello!

Help me figure out what happened after the update!
Before update from 2021.3 to 2021.5 all work fine some years.
I’m use packages.

This is part of the file:

    sensor:
        platform: template
        sensors:
            xiaomi_pro_air_quality_pm25:
              friendly_name: "Air quality"
              value_template: "{{ state_attr('fan.xiaomi_pro', 'aqi') | float }}"
              unit_of_measurement: "μg/m³"

  automation:
        - alias: xiaomi_pro turn off 
          id: xiaomi_pro_auto_off
          trigger:
            - platform: numeric_state
              entity_id: sensor. xiaomi_pro_air_quality_pm25
              value_template: "{{ states('sensor.xiaomi_pro_air_quality_pm25') | float }}"
              below: 3
              for:
                minutes: 5
          condition:
            - condition: state
              entity_id: 'fan.xiaomi_pro'
              state: 'on'
          action:
            service: fan.turn_off
            entity_id: fan.xiaomi_pro

I am getting correct data in {{states (‘sensor.xiaomi_pro_air_quality_pm25’) | float}} but the trigger never fires!
The rest of the numeric_state automations continue to work fine.

Please help with this!

I can see space between sensor. and rest of the sensor‘s name:


sensor. xiaomi_pro_air_quality_pm25

This is a typo when I copied.
I fixed it in the first post.

Is this also a typo or another sensor?

typo again. fixed
I have renamed my names to make it clearer

The only way that will trigger is if the sensor value is above 3 and moves below 3 for 5 minutes. It will not trigger if it’s below 3 and moves to another point below 3 for 5 minutes.

Absolutely. But what makes me wonder is the author‘s note

You are probably right!
How to specify a trigger that if the sensor.xiaomi_pro_air_quality_pm25 value is less than 3 for 5 minutes, then it will be triggered?