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

Air humidifer CA4 returns command error #1030

Open
marek-obuchowicz opened this issue May 4, 2021 · 1 comment
Open

Air humidifer CA4 returns command error #1030

marek-obuchowicz opened this issue May 4, 2021 · 1 comment
Labels

Comments

@marek-obuchowicz
Copy link

Describe the bug
Air humidifer CA4 status returns command error

Version information (please complete the following information):

  • OS: OS X Big Sur, x86_64
  • python-miio: 0.5.5.2

Device information:

Hardware version: esp32
Firmware version: 2.0.8```

**To Reproduce**
Steps to reproduce the behavior:
```miiocli airhumidifier --ip ... --token ... status
Error: {'code': -5001, 'message': 'command error'}

(same problem with other commands, like set_led, off, on)

Expected behavior
As this device should be supported, i expect status and other commands to work.

Console output

miiocli --debug airhumidifier --ip ... --token ... 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\x15]\xf8$\x00\x00\x11\xe5' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('155df824')
            ts = 1970-01-01 01:16:21
        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 155df824 with ts: 1970-01-01 01:16:21, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:*.*.*.*:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:*.*.*.*:54321 (ts: 1970-01-01 01:16:22, id: 1) << {'id': 1, 'result': {'life': 4581, 'uid': 6449165217, 'model': 'zhimi.humidifier.ca4', 'token': '*', 'ipflag': 1, 'fw_ver': '2.0.8', 'mcu_fw_ver': '0017', 'miio_ver': '0.0.8', 'hw_ver': 'esp32', 'mmfree': 65244, 'mac': '54:48:E6:50:1E:B9', 'wifi_fw_ver': 'cef6c09-dirty', 'ap': {'ssid': '*', 'bssid': '*', 'rssi': -52, 'primary': 4}, 'netif': {'localIp': '*.*.*.*', 'mask': '255.255.255.0', 'gw': '*.*.*.*'}}, 'exe_time': 40}
DEBUG:miio.miioprotocol:*.*.*.*:54321 >>: {'id': 2, 'method': 'get_prop', 'params': ['power', 'mode', 'humidity', 'buzzer', 'led_b', 'child_lock', 'limit_hum', 'use_time', 'hw_version', 'temp_dec', 'trans_level', 'button_pressed']}
DEBUG:miio.miioprotocol:*.*.*.*:54321 (ts: 1970-01-01 01:16:22, id: 2) << {'id': 2, 'error': {'code': -5001, 'message': 'command error'}, 'exe_time': 80}
DEBUG:miio.click_common:Exception: {'code': -5001, 'message': 'command error'}
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/miio/click_common.py", line 280, in wrap
    kwargs["result"] = func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/miio/click_common.py", line 245, in command_callback
    return miio_command.call(miio_device, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/miio/click_common.py", line 193, in call
    return method(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/miio/airhumidifier.py", line 285, in status
    values = self.get_properties(properties, max_properties=_props_per_request)
  File "/usr/local/lib/python3.9/site-packages/miio/device.py", line 268, in get_properties
    values.extend(self.send(property_getter, _props[:max_properties]))
  File "/usr/local/lib/python3.9/site-packages/miio/device.py", line 177, in send
    return self._protocol.send(
  File "/usr/local/lib/python3.9/site-packages/miio/miioprotocol.py", line 214, in send
    self._handle_error(payload["error"])
  File "/usr/local/lib/python3.9/site-packages/miio/miioprotocol.py", line 274, in _handle_error
    raise DeviceError(error)
miio.exceptions.DeviceError: {'code': -5001, 'message': 'command error'}
Error: {'code': -5001, 'message': 'command error'}```
@rytilahti
Copy link
Owner

The cli can sometimes be confusing (esp. related to which command to use), sorry for that! For the CA4, the correct command is miiocli airhumidifiermiot (ca4 being mentioned in airhumidifier_miot.py).

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

No branches or pull requests

2 participants