rytilahti / python-miio

Python library & console tool for controlling Xiaomi smart appliances
https://python-miio.readthedocs.io
GNU General Public License v3.0
3.6k stars 545 forks source link

Reverse change to AQI value polling from air purifier #1387

Open mouth4war opened 2 years ago

mouth4war commented 2 years ago

Describe the bug A recently-merged PR (https://github.com/rytilahti/python-miio/pull/1282) changed the way AQI value is polled from the air purifier by enabling AQI hearbeat to remove manufacturer's smoothening and filters on the hardware-reported values. This enabled real-time raw AQI values to be read at the cost of the filters.

I prefer the filtered AQI data instead as it is much less noisy.

Version information (please complete the following information):

Device information: If the issue is specific to a device [Use miiocli device --ip <ip address> --token <token> info]:

mak3 commented 2 years ago

manufacturer's smoothening and filters

Where did you read that about it? Nobody noticed any smoothening, all readings were just flat for 30 minutes.

Only readings above 40 PM2 could previosly trigger proper reporting. Maybe in China it's fine, but in Europie it's 250% of allowed norm, so it isn't acceptable for automation to react only after 40 PM2.

If you want smoothened results, you should use moving average (ca. 1-5 minutes) and not introduce fake reporitng.

https://www.home-assistant.io/integrations/filter/ -> time_simple_moving_average

mouth4war commented 2 years ago

https://github.com/home-assistant/core/issues/67528

rytilahti commented 2 years ago

So I'm not sure what's the best option here so that's why I haven't responded... I have no device to test, so I'm not sure, for example, what would happen if the value would be adjusted to be 30 or 60? Would this change the update interval to be that? Should it also be done only once during the initialization?

In principle I agree with @mak3 that it would make more sense to give out the reading as reported by the device, and let the downstream smoothen (or filter) the reported values as needed..

Ping @Razer0123 who reported the delayed updates in the first place.