Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues adding roborock s50 vacuum to HA and controlling from mirobo #456

Closed
browntownington opened this issue Jan 15, 2019 · 4 comments
Closed

Comments

@browntownington
Copy link

I've read through all the known issues and literature I could find on the internet and I'm still struggling to get roborock v2 s50 working in home assistant or with python-miio.

I've used various token extraction techniques and the token is correct.

Using 'mirobo' some informational commands work:

C:\Users\brownmat>mirobo --ip 192.168.1.61 --token 68694c446d626b73433176447943xxxx status
State: Charging
Battery: 100 %
Fanspeed: 60 %
Cleaning since: 0:00:00
Cleaned area: 0.0 m²
C:\Users\brownmat>mirobo --ip 192.168.1.61 --token 68694c446d626b73433176447943xxxx serial-number
Serial#: R0026S8260xxxx

Other control based commands do not:

C:\Users\brownmat>mirobo --ip 192.168.1.61 --token 68694c446d626b734331764479435134 start
ERROR:miio.device:Got error when receiving: timed out
Error: No response from the device

C:\Users\brownmat>mirobo --ip 192.168.1.61 --token 68694c446d626b734331764479435134 spot
ERROR:miio.device:Got error when receiving: timed out
Error: No response from the device

C:\Users\brownmat>mirobo --ip 192.168.1.61 --token 68694c446d626b734331764479435134 home
ERROR:miio.device:Got error when receiving: timed out
Error: No response from the device

I don't understand why some of the commands work but not others?

Now home assistant also has issues. After adding parameters to configuration.yaml the device won't show up and there are errors in the log. Namely the errors are:

2019-01-14 23:54:59 ERROR (MainThread) [homeassistant.components.vacuum] Error while setting up platform xiaomi_miio
ValueError: non-hexadecimal number found in fromhex() arg at position 29

2019-01-14 23:55:06 ERROR (MainThread) [homeassistant.components.vacuum] xiaomi_miio: Error on device update!
IndexError: pop from empty list

The token is correct as I have been able to use mirobo in python to read some information?

vacuum:
  - platform: xiaomi_miio
    host: 192.168.1.61
    token: 68694c446d626b73433176447943xxxx
    name: RoboRover
2019-01-14 23:54:37 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
2019-01-14 23:54:37 WARNING (MainThread) [homeassistant.setup] Setup of frontend is taking over 10 seconds.
2019-01-14 23:54:38 WARNING (MainThread) [homeassistant.loader] You are using a custom component for climate.xiaomi_miio which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-01-14 23:54:58 WARNING (MainThread) [homeassistant.components.sensor] Setup of platform yr is taking over 10 seconds.
2019-01-14 23:54:58 WARNING (MainThread) [homeassistant.setup] Setup of config is taking over 10 seconds.
2019-01-14 23:54:58 ERROR (MainThread) [homeassistant.components.sensor.yr] Retrying in 19 minutes: 
2019-01-14 23:54:59 ERROR (MainThread) [homeassistant.components.vacuum] Error while setting up platform xiaomi_miio
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/vacuum/xiaomi_miio.py", line 122, in async_setup_platform
    vacuum = Vacuum(host, token)
  File "/usr/local/lib/python3.6/site-packages/miio/vacuum.py", line 47, in __init__
    super().__init__(ip, token, start_id, debug)
  File "/usr/local/lib/python3.6/site-packages/miio/device.py", line 130, in __init__
    self.token = bytes.fromhex(token)
ValueError: non-hexadecimal number found in fromhex() arg at position 29
2019-01-14 23:55:01 WARNING (MainThread) [homeassistant.components.vacuum] Setup of platform xiaomi_miio is taking over 10 seconds.
2019-01-14 23:55:01 DEBUG (SyncWorker_1) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2019-01-14 23:55:02 DEBUG (SyncWorker_1) [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\x05\xc3\x15\x7f\\<\x86\xa5' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = b'\x05\xc3\x15\x7f' (total 4)
            ts = 2019-01-14 12:55:01
        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)
