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

Viomi SE vacuum cleaner support (viomi.vacuum.v19) #837

Closed
rufik opened this issue Oct 15, 2020 · 19 comments · Fixed by #1581
Closed

Viomi SE vacuum cleaner support (viomi.vacuum.v19) #837

rufik opened this issue Oct 15, 2020 · 19 comments · Fixed by #1581

Comments

@rufik
Copy link

rufik commented Oct 15, 2020

Kindly request to support Viomi SE vacuum cleaner.

Device information:

  • Name(s) of the device: Viomi SE
  • Link: N/D

Result of miiocli device --ip <ip address> --token <token>:

  • Model: viomi.vacuum.v19
  • Hardware version: Linux
  • Firmware version: 4.0.9_0012

Additional context
Nothing really useful now, maybe result of some commands:

$ mirobo discover --handshake 1
INFO:miio.miioprotocol:Sending discovery to <broadcast> with timeout of 5s..
INFO:miio.miioprotocol:  IP 192.168.66.4 (ID: 1660e85d) - token: b'ffffffffffffffffffffffffffffffff'

$ mirobo --ip 192.168.66.4 --token xxxxxxx info
viomi.vacuum.v19 v4.0.9_0012 (5C:6B:D7:XX:XX:XX) @ 192.168.66.4 - token: xxxxxxx

$ mirobo --ip 192.168.66.4 --token xxxxxxx status
Error: {'code': -9999, 'message': 'user ack timeout'}
@rytilahti
Copy link
Owner

mirobo can only be used for commanding rockrobo vacuums. Could you try if miiocli viomivacuum is working?

@rytilahti rytilahti changed the title Viomi SE vacuum cleaner support Viomi SE vacuum cleaner support (viomi.vacuum.v19) Oct 15, 2020
@rufik
Copy link
Author

rufik commented Oct 15, 2020

Sure, here it is:

rufik@RUFIK-2TB1YT2:~$ miiocli viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXX info
Model: viomi.vacuum.v19
Hardware version: Linux
Firmware version: 4.0.9_0012
Network: {'localIp': '192.168.66.4', 'mask': '255.255.255.0', 'gw': '192.168.66.1'}
AP: {'ssid': 'XXXXXXXXXXXX', 'bssid': '1a:e8:29:XX:XX:XX', 'rssi': '-45', 'freq': 0}

rufik@RUFIK-2TB1YT2:~$ miiocli viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXX status
ValueError: None is not a valid ViomiVacuumState
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/rufik/.local/bin/miiocli", line 8, in <module>
    sys.exit(create_cli())
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/cli.py", line 45, in create_cli
    return cli(auto_envvar_prefix="MIIO")
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 285, in wrap
    result_msg = result_msg_fmt.format(**kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/viomivacuum.py", line 121, in state
    return ViomiVacuumState(self.data["run_state"])
  File "/usr/lib/python3.8/enum.py", line 309, in __call__
    return cls.__new__(cls, value)
  File "/usr/lib/python3.8/enum.py", line 600, in __new__
    raise exc
  File "/usr/lib/python3.8/enum.py", line 584, in __new__
    result = cls._missing_(value)
  File "/usr/lib/python3.8/enum.py", line 613, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: None is not a valid ViomiVacuumState

@rytilahti
Copy link
Owner

rytilahti commented Oct 15, 2020

Okay, so looks like it at least has the same command for status information as other viaomis, so that's a good sign!

The "run_state" seems to be empty. Try the status command with --debug (-d) flag to see the data send by the device:
miiocli --debug viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXX status

You could also try other commands to see if any of them are working, see miiocli viomivacuum --help for complete listing of available commands.

@rufik
Copy link
Author

rufik commented Oct 15, 2020

rufik@RUFIK-2TB1YT2:~$ miiocli --debug viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXXX status
INFO:miio.cli:Debug mode active
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
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\x16`\xe8]\x00\x02\xd0\xdc' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('1660e85d')
            ts = 1970-01-03 03:15:40
        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 1660e85d with ts: 1970-01-03 03:15:40, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.66.4:54321 >>: {'id': 1, 'method': 'get_prop', 'params': ['run_state', 'mode', 'err_state', 'battary_life', 'box_type', 'mop_type', 's_time', 's_area', 'suction_grade', 'water_grade', 'remember_map', 'has_map', 'is_mop', 'has_newmap']}
DEBUG:miio.miioprotocol:192.168.66.4:54321 (ts: 1970-01-03 03:15:41, id: 1) << {'result': [], 'id': 1, 'exe_time': 100}
DEBUG:miio.device:Count (14) of requested properties does not match the count (0) of received values.
ValueError: None is not a valid ViomiVacuumState
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/rufik/.local/bin/miiocli", line 8, in <module>
    sys.exit(create_cli())
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/cli.py", line 45, in create_cli
    return cli(auto_envvar_prefix="MIIO")
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 285, in wrap
    result_msg = result_msg_fmt.format(**kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/viomivacuum.py", line 121, in state
    return ViomiVacuumState(self.data["run_state"])
  File "/usr/lib/python3.8/enum.py", line 309, in __call__
    return cls.__new__(cls, value)
  File "/usr/lib/python3.8/enum.py", line 600, in __new__
    raise exc
  File "/usr/lib/python3.8/enum.py", line 584, in __new__
    result = cls._missing_(value)
  File "/usr/lib/python3.8/enum.py", line 613, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: None is not a valid ViomiVacuumState

@rufik
Copy link
Author

rufik commented Oct 15, 2020

Start, pause, stop command works fine :) See some debug:

INFO:miio.cli:Debug mode active
Running command start
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
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\x16`\xe8]\x00\x02\xd1c' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('1660e85d')
            ts = 1970-01-03 03:17:55
        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 1660e85d with ts: 1970-01-03 03:17:55, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.66.4:54321 >>: {'id': 1, 'method': 'set_mode_withroom', 'params': [0, 1, 0]}
