Miio Xiaomi Air Purifier availability blinking

Tags: #<Tag:0x00007f739472a5b0>

I have connected my Mi Air Purifier 3H via Xiaomi Air Purifier integration.

However, I’ve noticed it gets offline from time to time.

If you take a closer look at the history graph, you’ll notice that availability is blinking and eventually it gets unavailable completely. Only rebooting a router helps to get it back online.

At the same time, my humidifier that works over syssi/xiaomi_airpurifier, works fine.

I’ve configured my fans like this:

fan:
  - platform: xiaomi_miio_airpurifier
    name: humidifier
    host: !secret humidifier_host
    token:  !secret humidifier_token
  - platform: xiaomi_miio
    name: purifier
    host: !secret purifier_host
    token: !secret purifier_token

In HA logs I get this:

2020-06-18 12:11:06 ERROR (SyncWorker_11) [miio.miioprotocol] Unable to discover a device at address 192.168.0.188
2020-06-18 12:11:06 WARNING (MainThread) [homeassistant.components.fan] Platform xiaomi_miio not ready yet. Retrying in 60 seconds.
2020-06-18 12:12:12 ERROR (SyncWorker_8) [miio.miioprotocol] Unable to discover a device at address 192.168.0.188
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'}

Maybe I’ve set up it wrong way? Or maybe there’s some instability with integration itself?

I have a same issue, I using Mi Air Purifier 3 (zhimi.airpurifier.ma4)