rytilahti / python-miio

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

Model: xiaomi.repeater.v3 FW:3.2.10 #1151

Open CyberMan571 opened 2 years ago

CyberMan571 commented 2 years ago

Before submitting a new request, use the search to see if there is an existing issue for the device.

Device information:

Use miiocli device --ip <ip address> --token <token>. -Model: xiaomi.repeater.v3 -Hardware version: R03 -Firmware version: 3.2.10

Additional context


sudo miiocli wifirepeater  --ip 10.10.10.1  --token ' ' set_wifi_roaming TRUE                                        
Traceback (most recent call last):
  File "/usr/local/bin/miiocli", line 8, in <module>
    sys.exit(create_cli())
  File "/usr/local/lib/python3.9/dist-packages/miio/cli.py", line 63, in create_cli
    return cli(auto_envvar_prefix="MIIO")
  File "/usr/local/lib/python3.9/dist-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/miio/click_common.py", line 275, in wrap
    msg = msg_fmt(**kwargs)
TypeError: <lambda>() got an unexpected keyword argument 'wifi_roaming'
 sudo miiocli wifirepeater  --ip 10.10.10.1  --token '  '  rssi_accesspoint                                             1 ⨯ 1 ⚙
Traceback (most recent call last):
  File "/usr/local/bin/miiocli", line 8, in <module>
    sys.exit(create_cli())
  File "/usr/local/lib/python3.9/dist-packages/miio/cli.py", line 63, in create_cli
    return cli(auto_envvar_prefix="MIIO")
  File "/usr/local/lib/python3.9/dist-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/miio/click_common.py", line 277, in wrap
    msg = msg_fmt.format(**kwargs)
KeyError: 'result'

Can you fix these?

CyberMan571 commented 2 years ago

image

rytilahti commented 2 years ago

Please try with --debug flag to get more information what is being reported. Looks like the device is responding to that request, but the payload is something unexpected.

CyberMan571 commented 2 years ago

yes I will give debug file in a few days

Teemu R. @.***>, 2 Eki 2021 Cmt, 02:22 tarihinde şunu yazdı:

Please try with --debug flag to get more information what is being reported. Looks like the device is responding to that request, but the payload is something unexpected.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rytilahti/python-miio/issues/1151#issuecomment-932630816, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKVTJ2N5AXC7VUXU5D24OLUEY7ERANCNFSM5FDEM3EA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

CyberMan571 commented 2 years ago

Discover.txt

Only with the Discover option Does need token? If you need it, I give.

rytilahti commented 2 years ago

Try it with the commands you listed above (or any other wifirepeater commands), the discover information itself is not useful here.

CyberMan571 commented 2 years ago
INFO:miio.cli:Debug mode active
DEBUG:miio.miioprotocol:Got a response: Container: 
    data = Container: 
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = b'!1\x00 \x00\x00\x00\x00\x1ak\xec\xce\x00\x00s\x1b' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('1a6becce')
            ts = 1970-01-01 08:11:07
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'`Z\\Y\xa3+\x8cc\x18?\xb2\xaf\xcb\x06\x94\x14' (total 16)
DEBUG:miio.miioprotocol:Discovered 1a6becce with ts: 1970-01-01 08:11:07, token: b''
DEBUG:miio.miioprotocol:10.10.10.1:54321 >>: {'id': 1, 'method': 'miIO.get_repeater_ap_info', 'params': []}
DEBUG:miio.miioprotocol:10.10.10.1:54321 (ts: 1970-01-01 08:11:07, id: 1) << {'result': {'ssid': 'XiaomiRepeater', 'pwd': '571_1871_571', 'hidden': 1}, 'id': 1}
SSID: XiaomiRepeater
Password: 
SSID hidden: True

In here, the problem!

INFO:miio.cli:Debug mode active
DEBUG:miio.miioprotocol:Got a response: Container: 
    data = Container: 
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = b'!1\x00 \x00\x00\x00\x00\x1ak\xec\xce\x00\x00yf' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('1a6becce')
            ts = 1970-01-01 08:37:58
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'`Z\\Y\xa3+\x8cc\x18?\xb2\xaf\xcb\x06\x94\x14' (total 16)
DEBUG:miio.miioprotocol:Discovered 1a6becce with ts: 1970-01-01 08:37:58, token: b''
DEBUG:miio.miioprotocol:10.10.10.1:54321 >>: {'id': 1, 'method': 'miIO.get_repeater_sta_info', 'params': []}
DEBUG:miio.miioprotocol:10.10.10.1:54321 (ts: 1970-01-01 08:37:58, id: 1) << {'result': {'sta': {'count': 1, 'access_policy': 0}, 'mat': [], 'access_list': {'mac': ''}}, 'id': 1}
Access policy: 0
Associated stations: []
miiocli  -d wifirepeater --ip 10.10.10.1  --token " " wifi_roaming                                                                2 ⨯
INFO:miio.cli:Debug mode active
Traceback (most recent call last):
  File "/usr/local/bin/miiocli", line 8, in <module>
    sys.exit(create_cli())
  File "/usr/local/lib/python3.9/dist-packages/miio/cli.py", line 63, in create_cli
    return cli(auto_envvar_prefix="MIIO")
  File "/usr/local/lib/python3.9/dist-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/miio/click_common.py", line 275, in wrap
    msg = msg_fmt(**kwargs)
