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

Mark xiaomi.repeater.v3 as supported for wifirepeater #1812

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

kebianizao
Copy link
Contributor

@kebianizao kebianizao commented Aug 26, 2023

This includes the config_router action required for xiaomi.repeater.v3 starts repeating.

This is a first approach implementation, if you need changes to accept the PR, please let me know. Hopefully, this does not break any other thing but I haven't checked.

Relevant documentation/references:

For the record, this is a dump of the command result:

$ bin/miiocli -d wifirepeater --ip 10.10.10.1 --token TOKEN config_router SSID PASSWORD
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\x00STUFF\x00\x00\xSTUFF' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('DID')
            ts = 1970-01-01 00:18:27
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'`STUFFSTUFF' (total 16)
DEBUG:miio.miioprotocol:Discovered 216e335f with ts: 1970-01-01 00:18:27, token: b'TOKEN'
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:18:28, id: 1) << {'result': {'life': 1108, 'cfg_time': 1108, 'token': 'TOKEN', 'fw_ver': '3.2.12', 'hw_ver': 'R03', 'uid': 0, 'api_level': 2, 'mcu_fw_ver': '1000', 'wifi_fw_ver': '1.0.0', 'mac': 'MAC', 'model': 'xiaomi.repeater.v3', 'ap': {'rssi': 0, 'ssid': '', 'bssid': '', 'rx': 0, 'tx': 0}, 'sta': {'count': 1, 'ssid': 'SSID', 'hidden': 0, 'assoclist': 'ASSOCLIST;'}, 'netif': {}, 'desc': {'wifi_explorer': 0, 'sn': 'SN/SN', 'color': 100, 'channel': 'release'}}, 'id': 1}
DEBUG:miio.device:Detected model xiaomi.repeater.v3
DEBUG:miio.miioprotocol:10.10.10.1:54321 >>: {'id': 2, 'method': 'miIO.config_router', 'params': {'ssid': SSID, 'passwd': PASSWORD, 'uid': 0}}
DEBUG:miio.miioprotocol:10.10.10.1:54321 (ts: 1970-01-01 00:18:28, id: 2) << {'result': 0, 'id': 2}
0

HTH,

Copy link
Owner

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank @kebianizao! Could you please run pre-commit run -a to fix the linting issues, then this is ready to go.

@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Merging #1812 (b711400) into master (fb0a63b) will increase coverage by 0.03%.
Report is 8 commits behind head on master.
The diff coverage is 75.00%.

@@            Coverage Diff             @@
##           master    #1812      +/-   ##
==========================================
+ Coverage   80.85%   80.88%   +0.03%     
==========================================
  Files         192      193       +1     
  Lines       18513    18597      +84     
  Branches     4011     4020       +9     
==========================================
+ Hits        14969    15043      +74     
- Misses       3266     3276      +10     
  Partials      278      278              
Files Coverage Δ
miio/integrations/xiaomi/repeater/wifirepeater.py 93.87% <75.00%> (-1.78%) ⬇️

... and 9 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rytilahti rytilahti changed the title xiaomi/wifirepeater: v3 config_router support Mark xiaomi.repeater.v3 as supported xiaomi/wifirepeater Oct 4, 2023
@rytilahti rytilahti changed the title Mark xiaomi.repeater.v3 as supported xiaomi/wifirepeater Mark xiaomi.repeater.v3 as supported for wifirepeater Oct 4, 2023
@rytilahti rytilahti merged commit 79d2685 into rytilahti:master Oct 4, 2023
16 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants