skillfed

python-miio

Python library for interfacing with Xiaomi smart appliances

python-miio v0.5.12 329.4K downloads/30d#7,546 on PyPI4,285
Copyleft license GPL-3.0-only Active released

What it is and what it does

python-miio is a Python library and command-line tool for communicating with Xiaomi smart home devices using their proprietary miIO and MIoT protocols. It provides both a programmatic API (via classes like RoborockVacuum and Device) and a CLI tool (miiocli) for discovering devices, querying their status, and sending control commands. The library abstracts away protocol details and handles device model detection automatically.

The package supports a wide range of Xiaomi and compatible devices—robot vacuums, air purifiers, fans, smart plugs, lights, humidifiers, and others—each exposed through a dedicated module. It is actively used by Home Assistant for official device integration. Installation is straightforward with low friction, though operation requires obtaining a device token and network access to the target device.

Use it for:

  • Control a Xiaomi robot vacuum from Python or the command line without proprietary apps.
  • Automate Xiaomi smart home devices in a home automation system.
  • Query device status and execute device-specific commands via miiocli.
  • Build custom integrations for unsupported Xiaomi devices by extending the Device or MiotDevice base classes.
  • Monitor and control air purifiers, humidifiers, and environmental devices on a local network.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Python library and CLI tool for controlling Xiaomi smart devices using the miIO and MIoT protocols over the network.

Yes, if you own Xiaomi smart devices and want programmatic or CLI control without relying on cloud services or proprietary apps. The library is stable, actively maintained, and widely used. The copyleft GPL-3.0-only license is a consideration if you plan to distribute derivative work. No known security vulnerabilities as of the query date.

Install

python-miio on PyPI

pip

pip install python-miio

uv

uv add python-miio

poetry

poetry add python-miio

Installing python-miio

Before you install

Low install friction with a pure Python wheel. Active maintenance as of 2026-07-25 with 4285 repository stars. Supports Python 3.7 through 3.10.

License in practice

Licensed under GPL-3.0-only (copyleft). Any derivative work or bundled distribution must also be open-source under compatible terms.

Quickstart

pip install python-miio

from miio import RoborockVacuum

vac = RoborockVacuum("", "")
vac.start()

Requires a valid device token and network connectivity to the target Xiaomi device.

Verify before relying

  • Whether all 15 runtime dependencies are truly required for basic operation or if some are optional for specific device types.
  • Current maintenance status beyond the last commit date—whether active development continues or the project is in maintenance-only mode.
  • Specific IP address and token format requirements for device connection.

Package facts

License GPL-3.0-only (copyleft)
Python support supports the current Python release (>=3.7,<4.0)
Install friction low — pure-Python wheel
Runtime dependencies 15 — PyYAML, android_backup, appdirs, attrs, click, construct, croniter, cryptography, defusedxml, importlib_metadata, micloud, netifaces, pytz, tqdm, zeroconf
Maintenance actively maintained — 1,488 days since the last release
Last repo commit
First released
Downloads 329,400/month — #7,546 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: python_miio-0.5.12-py3-none-any.whl

Keywords: xiaomi, miio, miot, smart home

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: End Users/DesktopLicense :: OSI Approved :: GNU General Public License v3 (GPLv3)Operating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Home AutomationTopic :: System :: Hardware

Tags

xiaomi smart home controlmiio protocol interfacexiaomi device automationsmart appliance command linexiaomi vacuum robot controlmiot device managementhome automation xiaomi
smart-homeiot-controlxiaomi-devices

More Home Automation packages