Code Monkey home page Code Monkey logo

miwifi_mesh_node_adder's Introduction

MiWiFi_Mesh_Node_Adder

Bypasses the need to set the Xiaomi device to Singapore region by adding a node via API

Want to offer me a coffee? XLM address: shotokanzh*keybase.io (stellar account ID: GAKH7KR4V5KFH5OWC6NL6H4EN6J43VGK4MYA6NNPDHSTBVE6G4SMT4GW) with proof: https://keybase.io/shotokanzh

TL;DR

Calling directly the /api/xqnetwork/add_mesh_node API is enough to add a new mesh node without the need to switch the main router's region to Singapore. (Tested with Xiaomi firmware global 3.0.22)

The story

As a christmas gift this year I decided to buy two Xiaomi Mi Aiot AX3600 routers as I noticed that they supported WPA3 / WIFI6 and they could even be connected via Mesh either Wireless or Wired (I am gonna love this one!) and could auto-configure all the IOT devices that I already have at home.

So I proceeded in configuring the router for usage with Italian servers (in the initial configuration the region it's the first thing Xiaomi asks for) but, after configuring the main router, I noticed that it could not see/autoconfigure the secondary router as it didn't appear at all when the router called the /api/xqnetwork/scan_mesh_node API, returning a sad:

{"list":[],"code":0}

Searching online I noticed that a guy on the Xiaomi forum (here) discovered the origin of the problem:

When you reset an AX3600 (global firmware) to add it as a mesh router the default country is singapore
[...]
So your main router must be set to singapore also ( unfortunatly you must reset it if you already have another country)
Once done it will detect the second mesh router.

...But, setting the router to Singapore breaks the compatibility with the MiHome app, if you already had devices added to it and, more importantly, sends data outside the EU.

I then discovered that, configuring the system to singapore, the system would call the /api/xqnetwork/add_mesh_node API, just passing the 5GHz mac address (yes, even if you are connected via wired mesh) and the "room name".

Resetting the device, configuring it to use Italian servers and then calling directly the API passing the 5GHz mac address of the secondary router was enough to have it autoconfigured.

How to

What you will need

  • IP Address of master router
  • Password of master router
  • MAC Address (5GHz) of client router

How to retrieve MAC Address

  • Turn on the client router
  • Wait for the two lights to turn on (the internet one should be orange, the system one should be cyan/blue)
  • Use a wifi scanner app on Android such as Wifi Analyzer
  • Wait for a Xiaomi_network with 5G in the name to appear (it will take a minute) and just write down the mac address.

Wifi

Usage

Run:

python3 -m pip install -r requirements.txt
python3 addmesh.py

Just input the ip address of the master router, the password and the mac address of the client.

The end.

Special thanks

miwifi_mesh_node_adder's People

Contributors

shotokanzh avatar

Stargazers

Ogu avatar Mustafa Kemal GILOR avatar ⭐ 🐾 avatar Bartosz F. avatar Illya avatar Adrian Knorr avatar Florent Brassart avatar Theo avatar  avatar YS avatar Vassil Verguilov avatar Ruben Thys avatar Not a Bot avatar Milan Stevanović avatar  avatar  avatar Riccardo Calì avatar Yuv avatar Juan Alonso avatar wh7f avatar  avatar  avatar Aurélien Reeves avatar Dmitriy avatar  avatar Haseeb Ahmed avatar Sergei Vizel avatar Dennis avatar  avatar  avatar Jorge Lucena avatar Renaldas avatar luxus avatar ARQ avatar Dariusz Goc avatar  avatar  avatar  avatar Alonso García Balbuena avatar Tec-Bert avatar Fabian Seitz avatar  avatar  avatar Oskars avatar  avatar Mikhail Troshechkin avatar  avatar  avatar  avatar  avatar Duc-Thien Bui avatar Michael Benz avatar  avatar Daniel Ramos avatar Erkan Isik avatar

Watchers

Neustradamus avatar James Cloos avatar Maciej Zięba avatar  avatar  avatar  avatar Tr0lli avatar  avatar

miwifi_mesh_node_adder's Issues

Compatibility with Xiaomi AX3000?

Hi!

Thanks a lot for your work!

Do you know if this is compatible with router Xiaomi AX3000 (not 3600), whose servers are based in China (and cannot connect to european ones)? I'd like to connect my router to the Xiaomi app instead of using MiWifi.

I use it standalone, without client router - i only connect domestic stuff like PC or phones

Thanks a lot!

Greetings from France

Ugo

Stuck after Mac adresses showing up

First of all, thank you for your effort on it and the will to share with us.

I have alittle issue that maybe is something easy to overcome.
After my master router (AX3600) find the MAC adresses from client router (AX1800), it shows this:
"Client (not configured) 5GHz mac address (AA:BB:CC:DD:EE:FF):"

If a try to insert the right MAC, it shows me some error like that:
"Adding 9C:9D:7E:9D:5E:C8 as mesh node..
Traceback (most recent call last):
File "C:\Users\campo\Desktop\MiWiFi_Mesh_Node_Adder-main\addmesh.py", line 165, in
if router.add_mesh_node(mac_address_client):
File "C:\Users\campo\Desktop\MiWiFi_Mesh_Node_Adder-main\addmesh.py", line 139, in add_mesh_node
jdata = response.json()
File "C:\Users\campo\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\campo\AppData\Local\Programs\Python\Python39\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\campo\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\campo\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)"

Could you help me?

Not able to type in Master Password

Hi there,
first of all thanks for all the effort you put in - i am very impressed of this easy work-around and appreciate it a lot!
After typing in the IP of the Master Router i get asked for the password. Unfortunately i am not able to type anything in, it wont take any commands other then me hitting "enter". I want to type in the password, but it just wont recognize it. As if my keyboard is not plugged in.. lol :)

is there any solution for that possibly?

Thanks a lot!

Best regards
Paul

Success message but nothing happens

After running the command it tells me to wait for it ro reboot but it won't reboot. So I did it manually, but it is still not working. The routers are ~1,5m apart and up to date.

MiWiFi Mesh Node Adder v1.0 by ShotokanZH
Master (online, configured) router address: 192.168.31.1
Master password:
Logging in..
Login: OK

Platform: R3600
AIoT scan status: ON

Asking master to scan for Xiaomi Wifi APs...
No AP detected! (Are the two devices close enough?)
You can continue, but it will probably fail.

Client (not configured) 5GHz mac address (AA:BB:CC:DD:EE:FF):9E:B2:00:22:BA:E00 Adding 9E:B2:00:22:BA:E0 as mesh node..
Node configured correctly! Wait for it to reboot.

Support for Asus as Master

I have an Asus router and a Xiaomi AX3600 router, but I am unable to connect both, do you know a way to do it?

MacOS

Hi mate. love you! recently got a 2nd mesh and cannot remember how to do all this.

using latest Mac OS but hit a road bump.

Evo@MacBook-Pro MiWiFi_Mesh_Node_Adder-main % python3 addmesh.py   
Traceback (most recent call last):
  File "/Users/Evo/Downloads/MiWiFi_Mesh_Node_Adder-main/addmesh.py", line 7, in <module>
    import requests
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/__init__.py", line 11, in <module>
    from . import exceptions
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/urllib3/exceptions.py", line 3, in <module>
    from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
ModuleNotFoundError: No module named 'urllib3.packages.six.moves'

any updates needed to get this working?

thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.