Xiaomi Humidifier

Hi,

I have installed the Xiaomi component for my humidifier. I have entered the token that I found on my Android but it does not work. HA says the device is unavailable and it is turning it off every 5 min or so (I suppose that’s the pinging interval).

Here is my log:

019-08-10 22:24:26 INFO (MainThread) [homeassistant.components.xiaomi_miio.fan] Initializing with host 192.168.2.162 (token 10787…)
2019-08-10 22:24:26 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b’’
2019-08-10 22:24:26 DEBUG (MainThread) [miio.device] 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\xf7vX\x00\x00\x9b(’ (total 16)
value = Container:
length = 32
unknown = 0
device_id = b’\x07\xf7vX’ (total 4)
ts = 1970-01-01 11:02:00
offset1 = 0
offset2 = 16
length = 16
checksum = b’\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00’ (total 16)
2019-08-10 22:24:26 DEBUG (MainThread) [miio.device] Discovered 07f77658 with ts: 1970-01-01 11:02:00, token: b’00000000000000000000000000000000’
2019-08-10 22:24:26 DEBUG (MainThread) [miio.device] 192.168.2.162:54321 >>: {‘id’: 1, ‘method’: ‘miIO.info’, ‘params’: []}
2019-08-10 22:24:26 DEBUG (MainThread) [miio.device] 192.168.2.162:54321 (ts: 1970-01-01 11:02:00, id: 1) << {‘result’: {‘life’: 39720, ‘token’: '1redacted’, ‘mac’: ‘Redacted’, ‘fw_ver’: ‘1.6.3’, ‘hw_ver’: ‘MTK7697’, ‘uid’: ‘6230905645’, ‘model’: ‘zhimi.humidifier.cb1’, ‘mcu_fw_ver’: ‘1001’, ‘wifi_fw_ver’: ‘20180702211408’, ‘config_type’: ‘app’, ‘ap’: {‘rssi’: -32, ‘ssid’: ‘Sky-Net’, ‘bssid’: ‘redacted’}, ‘netif’: {‘localIp’: ‘192.168.2.162’, ‘mask’: ‘255.255.255.0’, ‘gw’: ‘192.168.2.1’, ‘gw_mac’: ‘redacted’}, ‘mmfree’: 63712}, ‘id’: 1}
2019-08-10 22:24:26 INFO (MainThread) [homeassistant.components.xiaomi_miio.fan] zhimi.humidifier.cb1 1.6.3 MTK7697 detected
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_buzzer_on>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_buzzer_off>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_led_on>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_led_off>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_child_lock_on>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_child_lock_off>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_auto_detect_on>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_auto_detect_off>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_learn_mode_on>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_learn_mode_off>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_reset_filter>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_led_brightness>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_favorite_level>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_volume>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_extra_features>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_target_humidity>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_dry_on>
2019-08-10 22:24:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=fan, service=xiaomi_miio_set_dry_off>

Any help appreciated!

Maybe the token is not valid. You can only see a valid token if you use an old version of Mi Home app on Android (I don’t remember exactly which version number). But newer than a specific version doesn’t show the correct token.

The token is valid. Otherwise the humidifier wouldn’t turn off. I use an old version of the android app to get the token in the log file.

mine started working without a hitch once I’ve enabled 802.11b/g/n (auto) instead of just 802.11n which has the highest speed… presumably these humidifiers as well as other smart home devices are made to work on lower speeds like b and g so having your router set on auto allows them to select their most convenient mode.