2019-01-14 23:55:02 DEBUG (SyncWorker_1) [miio.device] Discovered 05c3157f with ts: 2019-01-14 12:55:01, token: b'ffffffffffffffffffffffffffffffff'
2019-01-14 23:55:03 INFO (MainThread) [custom_components.climate.xiaomi_miio] Initializing with host 192.168.1.77 (token 37df3...)
2019-01-14 23:55:03 DEBUG (MainThread) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2019-01-14 23:55:03 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\x05\x97\x1e\xe2\x00\x01t\x91' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = b'\x05\x97\x1e\xe2' (total 4)
            ts = 1970-01-02 02:29:37
        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-01-14 23:55:03 DEBUG (MainThread) [miio.device] Discovered 05971ee2 with ts: 1970-01-02 02:29:37, token: b'00000000000000000000000000000000'
2019-01-14 23:55:05 DEBUG (MainThread) [miio.device] 192.168.1.77:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
2019-01-14 23:55:05 DEBUG (SyncWorker_1) [miio.device] 192.168.1.61:54321 >>: {'id': 1, 'method': 'get_status', 'params': []}
2019-01-14 23:55:05 DEBUG (MainThread) [miio.device] 192.168.1.77:54321 (ts: 1970-01-02 02:29:39, id: 1) << {'result': {'life': 95379, 'cfg_time': 0, 'token': '37df3393013a424762038be66f444df7', 'mac': '7C:49:EB:81:94:B5', 'fw_ver': '1.4.1_147', 'hw_ver': 'MW300', 'model': 'lumi.acpartner.v2', 'mcu_fw_ver': '0148', 'wifi_fw_ver': 'SD878x-14.76.36.p84-702.1.0-WM', 'ap': {'rssi': -44, 'ssid': 'MyRepublic 7801', 'bssid': '10:13:31:57:78:01'}, 'netif': {'localIp': '192.168.1.77', 'mask': '255.255.255.0', 'gw': '192.168.1.1', 'gw_mac': '10:13:31:57:78:00'}, 'mmfree': 152552, 'ot': 'ott', 'otu_stat': [296, 302, 132, 5, 126, 1317], 'ott_stat': [2, 0, 1647, 333]}, 'id': 1}
2019-01-14 23:55:05 INFO (MainThread) [custom_components.climate.xiaomi_miio] lumi.acpartner.v2 1.4.1_147 MW300 detected
2019-01-14 23:55:05 DEBUG (SyncWorker_1) [miio.device] 192.168.1.61:54321 (ts: 2019-01-14 12:55:05, id: 1) << {'result': [{'msg_ver': 2, 'msg_seq': 9, 'state': 8, 'battery': 100, 'clean_time': 0, 'clean_area': 0, 'error_code': 0, 'map_present': 1, 'in_cleaning': 0, 'in_returning': 0, 'in_fresh_state': 1, 'lab_status': 0, 'fan_power': 60, 'dnd_enabled': 1}], 'id': 1}
2019-01-14 23:55:06 DEBUG (SyncWorker_1) [miio.device] 192.168.1.61:54321 >>: {'id': 2, 'method': 'get_consumable', 'params': []}
2019-01-14 23:55:06 DEBUG (SyncWorker_1) [miio.device] 192.168.1.61:54321 (ts: 2019-01-14 12:55:05, id: 2) << {'result': [{'main_brush_work_time': 222, 'side_brush_work_time': 222, 'filter_work_time': 222, 'sensor_dirty_time': 0}], 'id': 2}
2019-01-14 23:55:06 DEBUG (SyncWorker_1) [miio.device] 192.168.1.61:54321 >>: {'id': 3, 'method': 'get_clean_summary', 'params': []}
2019-01-14 23:55:06 DEBUG (SyncWorker_1) [miio.device] 192.168.1.61:54321 (ts: 2019-01-14 12:55:05, id: 3) << {'result': [0, 0, 0, []], 'id': 3}
2019-01-14 23:55:06 DEBUG (SyncWorker_1) [miio.device] 192.168.1.61:54321 >>: {'id': 4, 'method': 'get_clean_summary', 'params': []}
2019-01-14 23:55:06 DEBUG (SyncWorker_1) [miio.device] 192.168.1.61:54321 (ts: 2019-01-14 12:55:06, id: 4) << {'result': [0, 0, 0, []], 'id': 4}
2019-01-14 23:55:06 DEBUG (SyncWorker_3) [miio.device] 192.168.1.77:54321 >>: {'id': 2, 'method': 'get_model_and_state', 'params': []}
2019-01-14 23:55:06 DEBUG (SyncWorker_3) [miio.device] 192.168.1.77:54321 (ts: 1970-01-02 02:29:40, id: 2) << {'result': ['00000000FFFFFFFF00', '0011101EA0FFFFFFFF', '0'], 'id': 2}
2019-01-14 23:55:06 ERROR (MainThread) [homeassistant.components.vacuum] xiaomi_miio: Error on device update!
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/vacuum/xiaomi_miio.py", line 378, in update
    self.last_clean = self._vacuum.last_clean_details()
  File "/usr/local/lib/python3.6/site-packages/miio/vacuum.py", line 194, in last_clean_details
    last_clean_id = self.clean_history().ids.pop(0)
IndexError: pop from empty list
2019-01-14 23:56:09 DEBUG (SyncWorker_4) [miio.device] 192.168.1.77:54321 >>: {'id': 3, 'method': 'get_model_and_state', 'params': []}
2019-01-14 23:56:14 DEBUG (SyncWorker_4) [miio.device] Retrying with incremented id, retries left: 3
2019-01-14 23:56:14 DEBUG (SyncWorker_4) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2019-01-14 23:56:15 DEBUG (SyncWorker_4) [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\x05\x97\x1e\xe2\x00\x01t\xd9' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = b'\x05\x97\x1e\xe2' (total 4)
            ts = 1970-01-02 02:30:49
        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-01-14 23:56:15 DEBUG (SyncWorker_4) [miio.device] Discovered 05971ee2 with ts: 1970-01-02 02:30:49, token: b'00000000000000000000000000000000'
2019-01-14 23:56:15 DEBUG (SyncWorker_4) [miio.device] 192.168.1.77:54321 >>: {'id': 104, 'method': 'get_model_and_state', 'params': []}
2019-01-14 23:56:15 DEBUG (SyncWorker_4) [miio.device] 192.168.1.77:54321 (ts: 1970-01-02 02:30:49, id: 104) << {'result': ['00000000FFFFFFFF00', '0011101EA0FFFFFFFF', '0'], 'id': 104}
2019-01-14 23:57:10 DEBUG (SyncWorker_2) [miio.device] 192.168.1.77:54321 >>: {'id': 105, 'method': 'get_model_and_state', 'params': []}
2019-01-14 23:57:10 DEBUG (SyncWorker_2) [miio.device] 192.168.1.77:54321 (ts: 1970-01-02 02:31:44, id: 105) << {'result': ['00000000FFFFFFFF00', '0011101EA0FFFFFFFF', '0'], 'id': 105}
2019-01-14 23:58:11 DEBUG (SyncWorker_0) [miio.device] 192.168.1.77:54321 >>: {'id': 106, 'method': 'get_model_and_state', 'params': []}
2019-01-14 23:58:11 DEBUG (SyncWorker_0) [miio.device] 192.168.1.77:54321 (ts: 1970-01-02 02:32:45, id: 106) << {'result': ['00000000FFFFFFFF00', '0011101EA0FFFFFFFF', '0'], 'id': 106}
2019-01-14 23:59:12 DEBUG (SyncWorker_3) [miio.device] 192.168.1.77:54321 >>: {'id': 107, 'method': 'get_model_and_state', 'params': []}
2019-01-14 23:59:12 DEBUG (SyncWorker_3) [miio.device] 192.168.1.77:54321 (ts: 1970-01-02 02:33:46, id: 107) << {'result': ['00000000FFFFFFFF00', '0011101EA0FFFFFFFF', '0'], 'id': 107}
2019-01-15 00:00:12 DEBUG (SyncWorker_1) [miio.device] 192.168.1.77:54321 >>: {'id': 108, 'method': 'get_model_and_state', 'params': []}
2019-01-15 00:00:12 DEBUG (SyncWorker_1) [miio.device] 192.168.1.77:54321 (ts: 1970-01-02 02:34:46, id: 108) << {'result': ['00000000FFFFFFFF00', '0011101EA0FFFFFFFF', '0'], 'id': 108}
2019-01-15 00:01:13 DEBUG (SyncWorker_0) [miio.device] 192.168.1.77:54321 >>: {'id': 109, 'method': 'get_model_and_state', 'params': []}
2019-01-15 00:01:13 DEBUG (SyncWorker_0) [miio.device] 192.168.1.77:54321 (ts: 1970-01-02 02:35:47, id: 109) << {'result': ['00000000FFFFFFFF00', '0011101EA0FFFFFFFF', '0'], 'id': 109}
2019-01-15 00:02:14 DEBUG (SyncWorker_3) [miio.device] 192.168.1.77:54321 >>: {'id': 110, 'method': 'get_model_and_state', 'params': []}
2019-01-15 00:02:19 DEBUG (SyncWorker_3) [miio.device] Retrying with incremented id, retries left: 3
2019-01-15 00:02:19 DEBUG (SyncWorker_3) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2019-01-15 00:02:19 DEBUG (SyncWorker_3) [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\x05\x97\x1e\xe2\x00\x01vF' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = b'\x05\x97\x1e\xe2' (total 4)
            ts = 1970-01-02 02:36:54
        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)

Really appreciate any guidance that could be offered here

@syssi
Copy link
Collaborator

syssi commented Jan 15, 2019

2019-01-14 23:54:59 ERROR (MainThread) [homeassistant.components.vacuum] Error while setting up platform xiaomi_miio
ValueError: non-hexadecimal number found in fromhex() arg at position 29

This line evaluates the token from your configuration. Please check your token twice. Allowed characters are [0-9a-f]. The error is complaining about position 29. Did you use this (68694c446d626b73433176447943xxxx) token by accident instead of this (68694c446d626b734331764479435134) one?

@syssi
Copy link
Collaborator

syssi commented Jan 15, 2019

2019-01-14 23:55:06 ERROR (MainThread) [homeassistant.components.vacuum] xiaomi_miio: Error on device update!
IndexError: pop from empty list

Traceback:

File "/usr/local/lib/python3.6/site-packages/homeassistant/components/vacuum/xiaomi_miio.py", line 378, in update
self.last_clean = self._vacuum.last_clean_details()
File "/usr/local/lib/python3.6/site-packages/miio/vacuum.py", line 194, in last_clean_details
last_clean_id = self.clean_history().ids.pop(0)

Request:

2019-01-14 23:55:06 DEBUG (SyncWorker_1) [miio.device] 192.168.1.61:54321 >>: {'id': 3, 'method': 'get_clean_summary', 'params': []}

Response:

2019-01-14 23:55:06 DEBUG (SyncWorker_1) [miio.device] 192.168.1.61:54321 (ts: 2019-01-14 12:55:05, id: 3) << {'result': [0, 0, 0, []], 'id': 3}

Expected response:

{ "result": [ 174145, 2410150000, 82, [ 1488240000, 1488153600, 1488067200, 1487980800, 1487894400, 1487808000, 1487548800 ] ], "id": 1 }

last_clean_id = self.clean_history().ids.pop(0) should return 1488240000. Your list of IDs is empty. Did you ever cleaned your room? ;-)

@browntownington
Copy link
Author

Hi @syssi I have been using token 68694c446d626b734331764479435134 (I just replaced the last for characters here when posting) so the 29th position would be 68694c446d626b73433176447943[5]134 so it's definitely within hex range.

To answer your second question I've never cleaned my room haha. This is an out of the box install :)

Not sure if it makes a difference but I am using china FW roborock.vacuum.s5 v3.3.9_001710

@browntownington
Copy link
Author

Hi @syssi I decided to completely reset the device again and extract a new token (even though I'd done this a few times prior before posting). This time it's working fully in HA and mirobo! :) :) feel free to close this off. Thanks for everything!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants