简体中文 | English
Recently, Xiaomi brought out a new specification named MIoT-Spec
. Let's call it MIoT
for short. It is used to communicate with ALL Xiaomi IoT devices. Compared with the old miio
, this new specification is clear, highly adaptive, and open to all. Thanks to MIoT, nearly all Xiaomi IoT devices can be integrated into HASS in a very easy way. So I worked out this integration.
Currently this custom component supports:
- sensor (get properties from device)
- switch (set binary properties to device)
- cover (all motor devices)
- light (all kinds of light)
- fan (turn on/off, set oscillation and speed)
- humidifier (turn on/off, set target humidity and mode)
- media player (Xiaomi AI Speaker)
- climate (air conditioner, heater, ...)
- water heater (water heater, kettles...)
Using HACS (recommended):
- Search for the integration “Xiaomi MIoT” and add it
Manual installation:
- Download https://github.com/ha0y/xiaomi_miot_raw/archive/master.zip
- Extract the ‘./custom_components/’ folder to your installation
- After installation, add
Xiaomi MIoT
in 'Integrations' page, just like any other integrations. (If you can't find 'Xiaomi MIoT' but you are sure you have installed and restarted, this may because of your browser cache. Please try with another web browser.)
If you want to add devices from your Xiaomi account:
- Select "登录小米账号". Enter your credientals. Click "submit".
- If your devices are not in China server, select corresponding server in "Options".
- Add the integration again. Now, all devices in your account should appear in the list. Select the one you want to add.
- You will see a window with two textboxes and two checkboxes. The textbox describes how device is read and controlled. You don't need to change them unless you have some special needs. The checkboxes are for "Cloud Access". Try uncheck them at first and click submit, if fails, check both of them.
- If "Success" is shown, your device is ready to use!
Or if you prefer to add them by IP and token:
- Select "接入设备". A form will be shown shown to input them.
- Please refer to these example files
Although Xiaomi has switched to MIoT, device manufacturers seems unwilling to use it. They stick to the old, unopened miio protocol. The device that implements miio instead of MIoT cannot be accessed via LAN. But don't worry. Xiaomi Cloud is able to convert MIoT commands to miio commands and send them to the device via Internet. With your Xiaomi account, the integration sends commands - instead of to devices - to Xiaomi Cloud, so that all devices can work properly.
You can specify each device whether use Cloud Access or not. Please not that these devives will not work without Internet. Take care when use them in some important automations. To help you tell out devices with Cloud Access, there will be cloud
in their entity ids.
Please refer to Chinese readme.
If the custom component doesn't work out of the box for your device please update your configuration to increase log level:
# configuration.yaml
logger:
default: warn
logs:
custom_components.xiaomi_miot_raw: debug
miio: debug