This repository is a Homebridge plugin for Xiaomi Miot devices, allowing control of various smart home devices through Homekit. It supports a wide range of device types, including fans, heaters, humidifiers, air purifiers, and more. The plugin integrates Miot devices into Homekit, enabling control from the native Homekit iOS app and Siri.
This repository is a Home Assistant custom component that integrates a wide range of Xiaomi Mi smart home devices, including air purifiers, humidifiers, air fresh systems, and pedestal fans. It communicates with devices over the local network using the python-miio library, which implements the Xiaomi MiIO protocol. The component exposes devices as fan or climate entities within Home Assistant, providing controls for power, preset modes, child lock, buzzer, LED, target humidity, oscillation, and other device-specific features. It supports over 50 device models, each with tailored attribute mappings and feature flags. The architecture follows the Home Assistant platform pattern: configuration is provided via YAML, and the async_setup_platform function in fan.py (and climate.py for dehumidifiers) initializes the appropriate device class based on the model. Each device class extends a generic base (XiaomiGenericDevice) that handles common operations like on/off, buzzer, and child lock, while subclasses add model-specific capabilities. The component registers custom services for fine-grained control, such as setting favorite level, LED brightness, or PTC heating. State updates are performed via polling, with retry logic for transient network issues. Primary data flows are unidirectional from device to Home Assistant: the component periodically calls the miio device's status method, extracts relevant attributes, and updates the entity state. Commands from the user are translated into miio method calls via an async executor. External dependencies are limited to Home Assistant core, the python-miio library (>=0.5.12), and the construct library (>=2.10.68). The component does not rely on cloud services; all communication is local. The codebase is actively maintained, with recent commits, CI workflows for linting and validation, and support for the latest Home Assistant versions. It demonstrates solid engineering practices for a custom component: clear separation of device models, feature flag bitmasks to conditionally enable services, and consistent error handling. While tightly coupled to Home Assistant's entity model and the miio library, it is well-organized and serves as a reliable integration for Xiaomi devices.
This repository is a Home Assistant custom component for integrating Xiaomi Smart Pedestal Fans (and several other fan models) into the Home Assistant ecosystem. The code in `fan.py` defines a hierarchy of Python classes, starting from a generic `XiaomiGenericDevice` base and specializing through `XiaomiFan`, `XiaomiFanP5`, `XiaomiFanMiot`, and many model-specific subclasses (e.g., `XiaomiFanZA5`, `XiaomiFanP76`). Each subclass maps the device-specific miIO/MIoT properties to Home Assistant's `FanEntity` interface, providing controls for power, speed percentage, preset modes, oscillation angles, LED brightness, buzzers, child locks, and timer delays. The integration also includes custom service definitions (e.g., `fan_set_oscillation_angle`, `fan_set_buzzer_on`) declared in `services.yaml` and `strings.json`. The architecture cleanly separates device communication logic (MiotDevice subclasses with property mappings) from Home Assistant entity logic (FanEntity subclasses). The code is well-structured, uses type hints, follows Home Assistant best practices, and includes CI workflows (HACS validation, hassfest, mypy, pre-commit, yamllint). It targets Python 3.13 and modern HA versions (2024.8+). There are no data research or analytics elements; it is strictly an application integration.