DEBUG:miio.miioprotocol:192.168.66.4:54321 (ts: 1970-01-03 03:17:56, id: 1) << {'id': 1, 'result': {'code': 0}, 'exe_time': 201}
None


rufik@RUFIK-2TB1YT2:~$ miiocli --debug viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXXX pause
INFO:miio.cli:Debug mode active
Running command pause
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
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\x16`\xe8]\x00\x02\xd1w' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('1660e85d')
            ts = 1970-01-03 03:18:15
        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 1660e85d with ts: 1970-01-03 03:18:15, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.66.4:54321 >>: {'id': 1, 'method': 'set_mode_withroom', 'params': [0, 2, 0]}
DEBUG:miio.miioprotocol:192.168.66.4:54321 (ts: 1970-01-03 03:18:16, id: 1) << {'id': 1, 'result': {'code': 0}, 'exe_time': 201}
None


rufik@RUFIK-2TB1YT2:~$ miiocli --debug viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXXX stop
INFO:miio.cli:Debug mode active
Running command stop
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
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\x16`\xe8]\x00\x02\xd1\x81' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('1660e85d')
            ts = 1970-01-03 03:18:25
        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 1660e85d with ts: 1970-01-03 03:18:25, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.66.4:54321 >>: {'id': 1, 'method': 'set_mode', 'params': [0]}
DEBUG:miio.miioprotocol:192.168.66.4:54321 (ts: 1970-01-03 03:18:27, id: 1) << {'id': 1, 'result': {'code': 0}, 'exe_time': 1102}
None


rufik@RUFIK-2TB1YT2:~$ miiocli --debug viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXXX home
INFO:miio.cli:Debug mode active
Running command home
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
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\x16`\xe8]\x00\x02\xd1\xa1' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('1660e85d')
            ts = 1970-01-03 03:18:57
        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 1660e85d with ts: 1970-01-03 03:18:57, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.66.4:54321 >>: {'id': 1, 'method': 'set_charge', 'params': [1]}
DEBUG:miio.miioprotocol:192.168.66.4:54321 (ts: 1970-01-03 03:18:58, id: 1) << {'id': 1, 'result': {'code': 0}, 'exe_time': 301}
None

@rufik
Copy link
Author

rufik commented Oct 15, 2020

LED on/off command takes effect, but throws exception:

rufik@RUFIK-2TB1YT2:~$ miiocli --debug viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXXX led off
INFO:miio.cli:Debug mode active
Running command led
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
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\x16`\xe8]\x00\x02\xd2>' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('1660e85d')
            ts = 1970-01-03 03:21:34
        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 1660e85d with ts: 1970-01-03 03:21:34, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.66.4:54321 >>: {'id': 1, 'method': 'set_light', 'params': [0]}
DEBUG:miio.miioprotocol:192.168.66.4:54321 (ts: 1970-01-03 03:21:38, id: 1) << {'id': 1, 'error': {'code': -9999, 'message': 'user ack timeout'}, 'exe_time': 4005}
DEBUG:miio.click_common:Exception: {'code': -9999, 'message': 'user ack timeout'}
Traceback (most recent call last):
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 280, in wrap
    kwargs["result"] = func(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 245, in command_callback
    return miio_command.call(miio_device, *args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 193, in call
    return method(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/viomivacuum.py", line 354, in led
    return self.send("set_light", [state.value])
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/device.py", line 146, in send
    return self._protocol.send(
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/miioprotocol.py", line 213, in send
    self._handle_error(payload["error"])
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/miioprotocol.py", line 273, in _handle_error
    raise DeviceError(error)
miio.exceptions.DeviceError: {'code': -9999, 'message': 'user ack timeout'}
Error: {'code': -9999, 'message': 'user ack timeout'}


rufik@RUFIK-2TB1YT2:~$ miiocli --debug viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXXX led on
INFO:miio.cli:Debug mode active
Running command led
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
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\x16`\xe8]\x00\x02\xd2c' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('1660e85d')
            ts = 1970-01-03 03:22:11
        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 1660e85d with ts: 1970-01-03 03:22:11, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.66.4:54321 >>: {'id': 1, 'method': 'set_light', 'params': [1]}
DEBUG:miio.miioprotocol:192.168.66.4:54321 (ts: 1970-01-03 03:22:15, id: 1) << {'id': 1, 'error': {'code': -9999, 'message': 'user ack timeout'}, 'exe_time': 4004}
DEBUG:miio.click_common:Exception: {'code': -9999, 'message': 'user ack timeout'}
Traceback (most recent call last):
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 280, in wrap
    kwargs["result"] = func(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 245, in command_callback
    return miio_command.call(miio_device, *args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 193, in call
    return method(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/viomivacuum.py", line 354, in led
    return self.send("set_light", [state.value])
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/device.py", line 146, in send
    return self._protocol.send(
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/miioprotocol.py", line 213, in send
    self._handle_error(payload["error"])
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/miioprotocol.py", line 273, in _handle_error
    raise DeviceError(error)
miio.exceptions.DeviceError: {'code': -9999, 'message': 'user ack timeout'}
Error: {'code': -9999, 'message': 'user ack timeout'}

@rufik
Copy link
Author

rufik commented Oct 15, 2020

Fanspeed can be fetched sucessfully:

INFO:miio.cli:Debug mode active
Running command fan_speed_presets
{'Silent': 0, 'Standard': 1, 'Medium': 2, 'Turbo': 3}

But DND Status not:

rufik@RUFIK-2TB1YT2:~$ miiocli --debug viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXXX dnd_status
INFO:miio.cli:Debug mode active
Running command dnd_status
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
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\x16`\xe8]\x00\x02\xd3&' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('1660e85d')
            ts = 1970-01-03 03:25:26
        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 1660e85d with ts: 1970-01-03 03:25:26, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.66.4:54321 >>: {'id': 1, 'method': 'get_notdisturb', 'params': []}
DEBUG:miio.miioprotocol:192.168.66.4:54321 (ts: 1970-01-03 03:25:30, id: 1) << {'id': 1, 'error': {'code': -9999, 'message': 'user ack timeout'}, 'exe_time': 4006}
DEBUG:miio.click_common:Exception: {'code': -9999, 'message': 'user ack timeout'}
Traceback (most recent call last):
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 280, in wrap
    kwargs["result"] = func(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 245, in command_callback
    return miio_command.call(miio_device, *args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/click_common.py", line 193, in call
    return method(*args, **kwargs)
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/viomivacuum.py", line 314, in dnd_status
    status = self.send("get_notdisturb")
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/device.py", line 146, in send
    return self._protocol.send(
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/miioprotocol.py", line 213, in send
    self._handle_error(payload["error"])
  File "/home/rufik/.local/lib/python3.8/site-packages/miio/miioprotocol.py", line 273, in _handle_error
    raise DeviceError(error)
miio.exceptions.DeviceError: {'code': -9999, 'message': 'user ack timeout'}
Error: {'code': -9999, 'message': 'user ack timeout'}

@rytilahti
Copy link
Owner

Okay, so looks like the control commands are at least partially similar, so it's a good start.

DEBUG:miio.device:Count (14) of requested properties does not match the count (0) of received values.

Looks like the property names are different. Some devices support requesting all properties using, so you could try if this works: miiocli viomivacuum raw_command get_prop "['all']"

Probably the best way to find out which properties (and actions, too) are supported is to do a traffic capture between the mobile app and the device, all while clicking around and testing all functionality. Here's a guide for that: https://github.com/aholstenson/miio/blob/master/docs/protocol.md

miio.exceptions.DeviceError: {'code': -9999, 'message': 'user ack timeout'}

All time out errors are coming directly from the device, but that's very generic error so it is hard to say whether the cause is unavailable command (like I'd guess in the case of DnD) or when something else (like in the case with leds still changing the state even when erroring).

Fanspeed can be fetched sucessfully:

This response is a hard-coded, no request is send to the device.

@rufik
Copy link
Author

rufik commented Oct 15, 2020

Unfortunetly, it doesn't return props at all:

rufik@RUFIK-2TB1YT2:~$ miiocli viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXXX raw_command get_prop "['all']"
Running command raw_command
[]

Some debug:

rufik@RUFIK-2TB1YT2:~$ miiocli --debug viomivacuum --ip 192.168.66.4 --token XXXXXXXXXXXXXX raw_command get_prop "['all']"
INFO:miio.cli:Debug mode active
Running command raw_command
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
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\x16`\xe8]\x00\x02\xde\xec' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('1660e85d')
            ts = 1970-01-03 04:15:40
        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 1660e85d with ts: 1970-01-03 04:15:40, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.66.4:54321 >>: {'id': 1, 'method': 'get_prop', 'params': ['all']}
DEBUG:miio.miioprotocol:192.168.66.4:54321 (ts: 1970-01-03 04:15:40, id: 1) << {'result': [], 'id': 1, 'exe_time': 101}
[]

@rezmus
Copy link

rezmus commented Oct 16, 2020

it's miot device. check specs for proto.

@rufik
Copy link
Author

rufik commented Oct 19, 2020

@rezmus
Copy link

rezmus commented Oct 28, 2020

to install voice pack for viomi se (v19) and probably viomi v3 (v13) send this miio command and wait 1-2 minutes

{"method":"action","params":{"did":"YOUR_DID","siid":8,"aiid":3,"in":["ru","https://cnbj2.fds.api.xiaomi.com/vacuum-voice/ru.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=0B837D5Afpp7rylY5Q4CI6WtznE=","b5efcbee84c864d807baf1319f682d23"]},"id":12345}

to get back to english which is local voice pack send

{"method":"action","params":{"did":"YOUR_DID","siid":8,"aiid":3,"in":["en","local","local"]},"id":12345}

official voice packs

name: '中文(粤语)',
key: 'zh_hk',
url: "https://cnbj2.fds.api.xiaomi.com/vacuum-voice/zh_hk.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=fHTt58vc0K4yRupdo1CDI67fFEY=",
md5: "cc919d02121aaed9cf6b92eb61300daf"

name: 'Deutsch',
key: 'de',
url: "https://cnbj2.fds.api.xiaomi.com/vacuum-voice/de.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=f+hW+58tGjvKAY/LvoLVIWk1Eus=',
md5: '712060bc0c3e3b188d83eea6df601fd2'

name: 'Espanol',
key: 'es',
url: "https://cnbj2.fds.api.xiaomi.com/vacuum-voice/es.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=gOpibPBe3Xo6I/sfjeN1t6WoH6o=',
md5: '101a115f9af671f194bb71171557362a'

name: 'Italiana',
key: 'it',
url: "https://cnbj2.fds.api.xiaomi.com/vacuum-voice/it.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=pa2o1Nh7EyWXAaS7BPDRqUA2hQ4=",
md5: 'c98659ca1d467cc8248eda28a3068107'

name: '한국어',
key: 'ko',
url: "https://cnbj2.fds.api.xiaomi.com/vacuum-voice/ko.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=R4eu4B59wSZsnliSKx0Ar7ATJEY=",
md5: '34408327ba7becae672c23f4f1a53544'

name: 'Polski',
key: 'pl',
url: "https://cnbj2.fds.api.xiaomi.com/vacuum-voice/pl.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=q3IQz2r9TOY0iPMHQqClnJ2BHt0=",
md5: "6bddcdded41d379ae1fc7cdd8987a6f0"

name: 'русский',
key: 'ru',
url: "https://cnbj2.fds.api.xiaomi.com/vacuum-voice/ru.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=0B837D5Afpp7rylY5Q4CI6WtznE=",
md5: "b5efcbee84c864d807baf1319f682d23"

name: 'ไทย',
key: 'th',
url: "https://cnbj2.fds.api.xiaomi.com/vacuum-voice/th.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=3uU8cgI8w9z0IfN4ZIWi3k6l5QQ=",
md5: "5ae49b0521e0f7579e4d6f8bb64e30b9"

name: 'Français',
key: 'fr',
url: "https://cnbj2.fds.api.xiaomi.com/vacuum-voice/fr.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=0+VqqK6TUfzZv/6R8tqG02pDBGo=",
md5: "cc919d02121aaed9cf6b92eb61300daf"

name: 'Brasil Portugal',
key: 'pt',
url: "https://cnbj2.fds.api.xiaomi.com/vacuum-voice/pt.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=AQOxW7JIUP04wUN7KCOKKCJeBNU=",
md5: "cc919d02121aaed9cf6b92eb61300daf"

name: 'Türk dili',
key: 'tr',
url: "https://cnbj2.fds.api.xiaomi.com/vacuum-voice/tr.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=yqqI0WEmOV6tziz0TdTtzd30Sis=",
md5: "cc919d02121aaed9cf6b92eb61300daf"

@rufik
Copy link
Author

rufik commented Oct 28, 2020

Not working on v19:

$ miiocli viomivacuum --ip 192.168.66.4 --token xxxxxxxxxxxxxxxxx raw_command '{"method":"action","params":{"did":"DID","siid":8,"aiid":3,"in":["pl","https://cnbj2.fds.api.xiaomi.com/vacuum-voice/pl.zip?GalaxyAccessKeyId=5151729087601&Expires=9223372036854775807&Signature=q3IQz2r9TOY0iPMHQqClnJ2BHt0=","6bddcdded41d379ae1fc7cdd8987a6f0"]},"id":12345}'
Running command raw_command
ERROR:miio.miioprotocol:Got error when receiving: timed out
Error: No response from the device

@PatrykKot
Copy link

Probably the best way to find out which properties (and actions, too) are supported is to do a traffic capture between the mobile app and the device, all while clicking around and testing all functionality. Here's a guide for that: https://github.com/aholstenson/miio/blob/master/docs/protocol.md

I also have new Viomi SE. I've tried to capture network traffic from Xiaomi Home with BlueStack and Wireshark but I don't see any packets to Viomi's IP (only packets to Xiaomi servers).

@karstenk95
Copy link

karstenk95 commented Nov 27, 2020

Hi! A also have a new Viomi SE. I can get some Properties with the Specs for Viomi SE. At example the Status of the Vacuum:

`miiocli device --ip <ip> --token <token> raw_command get_properties '[{"piid":1,"siid":2,"did":"<did>"}]'

Running command raw_command
[{'value': 4, 'did': '375450266', 'siid': 2, 'piid': 1, 'code': 0}]

`
Value: 4 is the Staus of the Vacuum. 4 means Charging.

    class StatusEnum(enum.Enum):
        Sleep = 0
        Idle = 1
        Paused = 2
        Go_Charging = 3
        Charging = 4
        Sweeping = 5
        Sweeping_And_Mopping = 6
        Mopping = 7

I can set Properties too, but with the Actions i have Problems.

`miio protocol call 192.168.178.44 action '[{"siid":2,"aiid":6,"did":"<did>"}]'
 INFO  Attempting to call action on 192.168.178.44

 INFO  Device found, making call

 INFO  Got result:
{
  "code": -4003
}`

@rezmus
Copy link

rezmus commented Nov 27, 2020

action has single object, not array.

@karstenk95
Copy link

Damn. It works! Thank You!

@PatrykKot
Copy link

Hi! A also have a new Viomi SE. I can get some Properties with the Specs for Viomi SE. At example the Status of the Vacuum:

`miiocli device --ip <ip> --token <token> raw_command get_properties '[{"piid":1,"siid":2,"did":"<did>"}]'

Running command raw_command
[{'value': 4, 'did': '375450266', 'siid': 2, 'piid': 1, 'code': 0}]

`
Value: 4 is the Staus of the Vacuum. 4 means Charging.

    class StatusEnum(enum.Enum):
        Sleep = 0
        Idle = 1
        Paused = 2
        Go_Charging = 3
        Charging = 4
        Sweeping = 5
        Sweeping_And_Mopping = 6
        Mopping = 7

I can set Properties too, but with the Actions i have Problems.

`miio protocol call 192.168.178.44 action '[{"siid":2,"aiid":6,"did":"<did>"}]'
 INFO  Attempting to call action on 192.168.178.44

 INFO  Device found, making call

 INFO  Got result:
{
  "code": -4003
}`

So it looks like they've changed get_prop to get_properties, right? I'll try this on my own Viomi SE later.

@jovanotti25
Copy link

ended up not realizing how we solved this alert ..can you explain?

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

Successfully merging a pull request may close this issue.

6 participants