Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No air quality value when aqi is 1 #958

Closed
exelban opened this issue Feb 27, 2021 · 12 comments · Fixed by #1007
Closed

No air quality value when aqi is 1 #958

exelban opened this issue Feb 27, 2021 · 12 comments · Fixed by #1007
Labels

Comments

@exelban
Copy link

exelban commented Feb 27, 2021

Hi.
I'm trying to get air quality from my Xiaomi Air purifier 3C.
And from time to time I see None value in the aqi. I figured out that it's happening when aqi==1.

The reason is in this if:

@property
def aqi(self) -> int:
"""Air quality index."""
# zhimi-airpurifier-mb3 returns 1 as AQI value if the measurement was
# unsuccessful
if self.data["aqi"] == 1:
return None
return self.data["aqi"]

PR #930

Does zhimi.airpurifier.mb4 (and any non zhimi-airpurifier-mb3) return 1 when the air quality read was unsuccessful?

Mi Home shows pm2.5==1. So I suppose for my model zhimi.airpurifier.mb4 1 it's a normal read.

Device information:

  • Model: Xiaomi Air purifier 3C (zhimi.airpurifier.mb4)
@exelban exelban added the bug label Feb 27, 2021
@rytilahti
Copy link
Owner

If you are using homeassistant, check out the historical graph to see if it makes sense that it would be 1. Otherwise, save the data over some time period on see if the values make sense. In the screenshot in #925 you can clearly see that the 1 is not a real measurement.

@exelban
Copy link
Author

exelban commented Feb 28, 2021

Thanks for the response.
I'm not using homeassistant. I will try to collect the data and share the results.
I spend a few days playing with python-miio and this purifier. And pretty sure that 1 is a normal read for this model.

@nefsolive
Copy link

@exelban i see the same, 1 ppm! You are using domoticz?
Sometimes i see 0 ppm and 1ppm!
Did you still have this values? Im using 3C too.

@exelban
Copy link
Author

exelban commented Mar 30, 2021

Hi. Nope, I do not use any solution (HA or domoticz). I have my own scripts.
I save data from last week in the influx. And there is a chart of aqi.
Zrzut ekranu 2021-03-30 o 20 29 08

Truly, It does not look like 1 is an unsuccessful read. Because the chart looks quite normal. There were a few drops to 1. But also a few to 3 or 4. PS: read every 30 min.

I will increase sampling to 1 min for next week. And share the result after.

@nefsolive
Copy link

Thank u for share the results!
On domoticz i just see the value 1ppm on graph, but it as soon for a test, i just install plugin about 5 days ago and few houres day take ON!
Maybe its normal 1, but i need more time for make sure!

@rytilahti
Copy link
Owner

Looking at that graph, to me it seems very suspicious that the AQI is first around 15-20 and suddenly drops near to zero for a single measurement (around the third timestamp label) and continues to raise afterwards. Likewise the long period of near zero between 5th and 6th looks odd when considering the whole time series, but I don't really know how AQI gets calculated so... Are those values reasonable? Is the environment changing for those lower measurements suddenly (e.g., open window or some other reason why the air quality would improve just for a while)?

@harry-xm
Copy link

harry-xm commented Apr 5, 2021

I have a zhimi-airpurifier-ma4 model device, and I can attest that 1 is a valid aqi value on its OLED display.

@exelban
Copy link
Author

exelban commented Apr 5, 2021

Yeap, I see 1 aqi on the led screen too.

@sgurgul
Copy link

sgurgul commented Apr 8, 2021

I can only confirm. Real (measured) AQI=1 gives no results which seems to be incorrect. LED on the devices shows 1.
When I imitated the pollution and the meaure rised up the value started to be properly reported.

@bieniu
Copy link
Contributor

bieniu commented Apr 8, 2021

So maybe the best solution for this issue is to cache the AQI value and return the old value if the new value is significantly smaller than the old value?

@rytilahti
Copy link
Owner

Or simply revert it back to return 1, if 1 is definitely a valid value. Note, that even if the device is showing it as 1 it doesn't mean that the real AQI is 1 (maybe also buggy firmware not ignoring the incorrect measurements)? The previous assumption was that the 1 would be used for in-band signaling on incorrect reads, but that may not be true.

Anyway, as I mentioned earlier, I don't know how exactly it is measured, so I cannot really judge on that more than saying that those drops to 1 in the graph do not look normal to me.

@sgurgul
Copy link

sgurgul commented Apr 8, 2021

There are two different "1" values

One is a single unexpected value - a peak on the graph. These seems to be common for 3* models happening from time to time.
If it's hard to recognize "unexpected" factor than maybe a first occuring 1 could be just ignored - previous measured value to be returned instead. The outcome will be just a minor delay in measurements update.

Another is a long-lasting 1 - a normal measure returned easily for hours in a clean air environment.
I own two 3* purifiers and I have never observed such long "1" values happening in any different case (like a firmware failure or any other error). It's just clean air - luckily it happens from time to time so it's rather bad that the output from library is None in such case.

rytilahti added a commit that referenced this issue May 5, 2021
[Full Changelog](0.5.5.2...0.5.6)

**Implemented enhancements:**

