English | 简体中文
MIoT-Spec: The protocol specification for Xiaomi IoT devices, is a standard designed by the Xiaomi IoT platform to describe the function definition of hardware products according to the networking mode of hardware products, the characteristics of product functions, the characteristics of user usage scenarios and the user's requirements for hardware product use experience specification.
This component uses the MIoT-Spec to automatically integrate Xiaomi devices into HomeAssistant, and currently supports most Xiaomi MIoT devices. And it supports HA Web UI, and you can easily integrate Xiaomi devices into HA without configuring yaml.
Download and copy
custom_componentsfolder in your HomeAssistant config folder
# Auto install via terminal shell wget -q -O - https://cdn.jsdelivr.net/gh/al-one/hass-xiaomi-miot/install.sh | bash -
Or you can install component with HACS
You have two ways to integrate xiaomi devices:
Add devices using Mi Account
Suitable for miio, ble and ZigBee devices (miot_cloud will be enabled)
Add device using host/token
Suitable for devices supporting miot-spec in LAN
If your device (integrate by token) unavailable or return code -4004 or -9999 in logs, You can try this way.
# configuration.yaml xiaomi_miot: username: xiaomi_username password: xiaomi_password # server_country: cn # location of xiaomi cloud: cn(default), de, i2, ru, sg, us
Enabled miot cloud for device:
# configuration.yaml homeassistant: customize: !include customize.yaml # customize.yaml domain.your_entity_id: miot_local: true # Force to read and write data in LAN (integrate by account) miot_cloud: true # Enable miot cloud for entity (read, write, action) miot_cloud_write: true # Enable miot cloud (only write) miot_cloud_action: true # Enable miot cloud (only action) miio_properties: power,battery # Get miio properties to state attributes # Custom sub entities domain.parent_entity_id: sensor_properties: temperature,humidity,illumination # Miot properties binary_sensor_properties: is_volume_muted,any_boolen_property switch_properties: on,power number_properties: volume fan_properties: mode,fan_level cover_properties: motor_control climate.your_entity_id: bind_sensor: sensor.temperature_entity,sensor.humidity_entity # Sensor entities camera.your_entity_id: video_attribute: 1 # https://github.com/al-one/hass-xiaomi-miot/issues/11#issuecomment-773054167 keep_streaming: true # Continuously update stream address check_lan: true # Check LAN connection in cloud mode cover.your_entity_id: closed_position: 5 # Change cover state to closed when position <= 5% deviated_position: 2 # Current position deviation 2% -> 0%, 98% -> 100% motor_reverse: true # Reverse motor state open_texts: Open,Up close_texts: Close,Down doamin.your_entity_id: interval_seconds: 30 # Seconds between each update state (Requires reload config entry) chunk_properties: 10 # Chunk miot properties on update state (LAN)
Recommended Customization Using The UI:
⚙️ Configuration > 🖌 Customize > 🔍 Select Entity > Add Other Attribute
# configuration.yaml logger: default: warning logs: custom_components.xiaomi_miot: debug
Use HomeAssistant Service
xiaomi_miot.get_token, Enter the keyword of device name
Use MiHome mod by @vevsvevs