Xiaomi Home Integration for Home Assistant
What is the project about?
This project is an official integration for Home Assistant that allows users to control their Xiaomi IoT smart devices directly within the Home Assistant platform.
What problem does it solve?
It bridges the gap between Xiaomi's smart home ecosystem (Xiaomi Home/Mi Home) and the open-source home automation platform, Home Assistant. This eliminates the need for separate apps or complex workarounds to manage Xiaomi devices alongside other smart home devices. It centralizes control and automation.
What are the features of the project?
- Official Xiaomi Support: Developed and supported by Xiaomi, ensuring better compatibility and reliability.
- Device Integration: Imports most Xiaomi Home devices into Home Assistant, allowing for unified control and automation. (Excludes Bluetooth, infrared, and virtual devices).
- Multiple Account Support: Allows users to add multiple Xiaomi accounts, enabling management of devices across different accounts within a single Home Assistant instance.
- Cloud and Local Control: Primarily operates via the Xiaomi Cloud. Future support for local control via the Xiaomi Central Hub Gateway is planned (firmware update pending). Partial local control via Xiaomi LAN control is available but not recommended.
- MIoT-Spec-V2 Compliance: Uses Xiaomi's MIoT-Spec-V2 protocol for standardized device communication and mapping to Home Assistant entities (Sensors, Switches, Buttons, etc.).
- Message Subscription: Uses MQTT message subscription for real-time updates on device status changes, minimizing cloud polling.
- OAuth 2.0 Security: Uses OAuth 2.0 for secure login, without storing user passwords within Home Assistant.
- Debug Mode: Includes a debug mode for sending raw Action commands to devices for advanced users/troubleshooting.
- Configurable: Allows users to update nicknames, device lists, and enable/disable LAN control.
- Multilingual Support: Supports multiple languages in the configuration flow (Simplified Chinese, Traditional Chinese, English, Spanish, Russian, French, German, and Japanese).
- Region Support: Available in mainland China, Europe, India, Russia, Singapore, and the USA.
What are the technologies used in the project?
- Python: The primary programming language for Home Assistant integrations.
- Home Assistant: The open-source home automation platform.
- MIoT-Spec-V2: Xiaomi's IoT protocol for device communication.
- MQTT: A lightweight messaging protocol used for device communication (both cloud and local).
- HTTP: Used for communication with the MIoT Cloud API.
- OAuth 2.0: For secure user authentication.
- HACS (Home Assistant Community Store): A method for installing the integration (though not yet in the default HACS store).
- Git: Version control.
What are the benefits of the project?
- Centralized Control: Manage Xiaomi devices alongside other smart home devices within Home Assistant.
- Automation: Create powerful automations and scenes involving Xiaomi devices within Home Assistant.
- Open Source: Integrates with the open-source Home Assistant platform.
- Real-time Updates: Receives device status updates quickly via message subscription.
- Secure: Uses OAuth 2.0 for secure authentication.
- Official Support: Backed by Xiaomi, providing better reliability and compatibility.
What are the use cases of the project?
- Unified Smart Home Control: Control lights, switches, sensors, and other Xiaomi devices from the Home Assistant interface.
- Automated Routines: Create automations like "Turn on the Xiaomi air purifier when the air quality sensor detects poor air quality."
- Voice Control Integration: Control Xiaomi devices via voice assistants integrated with Home Assistant (e.g., Google Assistant, Amazon Alexa).
- Dashboard Monitoring: Monitor the status of Xiaomi devices on a Home Assistant dashboard.
- Cross-Platform Integration: Combine Xiaomi devices with devices from other manufacturers in automations and scenes.
