home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.95k stars 30.52k forks source link

Xiaomi Airpurifier sensor is getting crazy after update to 2022.03 #67528

Closed sgurgul closed 1 year ago

sgurgul commented 2 years ago

The problem

After update to 2022.3 AirPurifier 3H started to report AQI values much more offen and they seems to be very unbalanced. Values reported within 1-2 minutes can differ for even 200-300%.

Please see a screenshot illustrating the issue.

I did not notice any mentions in the release logs related with Xiaomi devices so it might be a defect ?

What version of Home Assistant Core has the issue?

2022.3.0

What was the last working version of Home Assistant Core?

2022.2.9

What type of installation are you running?

Home Assistant OS

Integration causing the issue

xiaomi_miio

Link to integration documentation on our website

https://www.home-assistant.io/integrations/xiaomi_miio/

Diagnostics information

image

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

Hey there @rytilahti, @syssi, @starkillerog, @bieniu, mind taking a look at this issue as it has been labeled with an integration (xiaomi_miio) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


xiaomi_miio documentation xiaomi_miio source (message by IssueLinks)

rursache commented 2 years ago

same issue as here https://github.com/home-assistant/core/issues/67503

sgurgul commented 2 years ago

same issue as here #67503

In what meaning is it the same ? I don't have any problem to setup the integration for 3H. Nor any errors in the log.

Just AQI results reported by the sensor are behaving very different than before the update.

yannpub commented 2 years ago

FYI, my 3C (before the integration got broken by the update) was reporting every 10 minutes. In regard to your screenshot, previous reporting every hour seems a bit too long, but the new behavior seems to be a bit agressive

rytilahti commented 2 years ago

This upstream PR changed the behavior to request a refresh from the sensor just before an update (https://github.com/rytilahti/python-miio/pull/1282), causing it to update more regularly (i.e., every time it gets polled).

I have no idea why the reported values would deviate that much in short time periods.. I have no idea how aqi works, so is it completely out of question that the device is reporting the values correctly? One possibility could be that the device itself smoothens the output for the given reporting period, avoiding those misreads..

yannpub commented 2 years ago
image

Here is a screenshot for a 3C. When the purifier is stopped, polling happens every 10 minutes. When in activated mode, values are refreshed more often. Maybe that is why more spikes appear.

mouth4war commented 2 years ago

@rytilahti Can this behavior be configurable and default behavior be previous smoothened version with AQI heartbeat off?

Smoothened version is better for automation triggers. Its like applying a filter on the noisy AQI data. I think Xiaomi did this for good reason. The hardware sensor is noisy at low AQIs.

rytilahti commented 2 years ago

@mouth4war so most of the python-miio does not currently do caching nor smoothing, so I'm not sure what'd be the best approach here. I've seen a comment at upstream issue tracker that accurate reading as reported by the device (and then filtering out outliers by themselves) is better than being "capped" to less regular, also sometimes incorrect as seen on the screenshot above, readings.

As I don't really have vested interest here, I'm not sure what's the best solution.

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.