-
-
Notifications
You must be signed in to change notification settings - Fork 561
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
Filter out value 1 from the property AQI #925
Comments
Could you increase the log level and provide some traffic? Does the device response contain
|
Sure, I'll provide the log. |
In the mean time you could pipe the measurements through the statistics component: |
That's exactly what I do 😁 |
I can confirm, the device sends value
|
So maybe we can change this into this: @property
def aqi(self) -> int:
"""Air quality index."""
return max(self.data["aqi"], 2) |
Hmm.. so the lower bound of the measurements would be |
Yup. Do you have a better solution? |
You could remember the last value(s). If it the previous value is near to |
Maybe AQI = 1 is just in-band signaling for "unable to measure"? In that case, returning |
So we can use somethig like this: @property
def aqi(self) -> int:
"""Air quality index."""
if not self._last_aqi_value:
self._last_aqi_value = self.data["aqi"]
return self.data["aqi"]
if (
self.data["aqi"] == 1
and self._last_aqi_value != 0
and (self._last_aqi_value - self.data["aqi"]) / self._last_aqi_value > 0.9
):
return self._last_aqi_value
self._last_aqi_value = self.data["aqi"]
return self.data["aqi"]
Can we check somewhere if this assumption is true? |
Not really, but assuming the app is not showing that (i.e., it considers it as invalid) and it is always exactly In my opinion the library should be returning |
Is your feature request related to a problem? Please describe.
Currently, the value of the AQI attribute of air purifier in Home Assistant is sometimes set to
1
for a short period of time. The device display never shows these values.Describe the solution you'd like
python-miio
should filter out values<=1
fromaqi
property.Device information:
If the enhancement is device-specific, please include also the following information.
Use
miiocli device --ip <ip address> --token <token>
.zhimi.airpurifier.mb3
esp32
2.1.8
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: