Skip to main content

python-xiaomi-miwifi

Tests PyPI version Python License: MIT

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/newstatus and 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

Release files for python-xiaomi-miwifi 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-xiaomi-miwifi 0.6.0
File Size Uploaded
python_xiaomi_miwifi-0.6.0.tar.gz 23.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-xiaomi-miwifi 0.6.0
File Interpreter ABI Platform
python_xiaomi_miwifi-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.6 kB

Release files / python_xiaomi_miwifi-0.6.0.tar.gz

Download URL python_xiaomi_miwifi-0.6.0.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4649f968e116c9a5b9dee4567d6cb10f9c11ee7283282382ab2210396e0bd15b
BLAKE2b-256 checksum
How to use checksums
4528b5eee966e876fc3ec05d66424f8c01b13cbf7cca5049dc7e29a14f215b33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / python_xiaomi_miwifi-0.6.0-py3-none-any.whl

Download URL python_xiaomi_miwifi-0.6.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6bdb11bea21041f0ffb2be2f3b01598dd0bd026c438aaf0f11ba27902fcc37fe
BLAKE2b-256 checksum
How to use checksums
e87c43ec0587ec14051c1f996d3c1614bfde92c20bccb895e366c4cf220dbd56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page