I have three air purifiers from Xiaomi: one Air Purifier 2 (mini) (zhimi.airpurifier.m1) and two Air Purifier 3 (2019) (zhimi.airpurifier.ma4). All are connected to my home Wi-Fi and accessible in the Mi Home mobile app through the mainland China cloud.
I'm trying to bring them into Home Assistant using the xiaomi_miio fan platform. I have extracted tokens for all three devices from the iOS app following this guide:
https://www.home-assistant.io/integrations/vacuum.xiaomi_miio/#retrieving-the-access-token
The Air Purifier 2 (mini) (zhimi.airpurifier.m1) works, but the Air Purifier 3 (2019) (zhimi.airpurifier.ma4) don't.
From my config.yaml:
```fan:
I have tried setting the model to zhimi.airpurifier.mb3 as well as removing the line entirely. Neither helps.
Attached a debug-lecel log filtered by "miio".
## Environment
<!--
Provide details about the versions you are using, which helps us to reproduce
and find the issue quicker. Version information is found in the
Home Assistant frontend: Developer tools -> Info.
-->
- Home Assistant Core release with the issue: 0.111.4
- Last working Home Assistant Core release (if known):
- Operating environment (Home Assistant/Supervised/Docker/venv): Home Assistant
- Integration causing this issue: Home Assistant
- Link to integration documentation on our website: https://www.home-assistant.io/integrations/fan.xiaomi_miio/
## Problem-relevant `configuration.yaml`
<!--
An example configuration that caused the problem for you. Fill this out even
if it seems unimportant to you. Please be sure to remove personal information
like passwords, private URLs and other credentials.
-->
```fan:
- platform: xiaomi_miio
host: 192.168.2.200 # Living room
token: a743...
model: zhimi.airpurifier.ma4
2020-06-19 01:40:24 INFO (MainThread) [homeassistant.setup] Setting up xiaomi_miio
2020-06-19 01:40:24 INFO (MainThread) [homeassistant.setup] Setup of domain fan took 0.3 seconds.
2020-06-19 01:40:24 INFO (MainThread) [homeassistant.setup] Setup of domain xiaomi_miio took 0.1 seconds.
2020-06-19 01:40:25 INFO (MainThread) [homeassistant.components.fan] Setting up fan.xiaomi_miio
2020-06-19 01:40:25 INFO (MainThread) [homeassistant.components.xiaomi_miio.fan] Initializing with host 192.168.2.200 (token a743c...)
2020-06-19 01:40:25 DEBUG (SyncWorker_7) [miio.miioprotocol] Got a response: Container:
data = Container:
data = b'' (total 0)
value = b'' (total 0)
offset1 = 32
offset2 = 32
length = 0
header = Container:
data = b'!1\x00 \x00\x00\x00\x00\x07\x8a\x05y\x00\x15\xfa\x00' (total 16)
value = Container:
length = 32
unknown = 0
device_id = b'\x07\x8a\x05y' (total 4)
ts = 1970-01-17 16:04:16
offset1 = 0
offset2 = 16
length = 16
checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
2020-06-19 01:40:25 DEBUG (SyncWorker_7) [miio.miioprotocol] Discovered 078a0579 with ts: 1970-01-17 16:04:16, token: b'ffffffffffffffffffffffffffffffff'
2020-06-19 01:40:25 DEBUG (MainThread) [homeassistant.components.xiaomi_miio.config_flow] Not yet supported Xiaomi Miio device 'zhimi-airpurifier-m1_miio54420516._miio._udp.local.' discovered with host 192.168.2.9
2020-06-19 01:40:25 DEBUG (SyncWorker_7) [miio.miioprotocol] 192.168.2.200:54321 >>: {'id': 1, 'method': 'get_properties', 'params': [{'did': 'power', 'siid': 2, 'piid': 2}, {'did': 'fan_level', 'siid': 2, 'piid': 4}, {'did': 'mode', 'siid': 2, 'piid': 5}, {'did': 'humidity', 'siid': 3, 'piid': 7}, {'did': 'temperature', 'siid': 3, 'piid': 8}, {'did': 'aqi', 'siid': 3, 'piid': 6}, {'did': 'filter_life_remaining', 'siid': 4, 'piid': 3}, {'did': 'filter_hours_used', 'siid': 4, 'piid': 5}, {'did': 'buzzer', 'siid': 5, 'piid': 1}, {'did': 'buzzer_volume', 'siid': 5, 'piid': 2}, {'did': 'led_brightness', 'siid': 6, 'piid': 1}, {'did': 'led', 'siid': 6, 'piid': 6}, {'did': 'child_lock', 'siid': 7, 'piid': 1}, {'did': 'favorite_level', 'siid': 10, 'piid': 10}, {'did': 'favorite_rpm', 'siid': 10, 'piid': 7}]}
2020-06-19 01:40:30 DEBUG (SyncWorker_7) [miio.miioprotocol] Retrying with incremented id, retries left: 3
2020-06-19 01:40:30 DEBUG (SyncWorker_7) [miio.miioprotocol] Got a response: Container:
data = Container:
data = b'' (total 0)
value = b'' (total 0)
offset1 = 32
offset2 = 32
length = 0
header = Container:
data = b'!1\x00 \x00\x00\x00\x00\x07\x8a\x05y\x00\x15\xfa\x05' (total 16)
value = Container:
length = 32
unknown = 0
device_id = b'\x07\x8a\x05y' (total 4)
ts = 1970-01-17 16:04:21
offset1 = 0
offset2 = 16
length = 16
checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
More complete log file attached.
xiaomi_miio documentation
xiaomi_miio source
(message by IssueLinks)
Hey there @rytilahti, @syssi, mind taking a look at this issue as its been labeled with a integration (xiaomi_miio) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)
Might be related to #36972 and #36993 as well.
This seems to be caused by this issue: rytilahti/python-miio#730
This looks more like an invalid token than other of those linked issues as the device is responding to the handshake but is not responding anything to the queries. So the linked upstream issue is also not relevant.
@rytilahti The tokens were extracted from the iOS app following this guide:
https://www.home-assistant.io/integrations/vacuum.xiaomi_miio/#retrieving-the-access-token
It works for the Air Purifier 2 (mini) (zhimi.airpurifier.m1) but not for the Air Purifier 3 (2019) (zhimi.airpurifier.ma4).
rytilahti/python-miio#745 fixes this issue.
Most helpful comment
This seems to be caused by this issue: rytilahti/python-miio#730