rytilahti / python-miio

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

Token maybe incorrect #1636

Closed aram535 closed 1 year ago

aram535 commented 1 year ago

Describe the bug This maybe my lack of understanding but it looks like the token is not being accepted. It's also possible that the G3 is not a supported camera?

Version information (please complete the following information):

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

To Reproduce

  1. tcpdump -v host 192.168.66.52 -w capture
  2. echo -ne '\x21\x31\x00\x20\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' | nc -u 192.168.66.52 54321
  3. tcpdump -qns 0 -X -r capture
    08:52:56.798418 IP 192.168.66.52 > 192.168.1.18: ICMP 192.168.66.52 udp port 54321 unreachable, length 68
        0x0000:  45c0 0058 eb57 0000 3f01 caf6 c0a8 4234  E..X.W..?.....B4
        0x0010:  c0a8 0112 0303 c1cd 0000 0000 4500 003c  ............E..<
        0x0020:  0840 4000 3f11 6eda c0a8 0112 c0a8 4234  .@@.?.n.......B4
        0x0030:  e3a6 d431 0028 61dd 2131 0020 ffff ffff  ...1.(a.!1......
        0x0040:  ffff ffff ffff ffff ffff ffff ffff ffff  ................
        0x0050:  ffff ffff ffff ffff
  4. dump
    $ xxd -p
    0840 4000 3f11 6eda c0a8 0112 c0a8 4234 e3a6 d431 0028 61dd 2131 0020
    303834302034303030203366313120366564612063306138203031313220
    633061382034323334206533613620643433312030303238203631646420
    3231333120303032300a
  5. Try to get info
    $ miiocli --debug aqaracamera --ip 192.168.66.52 --token 64616330613830313132633061383432 info
    /home/awm/aqara/venv/lib64/python3.6/site-packages/miio/protocol.py:37: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
    from cryptography.hazmat.backends import default_backend
    INFO:miio.cli:Debug mode active
    DEBUG:miio.click_common:Unknown model, trying autodetection. None None
    DEBUG:miio.miioprotocol:Unable to discover a device at address 192.168.66.52
    DEBUG:miio.click_common:Exception: Unable to discover the device 192.168.66.52
    Traceback (most recent call last):
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/miio/click_common.py", line 308, in wrap
    kwargs["result"] = func(*args, **kwargs)
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/miio/click_common.py", line 273, in command_callback
    return miio_command.call(miio_device, *args, **kwargs)
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/miio/click_common.py", line 220, in call
    return method(*args, **kwargs)
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/miio/click_common.py", line 186, in _wrap
    self._fetch_info()
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/miio/device.py", line 149, in _fetch_info
    devinfo = DeviceInfo(self.send("miIO.info"))
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/miio/device.py", line 104, in send
    command, parameters, retry_count, extra_parameters=extra_parameters
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/miio/miioprotocol.py", line 161, in send
    self.send_handshake()
    File "/home/awm/aqara/venv/lib64/python3.6/site-packages/miio/miioprotocol.py", line 74, in send_handshake
    raise DeviceException("Unable to discover the device %s" % self.ip)
    miio.exceptions.DeviceException: Unable to discover the device 192.168.66.52
    Error: Unable to discover the device 192.168.66.52
aram535 commented 1 year ago

Please ignore this, I just re-read the capture file and it's a port error ... the captured reply isn't an answer.