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

airpurifiermiot: Xiaomi 3H updating PM2.5 sensor only once in 30mins #1281

Closed
Razer0123 opened this issue Jan 5, 2022 · 12 comments · Fixed by #1282
Closed

airpurifiermiot: Xiaomi 3H updating PM2.5 sensor only once in 30mins #1281

Razer0123 opened this issue Jan 5, 2022 · 12 comments · Fixed by #1282
Labels

Comments

@Razer0123
Copy link

Describe the bug
The PM2.5 sensor is updating only once in 30 mins

Version information (please complete the following information):

  • OS: HASSOS
  • python-miio: latest

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

  • Model: Xiaomi Purifer 3h

To Reproduce
Steps to reproduce the behavior:

  1. Use Mio integration

Expected behavior
Refresh every X seconds

Hello, i've been told to post this here, the Xiaomi 3h purifier has an issue that consists in the sensor reporting output only once in 30 mins, a user found a solution and i've been told to post it here

Here is there reference

https://community.home-assistant.io/t/lovelace-xiaomi-mi-air-purifier-3h-card/192100/300

home-assistant/core#63250

@Razer0123 Razer0123 added the bug label Jan 5, 2022
@rytilahti rytilahti changed the title Xiaomi 3H updating PM2.5 sensor only once in 30mins (FIX FOUND) airpurifiermiot: Xiaomi 3H updating PM2.5 sensor only once in 30mins Jan 5, 2022
@rytilahti
Copy link
Owner

One potential solution would be calling to set that property with a short time (e.g., 1 seconds) prior to requesting the data. This way the caller of update() would always get the newest data, and the device would not need to keep polling the sensor internally all the time.

@Razer0123
Copy link
Author

Thanks for helping

Could we test this out? I'm not a developer but I'll do what I can

@rytilahti
Copy link
Owner

@Razer0123 See the linked PR, you could copy the file over to your local installation and try if miiocli airpurifiermiot status gets an updated value on each call :-)

@mak3
Copy link

mak3 commented Jan 6, 2022

I will test it over the day and check if it's stable solution.

One strange thing I noticed.
aqi-updata-heartbeat is decreased every 5 seconds.
For example if we would set 15 seconds and continuously monitor countdown, we will get: 15-10-5-0

If we set 1 second, after 5 seconds API is returning "-4". It looks like device bug, which violates API (minimal value is 0) https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:air-purifier:0000A007:zhimi-mb3:1

I didn't notice any problems related to this, but think safer would be usage of multiplicity of 5, so 5 in this case.

@rytilahti
Copy link
Owner

Thanks for testing @mak3! I adjusted the PR to use 5 seconds now.

@mak3
Copy link

mak3 commented Jan 7, 2022

@rytilahti Fix was on testing for over 40 hours with two 3H devices. I applied it in my Home Assistant environment.
AQI readings were always accurate.

@rytilahti
Copy link
Owner

@mak3 this is with the duration of 1, right? Although I don't think that raising it to 5s changes anything, so I think the PR can be merged now for the next release.

@mak3
Copy link

mak3 commented Jan 7, 2022

Yes, that was with 1 seconds.
I have newest version for few hours, all seems fine.

@Razer0123
Copy link
Author

I want to thank you both, this issue was a pain in the arse

@Razer0123
Copy link
Author

Hello, is this supposed do be fixed in HA 12.9? Because I see no change

@rytilahti
Copy link
Owner

Hi, alas, there has been no releases and I'm afraid I'm able to do one first in the beginning of February.

@Razer0123
Copy link
Author

Ok I'll wait, thanks

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.

3 participants