nqkdev/home-assistant-vacuum-styj02ym

Setup of vacuum platform miio2 is taking over 10 seconds

Afinogen opened this issue · 5 comments

I followed all steps from readme
Install 5.4.45 mi home and get token
{"did":"292098235","token":"4750684e3531505452616d7173417871","longitude":"0.00000000","latitude":"0.00000000","name":"R2D2","pid":"0","localip":"192.168.0.101","mac":"44:23:7C:A0:37:B1","ssid":"TP-LINK_7CCAAE","bssid":"E8:94:F6:7C:CA:AE","parent_id":"","parent_model":"","show_mode":1,"model":"dreame.vacuum.mc1808","adminFlag":1,"shareFlag":0,"permitLevel":16,"isOnline":true,"desc":"Устройство в сети ","extra":{"isSetPincode":0,"fw_version":"3.5.8_1059","needVerifyCode":0,"isPasswordEncrypt":0},"uid":4172124617,"pd_id":66181,"password":"","p2p_id":"","rssi":-52,"family_id":0,"reset_flag":0}

But not connect, i have error

2020-09-22 23:12:19 WARNING (MainThread) [homeassistant.components.vacuum] Setup of vacuum platform miio2 is taking over 10 seconds.
2020-09-22 23:12:30 ERROR (SyncWorker_0) [miio.miioprotocol] Got error when receiving: timed out
2020-09-22 23:12:30 WARNING (SyncWorker_0) [custom_components.miio2.vacuum] Got exception while fetching the state: No response from the device
2020-09-22 23:13:00 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.mi_hihi is taking over 10 seconds
2020-09-22 23:13:10 WARNING (MainThread) [homeassistant.components.vacuum] Updating miio2 vacuum took longer than the scheduled update interval 0:00:20
2020-09-22 23:13:10 ERROR (SyncWorker_9) [miio.miioprotocol] Got error when receiving: timed out

And
2020-09-22 23:11:07 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.mi_hihi is taking over 10 seconds
2020-09-22 23:11:07 DEBUG (SyncWorker_9) [miio.miioprotocol] Retrying with incremented id, retries left: 2
2020-09-22 23:11:08 DEBUG (SyncWorker_9) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2020-09-22 23:11:08 DEBUG (SyncWorker_9) [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\x11i\x10\xbb_jZ[' (total 16)
value = Container:
length = 32
unknown = 0
device_id = b'\x11i\x10\xbb' (total 4)
ts = 2020-09-22 20:11:07
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-09-22 23:11:08 DEBUG (SyncWorker_9) [miio.miioprotocol] Discovered 116910bb with ts: 2020-09-22 20:11:07, token: b'ffffffffffffffffffffffffffffffff'
2020-09-22 23:11:08 DEBUG (SyncWorker_9) [miio.miioprotocol] 192.168.0.101:54321 >>: {'id': 1115, 'method': 'get_prop', 'params': ['run_state', 'mode', 'err_state', 'battary_life', 'box_type', 'mop_type', 's_time', 's_area', 'suction_grade', 'water_grade', 'remember_map', 'has_map', 'is_mop', 'has_newmap']}

In console send
$ miiocli viomivacuum --ip 192.168.0.101 --token 4750684e3531505452616d7173417871 info
Model: dreame.vacuum.mc1808
Hardware version: Linux
Firmware version: 3.5.8_1059
Network: {'localIp': '192.168.0.101', 'mask': '255.255.255.0', 'gw': '192.168.0.1'}
AP: {'ssid': 'TP-LINK_7CCAAE', 'bssid': 'E8:94:F6:7C:CA:AE', 'rssi': -51}

How do I get it to work?

v0d0r commented

Out of interest what version of home assistant are you using? My vacuum use to work great with this hack but my SD card died on my HA installation. I had to re-setup today with latest home assistant 0.115.3 and now I get a similar issue to what you are describing.

[homeassistant.components.vacuum] StateVacuumDevice is deprecated, modify MiroboVacuum2 to extend StateVacuumEntity
Sep 25 19:59:39 raspberrypi hass[10627]: 2020-09-25 19:59:39 WARNING (MainThread) [homeassistant.components.vacuum] Setup of vacuum platform miio2 is taking over 10 seconds

v0d0r commented

Out of interest what version of home assistant are you using? My vacuum use to work great with this hack but my SD card died on my HA installation. I had to re-setup today with latest home assistant 0.115.3 and now I get a similar issue to what you are describing.

[homeassistant.components.vacuum] StateVacuumDevice is deprecated, modify MiroboVacuum2 to extend StateVacuumEntity
Sep 25 19:59:39 raspberrypi hass[10627]: 2020-09-25 19:59:39 WARNING (MainThread) [homeassistant.components.vacuum] Setup of vacuum platform miio2 is taking over 10 seconds

I got mine working again. It turns out if was a invalid token. What I did this time around was as follows:
Do not reset the device to re-join the network.
Install Bluestacks on a windows pc on the same network
Install MiHome https://www.apkmirror.com/apk/xiaomi-inc/mihome/mihome-5-4-45-release/
Insert my MiHome user and password and selected other location. It picked up my vacuum.
Look in the Smarthomes folder logs noted down the token and used that. Now it works.

I got mine working again. It turns out if was a invalid token. What I did this time around was as follows:
Do not reset the device to re-join the network.
Install Bluestacks on a windows pc on the same network
Install MiHome https://www.apkmirror.com/apk/xiaomi-inc/mihome/mihome-5-4-45-release/
Insert my MiHome user and password and selected other location. It picked up my vacuum.
Look in the Smarthomes folder logs noted down the token and used that. Now it works.

My token hasn't changed (
If the token is not valid, the info command returns an error

I used to experience that as well, but after bumping version of python-miio it works fine.

Awaiting approval #34

On 2022.8.7 i had to use python-miio==0.5.12. Before that the vaccum was unavailable and i also got the error "Got error when receiving: timed out". After changing and restarting it worked. Further #56 had to be implemented locally.