How xiaomi/ha_xiaomi_home works
Xiaomi Home is a Home Assistant integration for importing and controlling Xiaomi IoT devices. The user configures an account and selects devices; the integration represents those devices as Home Assistant entities and routes commands through cloud or supported local control. The README documents OAuth login, multiple accounts, configuration updates, action debugging, and cloud, gateway, and optional LAN control. Source excerpts establish the MIoT client’s local-first routing and several internal dependencies; unsampled flow details are omitted rather than inferred.
Main entry points: miot_client.py MIoT client · miot_device.py Device modeling · __init__.py Integration lifecycle · miot_cloud.py Cloud API and OAuth
Components 20
Setup and integration
- Account and device setup
custom_components/xiaomi_home/config_flow.py - Integration lifecycle
custom_components/xiaomi_home/__init__.py - OAuth web pages
custom_components/xiaomi_home/miot/web_pages.py
Devices and entities
- Device modeling
custom_components/xiaomi_home/miot/miot_device.py - Home Assistant entities
custom_components/xiaomi_home/climate.py - Other entity platforms
custom_components/xiaomi_home
MIoT connectivity
- MIoT client
custom_components/xiaomi_home/miot/miot_client.py - Cloud API and OAuth
custom_components/xiaomi_home/miot/miot_cloud.py - MIPS messaging
custom_components/xiaomi_home/miot/miot_mips.py - LAN control
custom_components/xiaomi_home/miot/miot_lan.py - Gateway discovery
custom_components/xiaomi_home/miot/miot_mdns.py - Network status
custom_components/xiaomi_home/miot/miot_network.py
MIoT foundations
- MIoT specifications
custom_components/xiaomi_home/miot/miot_spec.py - Spec-to-entity mapping
custom_components/xiaomi_home/miot/specs/specv2entity.py - Persistent storage
custom_components/xiaomi_home/miot/miot_storage.py - MIoT translations
custom_components/xiaomi_home/miot/miot_i18n.py - Shared utilities
custom_components/xiaomi_home/miot/common.py
Other components
- Home Assistant user
- Home Assistant
- Xiaomi cloud
Connections 26
- Home Assistant user → Account and device setup: configures
README.md - Account and device setup → OAuth web pages: serves login
custom_components/xiaomi_home/config_flow.py - Account and device setup → Cloud API and OAuth: authenticates
custom_components/xiaomi_home/config_flow.py - Home Assistant → Integration lifecycle: loads integration
- Integration lifecycle → MIoT client: initializes client
custom_components/xiaomi_home/__init__.py - Integration lifecycle → Persistent storage: uses storage
custom_components/xiaomi_home/__init__.py - Integration lifecycle → MIoT specifications: uses specs
custom_components/xiaomi_home/__init__.py - MIoT client → Cloud API and OAuth: calls API
custom_components/xiaomi_home/miot/miot_client.py - MIoT client → MIPS messaging: dispatches messages
custom_components/xiaomi_home/miot/miot_client.py - MIoT client → LAN control: routes local control
custom_components/xiaomi_home/miot/miot_client.py - MIoT client → Gateway discovery: discovers gateways
custom_components/xiaomi_home/miot/miot_client.py - MIoT client → Network status: checks connectivity
custom_components/xiaomi_home/miot/miot_client.py - Cloud API and OAuth → Xiaomi cloud: HTTP and MQTT
README.md - MIPS messaging → Xiaomi cloud: cloud messaging
README.md - Device modeling → MIoT client: controls devices
custom_components/xiaomi_home/miot/miot_device.py - Device modeling → MIoT specifications: uses definitions
custom_components/xiaomi_home/miot/miot_device.py - Device modeling → Spec-to-entity mapping: maps capabilities
custom_components/xiaomi_home/miot/miot_device.py - Home Assistant entities → Device modeling: wraps devices
custom_components/xiaomi_home/climate.py - Other entity platforms → Device modeling: wraps devices
custom_components/xiaomi_home/sensor.py - Home Assistant → Home Assistant entities: exposes controls
- MIoT specifications → Persistent storage: loads cached specs
custom_components/xiaomi_home/miot/miot_spec.py - MIoT client → MIoT translations: initializes translations
custom_components/xiaomi_home/miot/miot_client.py - Cloud API and OAuth → Shared utilities: uses utilities
custom_components/xiaomi_home/miot/miot_cloud.py - LAN control → Network status: uses network
custom_components/xiaomi_home/miot/miot_lan.py - LAN control → Gateway discovery: uses discovery
custom_components/xiaomi_home/miot/miot_lan.py - MIPS messaging → Shared utilities: uses utilities
custom_components/xiaomi_home/miot/miot_mips.py