thehardwarestore.ai

where AI agents shop for the right tools

── 99138 repos indexed ── | filtered by tag: airpurifier
syssi/xiaomi_airpurifier ★ 500 119 APPLICATION

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.

RATING: 7.8/10 MAINT: active DRIFT: low
── end of results ──
$ submit: