rytilahti / python-miio

Python library & console tool for controlling Xiaomi smart appliances
https://python-miio.readthedocs.io
GNU General Public License v3.0
3.54k stars 543 forks source link

Roborock S5 Max integration is not working properly #1635

Open grkhr opened 1 year ago

grkhr commented 1 year ago

Describe the bug Roborock S5 max (roborock.s5e) not working properly. See the logs.

Version information (please complete the following information):

Device information: If the issue is specific to a device [Use miiocli device --ip <ip address> --token <token> info]:

To Reproduce Steps to reproduce the behavior:

  1. get the token from miiocli cloud list
  2. mirobo discover to make sure that the device exists in the network
  3. mirobo --ip ip --token token info

Console output

>>> miiocli cloud list
...
Model: roborock.vacuum.s5e
Token: 61444c7037594f4e6872335254707534
IP: 192.168.31.155
...
>>> mirobo --debug discover
INFO:miio.integrations.vacuum.roborock.vacuum_cli:Debug mode active
INFO:miio.discovery:Discovering devices with mDNS for 5 seconds...
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:miio.discovery:Found a supported 'roborock-vacuum-s5e_miio415891557._miio._udp.local.', using 'RoborockVacuum' class
DEBUG: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\x18\xca\x00ec\xaa\xef\xd7' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('18ca0065')
            ts = 2022-12-27 13:15:03
        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)
DEBUG:miio.miioprotocol:Discovered 18ca0065 with ts: 2022-12-27 13:15:03, token: b'ffffffffffffffffffffffffffffffff'
INFO:miio.discovery:Found a supported 'RoborockVacuum' at 192.168.31.155 - token: ffffffffffffffffffffffffffffffff
>>> mirobo --debug --ip=192.168.31.155 --token=61444c7037594f4e6872335254707534 info
INFO:miio.integrations.vacuum.roborock.vacuum_cli:Debug mode active
DEBUG:miio.integrations.vacuum.roborock.vacuum_cli:Using config: {'seq': 1, 'manual_seq': 0}
DEBUG:miio.integrations.vacuum.roborock.vacuum_cli:Connecting to 192.168.31.155 with token 61444c7037594f4e6872335254707534
DEBUG: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\x18\xca\x00ec\xaa\xf0,' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('18ca0065')
            ts = 2022-12-27 13:16:28
        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)
DEBUG:miio.miioprotocol:Discovered 18ca0065 with ts: 2022-12-27 13:16:28, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.31.155:54321 >>: {'id': 2, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:Retrying with incremented id, retries left: 3
DEBUG: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\x18\xca\x00ec\xaa\xf01' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('18ca0065')
            ts = 2022-12-27 13:16:33
        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)
DEBUG:miio.miioprotocol:Discovered 18ca0065 with ts: 2022-12-27 13:16:33, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.31.155:54321 >>: {'id': 103, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:Retrying with incremented id, retries left: 2
DEBUG: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\x18\xca\x00ec\xaa\xf06' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('18ca0065')
            ts = 2022-12-27 13:16:38
        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)
DEBUG:miio.miioprotocol:Discovered 18ca0065 with ts: 2022-12-27 13:16:38, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.31.155:54321 >>: {'id': 204, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:Retrying with incremented id, retries left: 1
DEBUG: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\x18\xca\x00ec\xaa\xf0;' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('18ca0065')
            ts = 2022-12-27 13:16:43
        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)
DEBUG:miio.miioprotocol:Discovered 18ca0065 with ts: 2022-12-27 13:16:43, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.31.155:54321 >>: {'id': 305, 'method': 'miIO.info', 'params': []}
ERROR:miio.miioprotocol:Got error when receiving: timed out
DEBUG:miio.click_common:Exception: No response from the device
Traceback (most recent call last):
  File "/home/eg/.local/lib/python3.9/site-packages/miio/miioprotocol.py", line 193, in send
    data, addr = s.recvfrom(4096)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/eg/.local/lib/python3.9/site-packages/miio/miioprotocol.py", line 193, in send
    data, addr = s.recvfrom(4096)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/eg/.local/lib/python3.9/site-packages/miio/miioprotocol.py", line 193, in send
    data, addr = s.recvfrom(4096)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/eg/.local/lib/python3.9/site-packages/miio/miioprotocol.py", line 193, in send
    data, addr = s.recvfrom(4096)
