Async Python client for Xiaomi / MiWiFi routers over the LuCI HTTP API
Project description
python-xiaomi-miwifi
Async Python client for Xiaomi / MiWiFi routers over their LuCI HTTP API. Built to power the ha-xiaomi-miwifi Home Assistant integration.
Features
- 🔐 Token login with the MiWiFi
sha1(nonce + sha1(password + key))signing scheme - 📊 Aggregated status: WAN, throughput, client counts per band, firmware, mesh topology
- 🕸️ Mesh-aware: enumerates gateway + leaf nodes
- 🛠️ Controls: reboot, per-radio enable/disable, DHCP reservation add/remove
- ⚡ Fully async (
aiohttp), typed (py.typed), zero-config session management
Installation
pip install python-xiaomi-miwifi
Quickstart
import asyncio
from xiaomi_miwifi import MiWiFiClient
async def main() -> None:
async with MiWiFiClient("192.168.31.1", password="your-password") as client:
status = await client.async_get_status()
print(status.model, status.client_count, status.wan_ip)
for node in status.mesh_nodes:
print("mesh:", node.name, node.model, node.ip)
asyncio.run(main())
Supported routers
| Hardware code | Model |
|---|---|
RM1800 |
Xiaomi Router AX1800 |
RA82 |
Xiaomi Router AX3000T |
Have a different Xiaomi router? Open an issue with the output of
api/misystem/newstatusand we'll add it.
API overview
| Method | Description |
|---|---|
async_login() |
Authenticate and cache the token |
async_get_status() |
Aggregated MiWiFiStatus |
async_get_clients() |
List of ClientDevice |
async_get_dhcp_reservations() |
Current MAC→IP reservations |
async_add_dhcp_reservation(mac, ip, name) |
Add/replace a reservation |
async_remove_dhcp_reservation(mac) |
Remove a reservation |
async_set_wifi_enabled(ifname, enabled) |
Toggle a radio (wl0=5G, wl1=2.4G) |
async_reboot() |
Reboot the router |
Development
uv venv && uv pip install -e ".[test]"
pytest
ruff check .
License
MIT © Hudson Brendon
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_xiaomi_miwifi-0.6.0.tar.gz.
File metadata
- Download URL: python_xiaomi_miwifi-0.6.0.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4649f968e116c9a5b9dee4567d6cb10f9c11ee7283282382ab2210396e0bd15b
|
|
| MD5 |
e78de7894a4ff49d4e972ad6e016e698
|
|
| BLAKE2b-256 |
4528b5eee966e876fc3ec05d66424f8c01b13cbf7cca5049dc7e29a14f215b33
|
File details
Details for the file python_xiaomi_miwifi-0.6.0-py3-none-any.whl.
File metadata
- Download URL: python_xiaomi_miwifi-0.6.0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bdb11bea21041f0ffb2be2f3b01598dd0bd026c438aaf0f11ba27902fcc37fe
|
|
| MD5 |
87de5dfa002da52f1c9cb4804cda76f8
|
|
| BLAKE2b-256 |
e87c43ec0587ec14051c1f996d3c1614bfde92c20bccb895e366c4cf220dbd56
|