TypeError: <lambda>() missing 1 required positional argument: 'result'
INFO:miio.cli:Debug mode active
Usage: miiocli wifirepeater set_wifi_roaming [OPTIONS] WIFI_ROAMING

  Turn the WiFi roaming on/off.

Options:
  --help  Show this message and exit.
  #===

NOTE:Setting WIFI_ROAMING to 1 or 0 but no effect!

miiocli  -d wifirepeater --ip 10.10.10.1  --token " " set_wifi_roaming 1                                                          2 ⨯
INFO:miio.cli:Debug mode active
Traceback (most recent call last):
  File "/usr/local/bin/miiocli", line 8, in <module>
    sys.exit(create_cli())
  File "/usr/local/lib/python3.9/dist-packages/miio/cli.py", line 63, in create_cli
    return cli(auto_envvar_prefix="MIIO")
  File "/usr/local/lib/python3.9/dist-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/miio/click_common.py", line 275, in wrap
    msg = msg_fmt(**kwargs)
TypeError: <lambda>() got an unexpected keyword argument 'wifi_roaming'
INFO:miio.cli:Debug mode active
Usage: miiocli wifirepeater set_wifi_roaming [OPTIONS] WIFI_ROAMING
Try 'miiocli wifirepeater set_wifi_roaming --help' for help.

Error: Invalid value for 'WIFI_ROAMING': on is not a valid boolean

Add1: is there a debug file in stored?

https://youtu.be/XdK9PepeL3s?t=191 like as on the URL, I need an option.

CyberMan571 commented 2 years ago

mirobo -d --ip 10.10.10.1 --token 605a5c59a(to continue) configure-wifi Zyxel_D541_force 'password_text' It's same with SSID accessing internet. After, Repeater SSID, got named Zyxel_D541_force_plus. I have wanted to change repeater SSID. NOTE: After each device resetting, changes always the token key. Welcome to the internet, and I'm no happy. :) Continue to try.

CyberMan571 commented 2 years ago

@rytilahti when set SSID, with mirobo, I don't change or reconfigure device options again because I can't connect device!

Default Settings:

SSID: XiaoMiRepeater
Password: 12345678
SSID hidden: True

What is it useful? It is always down while connecting

rytilahti commented 2 years ago

I'm not sure what's causing the error on set_wifi_roaming so that needs some investigation. Is wifi-roaming returning the wanted configuration value?

configure_wifi command is not useful here, as it instructs the device itself to join the given network (and it also resets the token, so the token used to invoke that cannot be anymore used).

Did you already try using set-configuration (https://github.com/rytilahti/python-miio/blob/master/miio/wifirepeater.py#L115) like:

miiocli wifirepeater --ip <ip> --token <token> set-configuration <wanted ssid> <wanted password> 0

If you the 0 to 1, the device will not broadcast its existence but you can join to it knowing the ssid and the password.

CyberMan571 commented 2 years ago
Traceback (most recent call last):
  File "/usr/local/bin/mirobo", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/dist-packages/miio/click_common.py", line 59, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/miio/vacuum_cli.py", line 596, in configure_wifi
    click.echo(vac.configure_wifi(ssid, password, uid, timezone))
  File "/usr/local/lib/python3.9/dist-packages/miio/vacuum.py", line 664, in configure_wifi
    return super().configure_wifi(ssid, password, uid, extra_params)
  File "/usr/local/lib/python3.9/dist-packages/miio/device.py", line 169, in configure_wifi
    return self.send("miIO.config_router", params)[0]
TypeError: 'int' object is not subscriptable

If more than one tries, you can see the Python error! I saw

I need to an advanced python bug tracer!

@rytilahti Works greatly now! And I will test set-configuration command Please, add network scanning function for wireless repeater. Easily

CyberMan571 commented 2 years ago

@rytilahti set_wifi_roaming and wifi_roaming do not return successfully value.

CyberMan571 commented 2 years ago

@rytilahti IF you gift info to me(Advanced Python Stack info or error tracer) I can help you are solving the issue.

rytilahti commented 2 years ago

File "/usr/local/lib/python3.9/dist-packages/miio/device.py", line 169, in configure_wifi return self.send("miIO.config_router", params)[0] TypeError: 'int' object is not subscriptable

You can always use the --debug flag see the exact device responses that can help you to debug issues. However, as I mentioned above, configure_wifi is not usually a useful method to call as it resets the token and you probably don't want to do that.

If you run those other commands with the debug flag, the device responses could be used to improve the integration.

cristian-milea commented 2 years ago

Hi.

I have the same model and I am trying to extend a free network so I get more than 1 bar in bed. With the app, I cannot connect to an insecure network, so I already tried with an older android version 5.1.1 but could not complete the process although the app lets me select the unencrypted network.

Is what I want to achieve possible? Extending an unencrypted network with the Xiaomi Extender?

I tried running like this after finding this issue:

miiocli -d wifirepeater --ip 10.10.10.1 --token 4aa7729mytoken4798f set_configuration 'FREE WIFI FAR AWAY' '' 0

INFO:miio.cli:Debug mode active
Setting accesspoint configuration
DEBUG:miio.click_common:Unknown model, trying autodetection. None None
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\x1ar\xba\x14\x00\x00\x02\x1f' (total 16)
        value = Container:
            length = 32
            unknown = 0
            device_id = unhexlify('1a72ba14')
            ts = 1970-01-01 00:09:03
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'J\xa7r\x98\xe7#\x01\x1e\x0e\xbf=\n\x8d\xf4y\x8f' (total 16)
DEBUG:miio.miioprotocol:Discovered 1a72ba14 with ts: 1970-01-01 00:09:03, token: b'4aa77298e723011e0ebf3d0a8df4798f'
DEBUG:miio.miioprotocol:10.10.10.1:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
DEBUG:miio.miioprotocol:10.10.10.1:54321 (ts: 1970-01-01 00:09:03, id: 1) << {'result': {'life': 543, 'cfg_time': 543, 'token': '4aa77298e723011e0ebf3d0a8df4798f', 'fw_ver': '3.2.10', 'hw_ver': 'R03', 'uid': 0, 'api_level': 2, 'mcu_fw_ver': '1000', 'wifi_fw_ver': '1.0.0', 'mac': '64:64:4A:4B:0B:F8', 'model': 'xiaomi.repeater.v3', 'ap': {'rssi': 0, 'ssid': '', 'bssid': '', 'rx': 0, 'tx': 0}, 'sta': {'count': 1, 'ssid': 'XiaoMiRepeater', 'hidden': 1, 'assoclist': 'c4:91:0c:b3:68:fa;'}, 'netif': {}, 'desc': {'wifi_explorer': 0, 'sn': '26676/A0YR29744', 'color': 100, 'channel': 'release'}}, 'id': 1}
DEBUG:miio.device:Detected model xiaomi.repeater.v3
WARNING:miio.device:Found an unsupported model 'xiaomi.repeater.v3' for class 'WifiRepeater'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
DEBUG:miio.miioprotocol:10.10.10.1:54321 >>: {'id': 2, 'method': 'miIO.switch_wifi_ssid', 'params': [{'ssid': 'THE CAPITAL – CONNECT', 'pwd': '', 'hidden': 0, 'wifi_explorer': 0}]}
DEBUG:miio.miioprotocol:10.10.10.1:54321 (ts: 1970-01-01 00:09:03, id: 2) << {'result': 0, 'id': 2}
0
manta1900 commented 2 years ago

Any news with that? I have the same issues and I cannot extend an unsecured network without this. Please help.

stek29 commented 1 year ago

if somebody wants to implement support for this device, here's miio dump from official app configuring it:

{"id":2,"method":"miIO.config_router","params":{"tz":"Europe\/TIMEZONE","uid":MI_UID,"bind_key":"BINDKEY","passwd":"WIFI_PASSWD","wifi_config":{"cc":"COUNTRY_CODE"},"ssid":"WIFI_SSID","gmt_offset":10800,"config_type":"app","country_domain":"sg"}}

where:

I haven't tried to dump/decrypt other commands like changing wifi name, changing roaming setting, etc -- for me this was enough to get it working.

stek29 commented 1 year ago

for the reference -- it's super easy to dump keys and traffic if you have an m1/m2 MacBook since you can install Mi Home app on it from AppStore and dump traffic with Wireshark on the same device easily, as well as get the token from local sqlite database which is easily accessible on a Mac (it's in ~/Library/Containers/SOME-UUID)

then you can decrypt them using JS miio library/cli.