socket.timeout: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/eg/.local/lib/python3.9/site-packages/miio/click_common.py", line 51, in __call__
    return self.main(*args, **kwargs)
  File "/home/eg/.local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/eg/.local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/eg/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/eg/.local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/eg/.local/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/eg/.local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/eg/.local/lib/python3.9/site-packages/miio/integrations/vacuum/roborock/vacuum_cli.py", line 431, in info
    res = vac.info()
  File "/home/eg/.local/lib/python3.9/site-packages/miio/click_common.py", line 185, in _wrap
    return func(self, *args, **kwargs)
  File "/home/eg/.local/lib/python3.9/site-packages/miio/device.py", line 127, in info
    return self._fetch_info()
  File "/home/eg/.local/lib/python3.9/site-packages/miio/integrations/vacuum/roborock/vacuum.py", line 260, in _fetch_info
    info = super()._fetch_info()
  File "/home/eg/.local/lib/python3.9/site-packages/miio/device.py", line 132, in _fetch_info
    devinfo = DeviceInfo(self.send("miIO.info"))
  File "/home/eg/.local/lib/python3.9/site-packages/miio/device.py", line 86, in send
    return self._protocol.send(
  File "/home/eg/.local/lib/python3.9/site-packages/miio/miioprotocol.py", line 233, in send
    return self.send(
  File "/home/eg/.local/lib/python3.9/site-packages/miio/miioprotocol.py", line 233, in send
    return self.send(
  File "/home/eg/.local/lib/python3.9/site-packages/miio/miioprotocol.py", line 233, in send
    return self.send(
  File "/home/eg/.local/lib/python3.9/site-packages/miio/miioprotocol.py", line 241, in send
    raise DeviceException("No response from the device") from ex
miio.exceptions.DeviceException: No response from the device
Error: No response from the device
rytilahti commented 1 year ago

The error just means that the device did not respond to the request. If your vacuum is disconnected from the cloud, could you try if other commands work?

grkhr commented 1 year ago

@rytilahti Do you mean Xiaomi Cloud?

rytilahti commented 1 year ago

@grkhr yes, some devices are known to become unresponsive when they have no connection to the cloud, some other known issues can be found at https://python-miio.readthedocs.io/en/latest/troubleshooting.html . Generally speaking, these errors can be really hard to debug without accessing the device by rooting it and looking into the logs what is happening.

grkhr commented 1 year ago

@rytilahti Got you. But this device is connected to the cloud and the control is working perfectly via mobile app. I'll try to reset it a bit later, may be it will help.

niltonvasques commented 1 month ago

Same issue happening here!

root@b80231cbdc3c:/# miiocli -d roborockvacuum --model roborock.vacuum.s5 --ip 10.75.0.208 --token ************************  info                                      
INFO:miio.cli:Debug mode active                                                                                                                                               
DEBUG: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\x0f\x9d\x90\x82fU\x83\x91' (total 16)                                                                                                
        value = Container:                                                                                                                                                    
            length = 32                                                                                                                                                       
            unknown = 0                                                                                                                                                       
            device_id = unhexlify('0f9d9082')                                                                                                                                 
            ts = 2024-05-28 07:11:13                                                                                                                                          
        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)                                                                                 
DEBUG:miio.miioprotocol:Discovered 0f9d9082 with ts: 2024-05-28 07:11:13, token: b'ffffffffffffffffffffffffffffffff'                                                          
DEBUG:miio.miioprotocol:10.75.0.208:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}                                                                                  
DEBUG:miio.miioprotocol:Retrying with incremented id, retries left: 3 

# ....

ERROR:miio.miioprotocol:Got error when receiving: timed out
DEBUG:miio.click_common:Exception: No response from the device
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/miio/miioprotocol.py", line 193, in send 
    data, addr = s.recvfrom(4096)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/miio/miioprotocol.py", line 193, in send 
    data, addr = s.recvfrom(4096)
socket.timeout: timed out                                                                                                       

tcpdump:

04:17:26.102069 IP 10.75.0.1.59939 > 10.75.0.208.54321: UDP, length 32
04:17:26.102117 IP 10.75.0.1.59939 > 10.75.0.208.54321: UDP, length 32
04:17:26.102142 IP 10.75.0.1.59939 > 10.75.0.208.54321: UDP, length 32
04:17:26.104279 IP 10.75.0.208.54321 > 10.75.0.1.59939: UDP, length 32
04:17:26.104365 IP 10.75.0.208.54321 > 10.75.0.1.59939: UDP, length 32
04:17:26.105072 IP 10.75.0.208.54321 > 10.75.0.1.59939: UDP, length 32
04:17:26.107518 IP 10.75.0.1.46166 > 10.75.0.208.54321: UDP, length 96