core: Miio Xiaomi Air Purifier availability blinking ({'code': -9999, 'message': 'user ack timeout'})
The problem
I have connected my Mi Air Purifier 3H (zhimi.airpurifier.mb3) via Xiaomi Air Purifier integration. This model is specified as a supported one.
However, I’ve noticed it gets offline from time to time, every 30-90 minutes.
If you take a closer look at the history graph, you’ll notice that availability is blinking and eventually it gets unavailable completely every few hours. Only rebooting a router and/or humidifier helps to get it back online.
Environment
- Home Assistant Core release with the issue: 0.111.4 (latest)
- Last working Home Assistant Core release (if known): don’t know
- Operating environment (Home Assistant/Supervised/Docker/venv): Home Assistant
- Integration causing this issue: fan.xiaomi_miio
- Link to integration documentation on our website: https://www.home-assistant.io/integrations/fan.xiaomi_miio/
Problem-relevant configuration.yaml
fan:
- platform: xiaomi_miio
name: purifier
host: !secret purifier_host
token: !secret purifier_token
Traceback/Error logs
2020-06-18 12:12:12 WARNING (MainThread) [homeassistant.components.fan] Platform xiaomi_miio not ready yet. Retrying in 90 seconds.
2020-06-18 12:13:48 ERROR (SyncWorker_3) [miio.miioprotocol] Unable to discover a device at address 192.168.0.188
2020-06-18 12:13:48 WARNING (MainThread) [homeassistant.components.fan] Platform xiaomi_miio not ready yet. Retrying in 120 seconds.
2020-06-18 12:31:38 WARNING (MainThread) [homeassistant.helpers.entity] Update of fan.purifier is taking over 10 seconds
2020-06-18 12:36:17 WARNING (MainThread) [homeassistant.helpers.entity] Update of fan.purifier is taking over 10 seconds
2020-06-18 12:36:17 ERROR (SyncWorker_8) [miio.miioprotocol] Unable to discover a device at address 192.168.0.188
2020-06-18 12:36:17 ERROR (MainThread) [homeassistant.components.xiaomi_miio.fan] Got exception while fetching the state: Unable to discover the device 192.168.0.188
2020-06-18 12:36:43 ERROR (MainThread) [homeassistant.components.xiaomi_miio.fan] Got exception while fetching the state: Unable to discover the device 192.168.0.188
2020-06-18 12:38:46 ERROR (MainThread) [homeassistant.components.xiaomi_miio.fan] Got exception while fetching the state: {'code': -9999, 'message': 'user ack timeout'}
2020-06-18 13:05:03 ERROR (MainThread) [homeassistant.components.xiaomi_miio.fan] Got exception while fetching the state: {'code': -9999, 'message': 'user ack timeout'}
2020-06-18 13:12:16 WARNING (MainThread) [homeassistant.helpers.entity] Update of fan.purifier is taking over 10 seconds
2020-06-18 13:12:16 ERROR (SyncWorker_3) [miio.miioprotocol] Unable to discover a device at address 192.168.0.188
2020-06-18 13:12:16 ERROR (MainThread) [homeassistant.components.xiaomi_miio.fan] Got exception while fetching the state: Unable to discover the device 192.168.0.188
2020-06-18 13:13:47 WARNING (MainThread) [homeassistant.helpers.entity] Update of fan.purifier is taking over 10 seconds
2020-06-18 13:15:51 WARNING (MainThread) [homeassistant.helpers.entity] Update of fan.purifier is taking over 10 seconds
2020-06-18 13:15:51 ERROR (SyncWorker_8) [miio.miioprotocol] Unable to discover a device at address 192.168.0.188
2020-06-18 13:15:51 ERROR (MainThread) [homeassistant.components.xiaomi_miio.fan] Got exception while fetching the state: Unable to discover the device 192.168.0.188
2020-06-18 13:17:23 WARNING (MainThread) [homeassistant.helpers.entity] Update of fan.purifier is taking over 10 seconds
2020-06-18 13:17:23 ERROR (SyncWorker_7) [miio.miioprotocol] Unable to discover a device at address 192.168.0.188
2020-06-18 13:17:23 ERROR (MainThread) [homeassistant.components.xiaomi_miio.fan] Got exception while fetching the state: Unable to discover the device 192.168.0.188
2020-06-18 13:17:23 ERROR (MainThread) [homeassistant.components.google_assistant.http] Request
2020-06-18 13:18:56 ERROR (SyncWorker_1) [miio.miioprotocol] Unable to discover a device at address 192.168.0.188
2020-06-18 13:18:56 ERROR (MainThread) [homeassistant.components.xiaomi_miio.fan] Got exception while fetching the state: Unable to discover the device 192.168.0.188
The most interesting part here (from my point of view):
[homeassistant.components.xiaomi_miio.fan] Got exception while fetching the state: Unable to discover the device 192.168.0.188
[homeassistant.components.xiaomi_miio.fan] Got exception while fetching the state: {'code': -9999, 'message': 'user ack timeout'}
Additional information
Probably I’ve found relevant issues:
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 37 (14 by maintainers)
I’m getting a lot of these too:
Retrying the call with a small timeout and a limit of x retries would probably be a good fix.
Totally Same problem.
I use https://python-miio.readthedocs.io/en/latest/ with an “exec” node (executes a system command)
I increased querying time from 5s to 30s.
I add myself to this thread Using
miiocli device --ip IP --token TOKEN info
It works:Model: zhimi.airpurifier.mb3 Hardware version: esp32 Firmware version: 2.0.5
Using
miiocli airpurifiermiot --ip IP --token TOKEN status
It doesn’t work:Error: {'code': -9999, 'message': 'user ack timeout'}
miiocli, version 0.5.4
Okay, let’s reopen this, but I don’t really know what would be a suitable fix for this. That
{'code': -9999, 'message': 'user ack timeout'}
message is coming from the device itself, so for some reason it fails to execute the called method.On potential way to alleviate this would be either to retry (or ignore it from homeassistant’s side and keep the old state) but it feels a bit hacky solution.
Having bad pings is indicative of the responsiveness of the unit, this will also reflect in its reachability from HA. However I don’t have the issue where I need to restart anything to get it working again. It just doesn’t respond very often.