# rytilahti/python-miio

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/rytilahti-python-miio).**

4,246 stars · 600 forks · Python · GPL-3.0

## Links

- GitHub: https://github.com/rytilahti/python-miio
- Homepage: https://python-miio.readthedocs.io
- awesome-repositories: https://awesome-repositories.com/repository/rytilahti-python-miio.md

## Topics

`home-assistant` `home-automation` `miio` `miot` `miot-spec` `python` `smart-home` `xiaomi`

## Description

python-miio is a Python library and hardware driver implementation of the Miio protocol, designed for controlling and managing Xiaomi smart appliances. It provides the necessary software interfaces to translate high-level commands into network packets for device communication.

The project includes a specialized network device simulator for emulating hardware responses to test protocol implementations without physical devices. It also features a command-line interface for sending commands, querying device status, and performing token retrieval for secure authentication.

Capability areas cover IoT network discovery to identify device models and IP addresses, as well as protocol analysis through the parsing of network packet captures. The library supports device feature introspection to retrieve metadata regarding available sensors and configurable settings.

## Tags

### Hardware & IoT

- [Smart Appliance Control](https://awesome-repositories.com/f/hardware-iot/smart-appliance-control.md) — Provides a standardized way to control operational states for Xiaomi home appliances like vacuums and air purifiers. ([source](https://cdn.jsdelivr.net/gh/rytilahti/python-miio@master/README.md))
- [Automatic Network Hardware Discovery](https://awesome-repositories.com/f/hardware-iot/automatic-network-hardware-discovery.md) — Performs automated network scanning to identify Xiaomi devices and extract their IP addresses and metadata.
- [Device Model Detection](https://awesome-repositories.com/f/hardware-iot/ble-device-management/device-discovery/device-model-detection.md) — Implements logic to identify specific Xiaomi device models to load the appropriate control classes. ([source](https://python-miio.readthedocs.io))
- [Hardware Device Discovery](https://awesome-repositories.com/f/hardware-iot/hardware-device-discovery.md) — Queries a connected device to extract its model, hardware version, firmware version, and network status. ([source](https://cdn.jsdelivr.net/gh/rytilahti/python-miio@master/README.md))
- [Feature Introspection](https://awesome-repositories.com/f/hardware-iot/hardware-device-discovery/mdns-device-discovery/feature-introspection.md) — Retrieves metadata about available sensors, configurable settings, and executable actions from a connected device. ([source](https://python-miio.readthedocs.io))
- [Smart Home Hardware Drivers](https://awesome-repositories.com/f/hardware-iot/smart-home-hardware-drivers.md) — Acts as a hardware driver that translates high-level Python commands into Miio network packets.
- [Xiaomi Device Integration](https://awesome-repositories.com/f/hardware-iot/third-party-hardware-integration/xiaomi-device-integration.md) — Enables connecting Xiaomi hardware to external systems by managing device tokens and protocol communication.
- [Command Set Retrieval](https://awesome-repositories.com/f/hardware-iot/device-command-interfaces/command-set-retrieval.md) — Downloads and parses description files to identify available commands for connected hardware. ([source](https://python-miio.readthedocs.io/en/latest/contributing.html))

### Part of an Awesome List

- [Smart Home Automation](https://awesome-repositories.com/f/awesome-lists/productivity/smart-home-automation.md) — Allows controlling and managing Xiaomi smart appliances via Python scripts for household automation.

### Development Tools & Productivity

- [CLI Command Frameworks](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks.md) — Triggers hardware actions through a command-line interface using network addresses and security tokens. ([source](https://cdn.jsdelivr.net/gh/rytilahti/python-miio@master/README.md))
- [Command Line Interfaces](https://awesome-repositories.com/f/development-tools-productivity/command-line-interfaces.md) — Ships a command-line tool for sending commands and querying status from network-connected smart appliances.
- [Hardware Command Parsing](https://awesome-repositories.com/f/development-tools-productivity/custom-command-execution/configuration-file-command-execution/command-trigger-prefixes/chat-command-triggers/command-tree-parsing/hardware-command-parsing.md) — Dynamically identifies and executes available hardware commands by parsing external description files.

### Networking & Communication

- [Local Device Token Retrievals](https://awesome-repositories.com/f/networking-communication/communication-platforms-services/messaging-notification-systems/messaging-services/notification-delivery-services/push-notification-providers/device-token-management/local-device-token-retrievals.md) — Implements mechanisms to extract authentication tokens from Xiaomi devices to enable secure local control. ([source](https://python-miio.readthedocs.io/en/latest/discovery.html))
- [Miio Protocol Implementations](https://awesome-repositories.com/f/networking-communication/miio-protocol-implementations.md) — Provides a full technical implementation of the Miio protocol for interacting with Xiaomi devices.
- [Network Device Discovery](https://awesome-repositories.com/f/networking-communication/network-device-discovery.md) — Provides utilities to automatically identify and categorize Xiaomi hardware devices connected to the local network. ([source](https://python-miio.readthedocs.io/en/latest/discovery.html))
- [Network Environment Scanning](https://awesome-repositories.com/f/networking-communication/network-environment-scanning.md) — Identifies compatible devices on a local network using specific handshake protocols and IP scanning.
- [Network Protocol Analysis](https://awesome-repositories.com/f/networking-communication/network-protocol-analysis.md) — Analyzes network packet captures to decode and implement the Miio communication protocol for smart appliances.
- [Historical Packet Parsing](https://awesome-repositories.com/f/networking-communication/packet-capture-storage/historical-packet-parsing.md) — Extracts and decodes raw network traffic from capture files to analyze device communication.
- [Protocol Simulation](https://awesome-repositories.com/f/networking-communication/protocol-simulation.md) — Runs local simulators for communication protocols to test code without requiring physical hardware. ([source](https://python-miio.readthedocs.io))

### Security & Cryptography

- [Transmission Encryption](https://awesome-repositories.com/f/security-cryptography/credential-encryption/transmission-encryption.md) — Secures communication by wrapping payloads with device-specific encryption tokens during transmission.

### Operating Systems & Systems Programming

- [IoT Device Simulation](https://awesome-repositories.com/f/operating-systems-systems-programming/device-state-simulation/iot-device-simulation.md) — Mocks device endpoints and hardware responses to test code logic and connectivity without physical hardware. ([source](https://python-miio.readthedocs.io/en/latest/))
- [Device Property Querying](https://awesome-repositories.com/f/operating-systems-systems-programming/virtualization-emulation/hardware-emulators/device-property-querying.md) — Tests a list of potential properties against a device to identify which ones return valid responses. ([source](https://python-miio.readthedocs.io/en/latest/contributing.html))

### Software Engineering & Architecture

- [Python Descriptors](https://awesome-repositories.com/f/software-engineering-architecture/python-descriptors.md) — Uses Python descriptors to define sensor schemas and settings for automatic interface generation.
- [Schema Metadata Definitions](https://awesome-repositories.com/f/software-engineering-architecture/schema-metadata-utilities/schema-metadata-definitions.md) — Creates structured containers with descriptors for sensors and settings to provide metadata for integrations. ([source](https://python-miio.readthedocs.io/en/latest/contributing.html))

### Testing & Quality Assurance

- [Device Emulators](https://awesome-repositories.com/f/testing-quality-assurance/automation-interaction-tools/user-interaction-simulation/device-emulators.md) — Emulates hardware devices using text descriptions to test protocol implementations and device interactions. ([source](https://python-miio.readthedocs.io/en/latest/simulator.html))
- [Smart Home Hardware Simulation](https://awesome-repositories.com/f/testing-quality-assurance/smart-home-hardware-simulation.md) — Includes a specialized network device simulator to emulate hardware responses for protocol testing.
- [Hardware Mocks](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/end-to-end-testing-suites/application-testing/logic-mocking/ui-logic-mocks/hardware-mocks.md) — Emulates hardware responses via local servers to test communication logic without physical devices.
