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

Force parameters to be an empty list if none is given #408

Merged
merged 2 commits into from
Nov 16, 2018

Conversation

rytilahti
Copy link
Owner

@rytilahti rytilahti commented Nov 10, 2018

This seems to work fine with yeelight and gen1 vacuum,
however, more testing is needed with other devices and/or this change
should only be done for the vacuum.

Fixes #348, #364 and #370.

This seems to work fine with yeelight and gen1 vacuum,
however, more testing is needed with other devices and/or this change
should only be done for the vacuum.

Related to #348 / Xiaowa E352
@coveralls
Copy link

coveralls commented Nov 10, 2018

Coverage Status

Coverage decreased (-0.1%) to 72.821% when pulling 7b73f94 on force_empty_params into a271245 on master.

@syssi
Copy link
Collaborator

syssi commented Nov 11, 2018

Most devices doesn't use parameterless commands:

$ grep -r 'send(' *  | grep -v "\["
miio/cooker.py:        self.send('set_interaction',
miio/airpurifier.py:        return self.send('reset_filter1')
miio/chuangmi_ir.py:        return self.send("miIO.ir_learn", {'key': str(key)})
miio/chuangmi_ir.py:        return self.send("miIO.ir_read", {'key': str(key)})
miio/chuangmi_ir.py:        return self.send("miIO.ir_play",
miio/philips_moonlight.py:        values = self.send(
miio/tests/test_airconditioningcompanion.py:    def send(self, command: str, parameters=None, retry_count=3):
miio/tests/test_airconditioningcompanion.py:        """Overridden send() to return values from `self.return_values`."""
miio/tests/dummies.py:    The basic idea is that the overloaded send() will read a wanted response
miio/tests/dummies.py:    def send(self, command: str, parameters=None, retry_count=3):
miio/tests/dummies.py:        """Overridden send() to return values from `self.return_values`."""
miio/tests/test_wifirepeater.py:    def send(self, command: str, parameters=None, retry_count=3):
miio/tests/test_wifirepeater.py:        """Overridden send() to return values from `self.return_values`."""
miio/philips_eyecare.py:        values = self.send(
miio/vacuum.py:        return self.send("app_start")
miio/vacuum.py:        return self.send("app_stop")
miio/vacuum.py:        return self.send("app_spot")
miio/vacuum.py:        return self.send("app_pause")
miio/vacuum.py:        self.send("app_stop")
miio/vacuum.py:        return self.send("app_charge")
miio/vacuum.py:        return self.send("app_zoned_clean", zones)
miio/vacuum.py:        return self.send("app_rc_start")
miio/vacuum.py:        return self.send("app_rc_end")
miio/vacuum.py:        # return self.send("enable_log_upload")
miio/vacuum.py:        return self.send("get_log_upload_status")
miio/vacuum.py:        return self.send("get_map_v1")
miio/vacuum.py:        return CleaningSummary(self.send("get_clean_summary"))
miio/vacuum.py:        return self.send("set_dnd_timer",
miio/vacuum.py:        return self.send("test_sound_volume")
miio/device.py:    def send(self, command: str, parameters: Any=None, retry_count=3) -> Any:
miio/device.py:                return self.send(command, parameters, retry_count - 1)
miio/device.py:        return self.send(command, parameters)
miio/powerstrip.py:        values = self.send(
miio/airfresh.py:        return self.send('reset_filter1')
miio/wifispeaker.py:        return self.send("power")
miio/wifispeaker.py:        return self.send("toggle")
miio/wifispeaker.py:        return self.send("previous_track")
miio/wifispeaker.py:        return self.send("next_track")
miio/wifispeaker.py:        return self.send("next_channel")
miio/chuangmi_plug.py:        values = self.send(
miio/ceil.py:        values = self.send(
miio/philips_bulb.py:        values = self.send(
miio/yeelight.py:        values = self.send(
miio/yeelight.py:        return self.send("toggle")
miio/yeelight.py:        return self.send("set_default")
miio/waterpurifier.py:        values = self.send(
miio/airqualitymonitor.py:        values = self.send(

Devices with parameterless commands:

miio/airfresh.py:        return self.send('reset_filter1')
miio/airpurifier.py:        return self.send('reset_filter1')
miio/wifispeaker.py:        return self.send("power")
miio/vacuum.py:        return self.send("app_start")
miio/yeelight.py:        return self.send("toggle")

The miio/chuangmi_plug.py can be cleaned with the new empty list default:

$ grep -r 'send(' * | grep '\[]'
miio/cooker.py:        data = self.send('get_temp_history', [])
miio/device.py:        return DeviceInfo(self.send("miIO.info", []))
miio/device.py:        return self.send("miIO.get_ota_progress", [])[0]
miio/device.py:        return UpdateState(self.send("miIO.get_ota_state", [])[0])
miio/chuangmi_plug.py:            load_power = self.send("get_power", [])  # Response: [300]
miio/chuangmi_plug.py:            return self.send("set_on", [])
miio/chuangmi_plug.py:            return self.send("set_off", [])
miio/chuangmi_plug.py:        return self.send("set_usb_on", [])
miio/chuangmi_plug.py:        return self.send("set_usb_off", [])
miio/wifirepeater.py:        return WifiRepeaterStatus(self.send("miIO.get_repeater_sta_info", []))
miio/wifirepeater.py:            self.send("miIO.get_repeater_ap_info", []))
miio/airconditioningcompanion.py:        status = self.send("get_model_and_state", [])
miio/airconditioningcompanion.py:        return self.send("get_ir_learn_result", [])

@Luc3as
Copy link

Luc3as commented Nov 11, 2018

You are the MAN 🥇
I tried all commands here are results:
carpet-mode 👌
cleaning-history 👌
configure-wifi looks OK, actually I did not put any parameters to change
consumables 👌
dnd 👌
fanspeed 👌
find 👌
mirobo goto 10 10 🛑

DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00g\x1d' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:19:57
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00g\x1d' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:19:57
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:19:57, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 25, 'method': 'app_goto_target', 'params': [10, 10]}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'*\xdd\x9a\x9a\xff\xf6\x85\x06\xc4|\x11]\x1da\x03\xc4'... (truncated, total 64)
        value = {'id': 25, 'method': 'app_goto_target', 'params': [10, 10]}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00g\x1e' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:19:58
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'8\x8f\x11\x84\x98\x06\xc8{\xe4\x8a\xfd\x80y\x97$\xb1' (total 16)
DEBUG:miio.device:Retrying with incremented id, retries left: 3
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00g"' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:20:02
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00g"' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:20:02
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:20:02, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 126, 'method': 'app_goto_target', 'params': [10, 10]}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\x02\xbf}\x95\xec\x19\xcf!\x15@\x89\x18l\xde\xe6h'... (truncated, total 64)
        value = {'id': 126, 'method': 'app_goto_target', 'params': [10, 10]}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00g#' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:20:03
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'z\xea<\xa2\xe3\xc9I\x01\x10;\x96\xa4\xc8\xea\xacm' (total 16)
DEBUG:miio.device:Retrying with incremented id, retries left: 2
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00g'" (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:20:07
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00g'" (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:20:07
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:20:07, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 227, 'method': 'app_goto_target', 'params': [10, 10]}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\xc0(bH\xa6\xc1\xd12=h;IO\xa1\xf4\xa9'... (truncated, total 64)
        value = {'id': 227, 'method': 'app_goto_target', 'params': [10, 10]}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00g(' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:20:08
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\x11\xb5#|\x005\xb8\xf3\xd1!\x83\xf9\xfb\x06$)' (total 16)
DEBUG:miio.device:Retrying with incremented id, retries left: 1
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00g,' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:20:12
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00g,' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:20:12
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:20:12, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 328, 'method': 'app_goto_target', 'params': [10, 10]}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\xfa[=w\x88I\xac\xf4\xe7\xa7\xdeGD\x9b}\x15'... (truncated, total 64)
        value = {'id': 328, 'method': 'app_goto_target', 'params': [10, 10]}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00g-' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:20:13
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xe3\x85\xfd\xb3\x01\x9e\x1fRSWno\x10\xba2\xc7' (total 16)
ERROR:miio.device:Got error when receiving: timed out
DEBUG:miio.click_common:Exception: No response from the device
Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

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

Traceback (most recent call last):
  File "/root/src/python-miio/miio/click_common.py", line 54, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/src/python-miio/miio/vacuum_cli.py", line 206, in goto
    click.echo("Going to target : %s" % vac.goto(x_coord, y_coord))
  File "/root/src/python-miio/miio/vacuum.py", line 84, in goto
    return self.send("app_goto_target", [x_coord, y_coord])
  File "/root/src/python-miio/miio/device.py", line 288, in send
    return self.send(command, parameters, retry_count - 1)
  File "/root/src/python-miio/miio/device.py", line 288, in send
    return self.send(command, parameters, retry_count - 1)
  File "/root/src/python-miio/miio/device.py", line 288, in send
    return self.send(command, parameters, retry_count - 1)
  File "/root/src/python-miio/miio/device.py", line 291, 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

mirobo home 🛑


DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00gt' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:24
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00gt' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:24
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:21:24, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 25, 'method': 'app_stop', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'*\xdd\x9a\x9a\xff\xf6\x85\x06\xc4|\x11]\x1da\x03\xc4'... (truncated, total 48)
        value = {'id': 25, 'method': 'app_stop', 'params': []}
        offset1 = 32
        offset2 = 80
        length = 48
    header = Container:
        data = b'!1\x00P\x00\x00\x00\x00\x04L\xdar\x00\x00gu' (total 16)
        value = Container:
            length = 80
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:25
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\x18\xbd\xde\xcb\xae\x07\xc4\x88n\xfaH\x1a\xce[DU' (total 16)
DEBUG:miio.device:Retrying with incremented id, retries left: 3
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00gy' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:29
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00gy' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:29
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:21:29, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 126, 'method': 'app_stop', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\x02\xbf}\x95\xec\x19\xcf!\x15@\x89\x18l\xde\xe6h'... (truncated, total 64)
        value = {'id': 126, 'method': 'app_stop', 'params': []}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00gz' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:30
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\x82h5\xef\xb7\xa68{d\x82<\x99\xc9\x9a\x88~' (total 16)
DEBUG:miio.device:Retrying with incremented id, retries left: 2
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00g~' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:34
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00g~' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:34
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:21:34, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 227, 'method': 'app_stop', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\xc0(bH\xa6\xc1\xd12=h;IO\xa1\xf4\xa9'... (truncated, total 64)
        value = {'id': 227, 'method': 'app_stop', 'params': []}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00g\x7f' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:35
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'~\xccb?:75\xa5\x9d\x03ee\x0fII\x08' (total 16)
DEBUG:miio.device:Retrying with incremented id, retries left: 1
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00g\x83' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:39
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00g\x83' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:39
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:21:39, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 328, 'method': 'app_stop', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\xfa[=w\x88I\xac\xf4\xe7\xa7\xdeGD\x9b}\x15'... (truncated, total 64)
        value = {'id': 328, 'method': 'app_stop', 'params': []}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00g\x84' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:21:40
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'J\x97\n\x11\x8e\x8c\xbd\x80\xe1"9\xb10\x08\x90\xb5' (total 16)
ERROR:miio.device:Got error when receiving: timed out
DEBUG:miio.click_common:Exception: No response from the device
Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

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

Traceback (most recent call last):
  File "/root/src/python-miio/miio/click_common.py", line 54, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/src/python-miio/miio/vacuum_cli.py", line 197, in home
    click.echo("Requesting return to home: %s" % vac.home())
  File "/root/src/python-miio/miio/vacuum.py", line 73, in home
    self.send("app_stop")
  File "/root/src/python-miio/miio/device.py", line 288, in send
    return self.send(command, parameters, retry_count - 1)
  File "/root/src/python-miio/miio/device.py", line 288, in send
    return self.send(command, parameters, retry_count - 1)
  File "/root/src/python-miio/miio/device.py", line 288, in send
    return self.send(command, parameters, retry_count - 1)
  File "/root/src/python-miio/miio/device.py", line 291, 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

mirobo install-sound ❓ I did not try this
mirobo manual 👌
mirobo map 🛑 timeout
mirobo pause 👌
mirobo reset-consumable 👌
mirobo serial-number 🛑

DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00ht' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:25:40
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00ht' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:25:40
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:25:40, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 27, 'method': 'get_serial_number', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'f\xf5\t~ Y\xa5\x99#\xb5\xc4|s\xdd\x17\xf2'... (truncated, total 64)
        value = {'id': 27, 'method': 'get_serial_number', 'params': []}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00hu' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:25:41
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b"f\xbcUO\xe1\x80\xf1'\\:\x8e\x80\xc3\xe7\xc5]" (total 16)
DEBUG:miio.device:Retrying with incremented id, retries left: 3
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00hz' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:25:46
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00hz' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:25:46
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:25:46, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 128, 'method': 'get_serial_number', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\xdb\xe3N`\x9d\x02\t\xf5*$\xef\xc38\x97\xc1\xff'... (truncated, total 64)
        value = {'id': 128, 'method': 'get_serial_number', 'params': []}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00h{' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:25:47
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\x86Y4j\x8f\x1e\xd3\xbe\x812\xbc\x00\xd8\xe6\x87L' (total 16)
DEBUG:miio.device:recv from 192.168.1.117: Container:
    data = Container:
        data = b'\xed^2\xe7|)\xb0id\xefw\x91\xee2\xaaH'... (truncated, total 48)
        value = {'result': ['R0112S83700389'], 'id': 128}
        offset1 = 32
        offset2 = 80
        length = 48
    header = Container:
        data = b'!1\x00P\x00\x00\x00\x00\x04L\xdar\x00\x00hz' (total 16)
        value = Container:
            length = 80
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:25:46
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'4\xca\xdaE_\xec\xa7\xd4\x92\x08\xb1\xc61\xe7\xb7\xd2' (total 16)
DEBUG:miio.device:192.168.1.117:54321 (ts: 1970-01-01 07:25:46, id: 128) << {'result': ['R0112S83700389'], 'id': 128}
Traceback (most recent call last):
  File "/usr/local/bin/mirobo", line 11, in <module>
    load_entry_point('python-miio', 'console_scripts', 'mirobo')()
  File "/root/src/python-miio/miio/click_common.py", line 54, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/src/python-miio/miio/vacuum_cli.py", line 505, in serial_number
    click.echo("Serial#: %s" % vac.serial_number())
  File "/root/src/python-miio/miio/vacuum.py", line 363, in serial_number
    return self.send("get_serial_number")[0]["serial_number"]
TypeError: string indices must be integers

mirobo sound 🛑

DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00h\xbe' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:26: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)
DEBUG:miio.device: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\x04L\xdar\x00\x00h\xbe' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:26: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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:26:54, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 27, 'method': 'get_current_sound', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'f\xf5\t~ Y\xa5\x99#\xb5\xc4|s\xdd\x17\xf2'... (truncated, total 64)
        value = {'id': 27, 'method': 'get_current_sound', 'params': []}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00h\xbf' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:26:55
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xa4H\xca\xf3\xc3h\xcau)\xee\x1f*\xc7;&\x8d' (total 16)
DEBUG:miio.device:Retrying with incremented id, retries left: 3
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00h\xc4' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:27: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)
DEBUG:miio.device: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\x04L\xdar\x00\x00h\xc4' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:27: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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:27:00, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 128, 'method': 'get_current_sound', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\xdb\xe3N`\x9d\x02\t\xf5*$\xef\xc38\x97\xc1\xff'... (truncated, total 64)
        value = {'id': 128, 'method': 'get_current_sound', 'params': []}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00h\xc5' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:27:01
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xd7\x06\x9e\xe7j\xd2\xdb\x97]\xd2\xe5\xfd\xec\xda\x90%' (total 16)
DEBUG:miio.device:recv from 192.168.1.117: Container:
    data = Container:
        data = b'\xb6S\x11\x99)\xd0\x87\xf4\x02\x11u\xcc\xb1_\xb0X'... (truncated, total 112)
        value = {'result': [{'sid_in_use': 3, 'sid_version': 1, 'location': 'de', 'language': 'en', 'msg_ver': 8}], 'id': 128}
        offset1 = 32
        offset2 = 144
        length = 112
    header = Container:
        data = b'!1\x00\x90\x00\x00\x00\x00\x04L\xdar\x00\x00h\xc4' (total 16)
        value = Container:
            length = 144
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:27:00
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\x8d>\x14\n6\xd0\xc4\x04V\xccb\xcfS4\x88\x99' (total 16)
DEBUG:miio.device:192.168.1.117:54321 (ts: 1970-01-01 07:27:00, id: 128) << {'result': [{'sid_in_use': 3, 'sid_version': 1, 'location': 'de', 'language': 'en', 'msg_ver': 8}], 'id': 128}
Traceback (most recent call last):
  File "/usr/local/bin/mirobo", line 11, in <module>
    load_entry_point('python-miio', 'console_scripts', 'mirobo')()
  File "/root/src/python-miio/miio/click_common.py", line 54, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/src/python-miio/miio/vacuum_cli.py", line 443, in sound
    click.echo("Current sound: %s" % vac.sound_info())
  File "/root/src/python-miio/miio/vacuumcontainers.py", line 413, in __repr__
    self.being_installed)
  File "/root/src/python-miio/miio/vacuumcontainers.py", line 408, in being_installed
    return self.data['sid_in_progress']
KeyError: 'sid_in_progress'

mirobo spot 👌
mirobo start 👌
mirobo status 👌
mirobo stop 🛑

DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00i;' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:28:59
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00i;' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:28:59
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:28:59, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 29, 'method': 'app_stop', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\xa4\xff\xdba\xca\x82\xc1]\xfc\xc6\xe2\x07txJ#'... (truncated, total 48)
        value = {'id': 29, 'method': 'app_stop', 'params': []}
        offset1 = 32
        offset2 = 80
        length = 48
    header = Container:
        data = b'!1\x00P\x00\x00\x00\x00\x04L\xdar\x00\x00i<' (total 16)
        value = Container:
            length = 80
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:29:00
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\x18\xfe\xc6\xfd\xfb\xa9Q\tH67\xef\xcdB\xbfq' (total 16)
DEBUG:miio.device:Retrying with incremented id, retries left: 3
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00i@' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:29:04
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00i@' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:29:04
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:29:04, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 130, 'method': 'app_stop', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\xf2l\x8d7\x94p#\xc0b\xa0LsU\x1f]?'... (truncated, total 64)
        value = {'id': 130, 'method': 'app_stop', 'params': []}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00iA' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:29:05
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xe2\xd4\x1eK+\x89L\t\xe7\xe3\xf3\xf0\xfd\xc5\xc8>' (total 16)
DEBUG:miio.device:Retrying with incremented id, retries left: 2
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00iE' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:29:09
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00iE' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:29:09
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:29:09, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 231, 'method': 'app_stop', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\xa7>z\x91\x12\xac\xf2U\x1d,&\xe7\xf8D\xcc\x12'... (truncated, total 64)
        value = {'id': 231, 'method': 'app_stop', 'params': []}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00iF' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:29:10
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\x02\xefmO4\xc1@\x18\xcb;\x9f<\r!}\xe4' (total 16)
DEBUG:miio.device:Retrying with incremented id, retries left: 1
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x04L\xdar\x00\x00iJ' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:29:14
        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)
DEBUG:miio.device: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\x04L\xdar\x00\x00iJ' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:29:14
        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)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 07:29:14, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 332, 'method': 'app_stop', 'params': []}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\xd3\xc3\xea\xca\xc3\x8eyr\xee\xdcv\xad>0`w'... (truncated, total 64)
        value = {'id': 332, 'method': 'app_stop', 'params': []}
        offset1 = 32
        offset2 = 96
        length = 64
    header = Container:
        data = b'!1\x00`\x00\x00\x00\x00\x04L\xdar\x00\x00iK' (total 16)
        value = Container:
            length = 96
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 07:29:15
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\x02\x9f\x08\xde!<\xc3\x0b\xe5\x06\xc9\xa2\xdf\xad\xad\xab' (total 16)
ERROR:miio.device:Got error when receiving: timed out
DEBUG:miio.click_common:Exception: No response from the device
Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/src/python-miio/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

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

Traceback (most recent call last):
  File "/root/src/python-miio/miio/click_common.py", line 54, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/src/python-miio/miio/vacuum_cli.py", line 190, in stop
    click.echo("Stop cleaning: %s" % vac.stop())
  File "/root/src/python-miio/miio/vacuum.py", line 58, in stop
    return self.send("app_stop")
  File "/root/src/python-miio/miio/device.py", line 288, in send
    return self.send(command, parameters, retry_count - 1)
  File "/root/src/python-miio/miio/device.py", line 288, in send
    return self.send(command, parameters, retry_count - 1)
  File "/root/src/python-miio/miio/device.py", line 288, in send
    return self.send(command, parameters, retry_count - 1)
  File "/root/src/python-miio/miio/device.py", line 291, 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

mirobo timer 👌
mirobo timezone 👌
mirobo update-firmware ❔ did not try this
mirobo update-status 👌
mirobo zoned-clean ❔ did not know what to pass.

@rytilahti
Copy link
Owner Author

rytilahti commented Nov 11, 2018

Glad to hear it's working, thanks for extensive reporting! Sound and serialnumber seems to have changed their payloads, so that needs a bit adaptation, but is not a big issue. I'm more worried about why some of the commands (esp. stop) do not respond, maybe you executed too many commands in a row and the vacuum refused some of those?

@syssi I'm not sure if this PR should be merged, maybe it'd be safer simply to adapt vacuum to pass an empty list to avoid breaking anything. I just created this PR to make it easier to test if this is the issue on some vacuums :-)

@Luc3as
Copy link

Luc3as commented Nov 11, 2018 via email

@rytilahti
Copy link
Owner Author

Not really, as the device is not responding anything to those requests. Maybe the commands are different for those on your device? Or maybe they expect empty parameter list (then they should work without this PR, though)?

@Luc3as
Copy link

Luc3as commented Nov 11, 2018

I tried different server with mirobo version 0.4.3
command home or stop return the old error message

DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
    data = Container:
        data = b'' (total 0)
        length = 0
        offset1 = 32
        offset2 = 32
        value = b'' (total 0)
    header = Container:
        data = b'!1\x00 \x00\x00\x00\x00\x04L\xdar\x00\x00\xc5\x02' (total 16)
        length = 16
        offset1 = 0
        offset2 = 16
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 14:00:34
    checksum = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' (total 16)
DEBUG:miio.device:Container:
    data = Container:
        data = b'' (total 0)
        length = 0
        offset1 = 32
        offset2 = 32
        value = b'' (total 0)
    header = Container:
        data = b'!1\x00 \x00\x00\x00\x00\x04L\xdar\x00\x00\xc5\x02' (total 16)
        length = 16
        offset1 = 0
        offset2 = 16
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 14:00:34
    checksum = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' (total 16)
DEBUG:miio.device:Discovered 044cda72 with ts: 1970-01-01 14:00:34, token: b'00000000000000000000000000000000'
DEBUG:miio.device:192.168.1.117:54321 >>: {'id': 1, 'method': 'app_stop'}
DEBUG:miio.device:send (timeout 5): Container:
    data = Container:
        data = b'\xa1\x8dz\xf95\xc8\xa4\xb9\xf2\xd0\x91\x1e\xf3\xa3\xacX'... (truncated, total 48)
        length = 48
        offset1 = 32
        offset2 = 80
        value = {'id': 1, 'method': 'app_stop'}
    header = Container:
        data = b'!1\x00P\x00\x00\x00\x00\x04L\xdar\x00\x00\xc5\x03' (total 16)
        length = 16
        offset1 = 0
        offset2 = 16
        value = Container:
            length = 80
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 14:00:35
    checksum = b'\xf1\x01\xf9\xcb\xfa\xcc\xa8\x07\xe2ls\xbcf\x9b)r' (total 16)
DEBUG:miio.device:recv from 192.168.1.117: Container:
    data = Container:
        data = b'\xf2\xe2\xaa\xaf\x9e\xae\xcca\xb7G{\x1f|\x9eM\xd8'... (truncated, total 80)
        length = 80
        offset1 = 32
        offset2 = 112
        value = {'error': {'code': -32600, 'message': 'Req object invalid.'}, 'id': 1}
    header = Container:
        data = b'!1\x00p\x00\x00\x00\x00\x04L\xdar\x00\x00\xc5\x02' (total 16)
        length = 16
        offset1 = 0
        offset2 = 16
        value = Container:
            length = 112
            unknown = 0
            device_id = b'\x04L\xdar' (total 4)
            ts = 1970-01-01 14:00:34
    checksum = b'\xee\xae\xbd\xb1\x9f\xca\x13\xa6\xcdW\x8a\x01\x85,\xd3\x93' (total 16)
DEBUG:miio.device:192.168.1.117:54321 (ts: 1970-01-01 14:00:34, id: 1) << {'error': {'code': -32600, 'message': 'Req object invalid.'}, 'id': 1}
DEBUG:miio.click_common:Exception: {'code': -32600, 'message': 'Req object invalid.'}
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/miio/click_common.py", line 54, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/miio/vacuum_cli.py", line 190, in stop
    click.echo("Stop cleaning: %s" % vac.stop())
  File "/usr/local/lib/python3.5/dist-packages/miio/vacuum.py", line 58, in stop
    return self.send("app_stop")
  File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 270, in send
    raise DeviceError(m.data.value["error"])
miio.exceptions.DeviceError: {'code': -32600, 'message': 'Req object invalid.'}
Error: {'code': -32600, 'message': 'Req object invalid.'}

@Luc3as
Copy link

Luc3as commented Nov 11, 2018

Update:
when I run mirobo raw-command app_charge it is going to dock properly... with this PR installed

@rytilahti
Copy link
Owner Author

Ok, maybe the stop is then removed (I suppose pause does mostly the same though). I'm not sure why home() calls both stop and charge, it may also very well be unnecessary and will require some testing (btw, you called it above without this PR).

@Luc3as
Copy link

Luc3as commented Nov 13, 2018

I changed in vacuum.py , cannot push from git

    @command()
    def stop(self):
        """Stop cleaning."""
        return self.send("app_pause")

and also

    @command()
    def home(self):
        """Stop cleaning and return home."""
        self.send("app_pause")
        return self.send("app_charge")

now it is working as supposed.
My main goal here is get these changes to component which is visible and used by HomeAssistant so I can use my vacuum from there. how could we achieve this ? do we need some kind of If condition looking for vacuum version discovered by info and then applying these modification ?

@cj-arnas-navasinskas
Copy link

cj-arnas-navasinskas commented Nov 13, 2018

roborock.vacuum.c1 here

This seems to work with c1 without any --nextgen. Apart from:

mirobo --debug serial-number

INFO:miio.vacuum_cli:Debug mode active
DEBUG:miio.vacuum_cli:Read stored sequence ids: {'seq': 174, 'manual_seq': 0}
DEBUG:miio.vacuum_cli:Connecting to 1.1.1.90 with token ccf5863d202af55e3855b96fb3e5c269
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x0c\xe8\x18\x00\x00\\m' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x05\x0c\xe8\x18' (total 4)
            ts = 1970-01-01 06:34:21
        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)
DEBUG:miio.device:Discovered 050ce818 with ts: 1970-01-01 06:34:21, token: b'00000000000000000000000000000000'
DEBUG:miio.device:1.1.1.90:54321 >>: {'id': 175, 'method': 'get_serial_number', 'params': []}
DEBUG:miio.device:1.1.1.90:54321 (ts: 1970-01-01 06:34:21, id: 175) << {'result': ['R0201S82500221'], 'id': 175}
Traceback (most recent call last):
  File "C:\Program Files\Python\Python37\Scripts\mirobo-script.py", line 11, in <module>
    load_entry_point('python-miio==0.4.10', 'console_scripts', 'mirobo')()
  File "c:\program files\python\python37\lib\site-packages\python_miio-0.4.10-py3.7.egg\miio\click_common.py", line 54, in __call__
    return self.main(*args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\click\decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\python_miio-0.4.10-py3.7.egg\miio\vacuum_cli.py", line 505, in serial_number
    click.echo("Serial#: %s" % vac.serial_number())
  File "c:\program files\python\python37\lib\site-packages\python_miio-0.4.10-py3.7.egg\miio\vacuum.py", line 363, in serial_number
    return self.send("get_serial_number")[0]["serial_number"]
TypeError: string indices must be integers

mirobo --debug sound

INFO:miio.vacuum_cli:Debug mode active
DEBUG:miio.vacuum_cli:Read stored sequence ids: {'seq': 174, 'manual_seq': 0}
DEBUG:miio.vacuum_cli:Connecting to 1.1.1.90 with token ccf5863d202af55e3855b96fb3e5c269
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x0c\xe8\x18\x00\x00\\\x8e' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x05\x0c\xe8\x18' (total 4)
            ts = 1970-01-01 06:34: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)
DEBUG:miio.device:Discovered 050ce818 with ts: 1970-01-01 06:34:54, token: b'00000000000000000000000000000000'
DEBUG:miio.device:1.1.1.90:54321 >>: {'id': 175, 'method': 'get_current_sound', 'params': []}
DEBUG:miio.device:1.1.1.90:54321 (ts: 1970-01-01 06:34:54, id: 175) << {'result': ['OK'], 'id': 175}
Traceback (most recent call last):
  File "C:\Program Files\Python\Python37\Scripts\mirobo-script.py", line 11, in <module>
    load_entry_point('python-miio==0.4.10', 'console_scripts', 'mirobo')()
  File "c:\program files\python\python37\lib\site-packages\python_miio-0.4.10-py3.7.egg\miio\click_common.py", line 54, in __call__
    return self.main(*args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\click\decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\python_miio-0.4.10-py3.7.egg\miio\vacuum_cli.py", line 443, in sound
    click.echo("Current sound: %s" % vac.sound_info())
  File "c:\program files\python\python37\lib\site-packages\python_miio-0.4.10-py3.7.egg\miio\vacuumcontainers.py", line 412, in __repr__
    self.current,
  File "c:\program files\python\python37\lib\site-packages\python_miio-0.4.10-py3.7.egg\miio\vacuumcontainers.py", line 404, in current
    return self.data['sid_in_use']
TypeError: string indices must be integers

And if I ask for status after these commands throwing, status also throws:

mirobo --debug status

INFO:miio.vacuum_cli:Debug mode active
DEBUG:miio.vacuum_cli:Read stored sequence ids: {'seq': 174, 'manual_seq': 0}
DEBUG:miio.vacuum_cli:Connecting to 1.1.1.90 with token ccf5863d202af55e3855b96fb3e5c269
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG: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\x0c\xe8\x18\x00\x00\\\xa6' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = b'\x05\x0c\xe8\x18' (total 4)
            ts = 1970-01-01 06:35:18
        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)
DEBUG:miio.device:Discovered 050ce818 with ts: 1970-01-01 06:35:18, token: b'00000000000000000000000000000000'
DEBUG:miio.device:1.1.1.90:54321 >>: {'id': 175, 'method': 'get_status', 'params': []}
DEBUG:miio.device:1.1.1.90:54321 (ts: 1970-01-01 06:35:18, id: 175) << {'result': ['OK'], 'id': 175}
Traceback (most recent call last):
  File "C:\Program Files\Python\Python37\Scripts\mirobo-script.py", line 11, in <module>
    load_entry_point('python-miio==0.4.10', 'console_scripts', 'mirobo')()
  File "c:\program files\python\python37\lib\site-packages\python_miio-0.4.10-py3.7.egg\miio\click_common.py", line 54, in __call__
    return self.main(*args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\click\decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\program files\python\python37\lib\site-packages\python_miio-0.4.10-py3.7.egg\miio\vacuum_cli.py", line 110, in status
    if res.error_code:
  File "c:\program files\python\python37\lib\site-packages\python_miio-0.4.10-py3.7.egg\miio\vacuumcontainers.py", line 81, in error_code
    return int(self.data["error_code"])
TypeError: string indices must be integers

Asking for successful stuff (like stop) will return a correct status once again, I guess maybe status returns last error which we're unable to parse or something like that.

@cj-arnas-navasinskas
Copy link

cj-arnas-navasinskas commented Nov 13, 2018

stop is not stopping cleaning for me, only pause, but the command itself works fine, returns ok. Mi home app seems to do the same, firstly it allows to pause it, then you have an option to stop it. And I guess the difference is that stopping a cleaning - resets current cleaning status, maybe lets you to do a spot clean or another separate cleaning process...

@rytilahti
Copy link
Owner Author

rytilahti commented Nov 13, 2018

@Luc3as no need to change anything in homeassistant, when this PR (and other fixes) gets merged at some point, homeassistant component will just need a version bump.

@Arnasnn that error with status is worrying, as it seems just to respond ['OK'] without the real state? Did it work before requesting sound and serial-number? A couple of clarifications would be nice: (1) What's the specific model number of your device? (2) Does it support changing the sound pack in the app?

edit: sorry, I oversaw your update (that it works after pause, but probably breaks when calling stop). Can you check if sound and serial number work after a pause, too?

@cj-arnas-navasinskas
Copy link

cj-arnas-navasinskas commented Nov 13, 2018

The stop comment wasn't related to errors.

Status error:
Status works before calling these commands, and works after a successful command. Just after these sound and serial-number ones it doesn't.

Just looked into the app again, I don't see any way to upload any sound

Stop issue:
Might not be even an issue, if the robot is vacuuming, and I call stop - it doesn't stop the robot. I need to firstly call pause, then stop or home (don't know what stop does by then, didn't check if it resets any stats). The app seems to do the same, only pause is available when the robo is doing its job.
The stop command by itself seems to be successful and status works after it, so no problems there...

@rytilahti
Copy link
Owner Author

Ok. I think I added the stop to home command as it wasn't returning back without it. I'll make some tests and will then create a PR (if @Luc3as doesn't create a PR for the change) to make it use pause instead of stop if that works with my gen1, too.

@Luc3as you cannot push to repositories of other people, but you need to create your own fork (and then create a pull request afterwards), see https://help.github.com/articles/fork-a-repo/

@rytilahti rytilahti merged commit c730ea8 into master Nov 16, 2018
@rytilahti rytilahti deleted the force_empty_params branch November 16, 2018 13:06
@cj-arnas-navasinskas
Copy link

Any idea when the next release is due ?

@rytilahti
Copy link
Owner Author

Likely next weekend, if @syssi doesn't object or want to prepare an earlier release.

@syssi
Copy link
Collaborator

syssi commented Nov 26, 2018

Feel free! :-)

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

Successfully merging this pull request may close these issues.

5 participants