Xiaomi Purifier 3H - AQI sensor does not update correctly

Hello Guys,

For this issue, I went through the whole Internet but I could not find a solution.

I did integrate my Purifier correctly and everything seems to be working just fine. However, my AQI sensor is updating in very random moments - once per hour or after few minutes.

Is there any way to update the sensor with new readings every minute or 30 seconds? Having updated reading is important for most of the automatizations.

My sensor setup:

  # Xiaomi Air Purifier 3S
  - platform: template
        friendly_name: "Temperature"
        value_template: "{{ state_attr('fan.air_purifier', 'temperature') }}"
        unit_of_measurement: "°C"
        device_class: "temperature"
        friendly_name: "Humidity"
        value_template: "{{ state_attr('fan.air_purifier', 'humidity') }}"
        unit_of_measurement: "%"
        device_class: "humidity"
        friendly_name: "Air quality"
        value_template: "{{ state_attr('fan.air_purifier', 'aqi') }}"
        unit_of_measurement: "μg/m³"
        friendly_name: "Fan speed"
        value_template: "{{ state_attr('fan.air_purifier', 'motor_speed') }}"
        unit_of_measurement: "rpm"
        icon_template: "mdi:speedometer"
        friendly_name: "Filter remaining"
        value_template: "{{ state_attr('fan.air_purifier', 'filter_life_remaining') }}"
        unit_of_measurement: "%"
        icon_template: "mdi:heart-outline"type or paste code here

My card:

- type: entities
         - entity: fan.air_purifier
         - entity: input_select.xiaomi_airpurifier_mode
         - entity: input_number.xiaomi_airpurifier_favorite_level
         - entity: switch.xiaomi_airpurifier_child_lock
         - entity: switch.xiaomi_airpurifier_led
         - entity: switch.xiaomi_airpurifier_buzzer
         - entity: sensor.xiaomi_airpurifier_speed
         - entity: sensor.xiaomi_airpurifier_filter_remaining
       show_header_toggle: false
       theme: default
       title: Air Purifier
     - type: entities
         - entity: sensor.xiaomi_airpurifier_air_quality_pm25 
         - entity: sensor.xiaomi_airpurifier_temp
         - entity: sensor.xiaomi_airpurifier_humidity
       show_header_toggle: false
       theme: default
       title: Environment
     - type: history-graph
         - entity: sensor.xiaomi_airpurifier_air_quality_pm25
       hours_to_show: 80
       refresh_interval: 60
       title: Air quality

Please help! :confused:

An even more start issue is mine is not updating at all. I will reset the entire thing and integrate again. Following this thread to see if you get a solution which can be used by me too.

I would really appreciate any ideas.
Thank you!

Hi Patryk,

It seems I’m having a similar issue with the 3H I just bought. The aqi readings were very rare in HA (while for example humidity was frequently updated), but not only that, automation in the xiaomi home app almost didn’t work at all and I think I have found the reason. The automation function would only start working again after going into the android app and clicking the device to see the status. In fact, when I looked at the xiaomi app’s dashboard, it would show incorrect aqi value. The only thing which fixed the aqi reading was clicking on the device and going into the page that displays the detailed device status.

Wanting to work around the useless xiaomi home automation, I installed python-miio and tried getting device status like this:

>>> p = miio.AirPurifierMiot(ip="...", token="...")
>>> p.status()
<AirPurifierMiotStatus power=on, aqi=11, average_aqi=10, temperature=20.9, humidity=45%, fan_level=2, mode=OperationMode.Favorite, led=True, led_brightness=LedBrightness.Dim, buzzer=False, buzzer_volume=None, child_lock=False, favorite_level=5, filter_life_remaining=92, filter_hours_used=262, use_time=943200, purify_volume=19026, motor_speed=1301, filter_rfid_product_id=0:0:31:31, filter_rfid_tag=81:6c:ba:b2:de:44:4, filter_type=FilterType.Regular>

And guess what… everything would update every now and then, except aqi which would remain the same. Physically power-cycling the device would give me one new reading and then all the time the same value.
And the best part: I go into the xiaomi app, click on the device, and immediately start getting new aqi data over MIOT… for a few minutes, then aqi freezes again.

I also configured screen brightness rules in xiaomi home and they work perfectly every time. So I wouldn’t say it’s a problem with their cloud but rather with what the device reports. It seems that aqi is wrongly reported both over MIOT and whatever cloud protocol they use.

I’m on firmware

Same firmware here.

As you said: readings of AQI are not updated unless you open app and Air Purifier device tab. After few seconds there, I am getting frequently updated AQI in both: mi home app and Home Assistant.
I made a little offline test. Without the internet, you can control the device just fine, but you will not have any updates on sensors. To be honest, I do not understand why this is even a case.

When you remove your device completely from Mi Home App, you will lost control over HA as well.

I found this topic regarding this issue and solution via python:

It is way above my technical knowledge but maybe you will be able make use of it. :slight_smile:

Without the data connected and getting uploaded, how should any device show the latest data ?

I have had same issue with all Xiaomi Air Purifiers.
I am going to work around it by using a separate air quality sensor to trigger things in Home Assistant and ignore the one built into the Air Purifiers,

Maybe you can try:

Hello, has anyone managed to resolve this issue? I just got the purifier and while everything in general seems to work fine, the most important sensor only updates once every 30 minutes, except if I open the device in Mi Home app.

Weirdly, all other sensor updates more often, as far as I can tell.

As far as I understand, the official integration does support miot now, the documentation page mentions this purifier use it, so I guess that is not the problem.