- RFC: Add a script to simplify finding supported properties for miio [\#919](#919)
- Improve test\_properties output [\#1024](#1024) ([rytilahti](https://github.com/rytilahti))
- Relax zeroconf version requirement [\#1023](#1023) ([rytilahti](https://github.com/rytilahti))
- Add test\_properties command to device class [\#1014](#1014) ([rytilahti](https://github.com/rytilahti))
- Add discover command to miiocli [\#1013](#1013) ([rytilahti](https://github.com/rytilahti))
- Fix supported oscillation angles of the dmaker.fan.p9 [\#1011](#1011) ([syssi](https://github.com/syssi))
- Add additional operation mode of the deerma.humidifier.jsq1 [\#1010](#1010) ([syssi](https://github.com/syssi))
- Roborock S7: Parse history details returned as dict [\#1006](#1006) ([fettlaus](https://github.com/fettlaus))

**Fixed bugs:**

- zeroconf 0.29.0 which is incompatible [\#1022](#1022)
- Remove superfluous decryption failure for handshake responses [\#1008](#1008)
- Skip pausing on Roborock S50 [\#1005](#1005)
- Roborock S7 after Firmware Update 4.1.2-0928 - KeyError [\#1004](#1004)
- No air quality value when aqi is 1 [\#958](#958)
- Fix exception on devices with removed lan\_ctrl [\#1028](#1028) ([Kirmas](https://github.com/Kirmas))
- Fix start bug and improve error handling in walkingpad integration [\#1017](#1017) ([dewgenenny](https://github.com/dewgenenny))
- gateway: fix zigbee lights [\#1016](#1016) ([starkillerOG](https://github.com/starkillerOG))
- Silence unable to decrypt warning for handshake responses [\#1015](#1015) ([rytilahti](https://github.com/rytilahti))
- Fix set\_mode\_and\_speed mode for airdog airpurifier [\#993](#993) ([alexeypetrenko](https://github.com/alexeypetrenko))

**Closed issues:**

- Add Dafang camera \(isa.camera.df3\) support [\#996](#996)
- Roborock S7 [\#989](#989)
- WalkingPad A1 Pro [\#797](#797)

**Merged pull requests:**

- Add basic dmaker.fan.1c support [\#1012](#1012) ([syssi](https://github.com/syssi))
- Always return aqi value \[Revert PR\#930\] [\#1007](#1007) ([bieniu](https://github.com/bieniu))
- Added S6 to skip pause on docking [\#1002](#1002) ([Sian-Lee-SA](https://github.com/Sian-Lee-SA))
- Added number of dust collections to CleaningSummary if available [\#992](#992) ([fettlaus](https://github.com/fettlaus))
- Reformat history data if returned as a dict/Roborock S7 Support \(\#989\) [\#990](#990) ([fettlaus](https://github.com/fettlaus))
- Add support for Walkingpad A1 \(ksmb.walkingpad.v3\) [\#975](#975) ([dewgenenny](https://github.com/dewgenenny))
rytilahti added a commit that referenced this issue May 5, 2021
[Full Changelog](0.5.5.2...0.5.6)

**Implemented enhancements:**

- RFC: Add a script to simplify finding supported properties for miio [\#919](#919)
- Improve test\_properties output [\#1024](#1024) ([rytilahti](https://github.com/rytilahti))
- Relax zeroconf version requirement [\#1023](#1023) ([rytilahti](https://github.com/rytilahti))
- Add test\_properties command to device class [\#1014](#1014) ([rytilahti](https://github.com/rytilahti))
- Add discover command to miiocli [\#1013](#1013) ([rytilahti](https://github.com/rytilahti))
- Fix supported oscillation angles of the dmaker.fan.p9 [\#1011](#1011) ([syssi](https://github.com/syssi))
- Add additional operation mode of the deerma.humidifier.jsq1 [\#1010](#1010) ([syssi](https://github.com/syssi))
- Roborock S7: Parse history details returned as dict [\#1006](#1006) ([fettlaus](https://github.com/fettlaus))

**Fixed bugs:**

- zeroconf 0.29.0 which is incompatible [\#1022](#1022)
- Remove superfluous decryption failure for handshake responses [\#1008](#1008)
- Skip pausing on Roborock S50 [\#1005](#1005)
- Roborock S7 after Firmware Update 4.1.2-0928 - KeyError [\#1004](#1004)
- No air quality value when aqi is 1 [\#958](#958)
- Fix exception on devices with removed lan\_ctrl [\#1028](#1028) ([Kirmas](https://github.com/Kirmas))
- Fix start bug and improve error handling in walkingpad integration [\#1017](#1017) ([dewgenenny](https://github.com/dewgenenny))
- gateway: fix zigbee lights [\#1016](#1016) ([starkillerOG](https://github.com/starkillerOG))
- Silence unable to decrypt warning for handshake responses [\#1015](#1015) ([rytilahti](https://github.com/rytilahti))
- Fix set\_mode\_and\_speed mode for airdog airpurifier [\#993](#993) ([alexeypetrenko](https://github.com/alexeypetrenko))

**Closed issues:**

- Add Dafang camera \(isa.camera.df3\) support [\#996](#996)
- Roborock S7 [\#989](#989)
- WalkingPad A1 Pro [\#797](#797)

**Merged pull requests:**

- Add basic dmaker.fan.1c support [\#1012](#1012) ([syssi](https://github.com/syssi))
- Always return aqi value \[Revert PR\#930\] [\#1007](#1007) ([bieniu](https://github.com/bieniu))
- Added S6 to skip pause on docking [\#1002](#1002) ([Sian-Lee-SA](https://github.com/Sian-Lee-SA))
- Added number of dust collections to CleaningSummary if available [\#992](#992) ([fettlaus](https://github.com/fettlaus))
- Reformat history data if returned as a dict/Roborock S7 Support \(\#989\) [\#990](#990) ([fettlaus](https://github.com/fettlaus))
- Add support for Walkingpad A1 \(ksmb.walkingpad.v3\) [\#975](#975) ([dewgenenny](https://github.com/dewgenenny))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants