Xiaomi
system: device provider: vacuum/xiaomi introduced in v0.1 internalPull
Plugin provides control of Xiaomi vacuum (gen 1 and 2).
Vacuum tends to ignore about 20% status requests, so you might see update in the UI with some delay. So far provider uses 1 second delay between sending the command and requesting an update.
To begin using this plugin you need to obtain a token from the device. There’re multiple options available, unfortunately all of them are kinda complicated. Since the last few versions vacuum changes its token after paring with the app and no longer advertises it. Below are possible ways to get it.
iOS app
- Connect vacuum through the Mi-Home app
- Create an unencrypted backup of your phone using iTunes
- Install iBackup Viewer
- Go to
com.xiaomi.mihome
- Extract file
123456789_mihome.sqlite
- Install SQLite Browser and load your file
- Run the following query
SELECT ZTOKEN FROM ZDEVICE WHERE ZMODEL LIKE "%vacuum%"
and copy 32-digit token Run the following command in your terminal
echo '0: <YOUR HEXADECIMAL STRING>' | xxd -r -p | openssl enc -d -aes-128-ecb -nopad -nosalt -K 00000000000000000000000000000000
Android app
WARN Latest app version is no longer storing token on the device and instead uses calls to Xiaomi Cloud.
- Downgrade your Mi-Home app to 5.0.0 version
- Enable developer mode and USB debugging on your phone
- Install ADB tools
- Create a backup of the application
adb backup -noapk com.xiaomi.smarthome -f backup.ab
- Confirm backup on your phone WITHOUT password
- Install ADB Backup Extractor
- Extract everything from the backup
java(.exe) -jar abe.jar unpack backup.ab backup.tar
, extract.tar
archive - Install SQLite Browser and load your file
- Run the following query
select token from devicerecord where name like "%Vacuum%"
Custom firmware
This method requires installing DustCloud custom firmware to obtain the root. Please refer to the official documentation for the details.
It’s much easier to install through flasher.py. If you have the latest firmware installed on your vacuum, do the factory reset first.
After DustCloud is installed, ssh into the device and get your token:
printf $(cat /mnt/data/miio/device.token) | xxd -p
Configuration options
Param | Required | Type | Default | Description |
---|---|---|---|---|
ip | yes | ipv4 | IP address of the vacuum | |
key | yes | string | Vacuum encryption key |
Supported properties
Property | Type | Description |
---|---|---|
vac_status | status | Status of the vacuum |
battery_level | percent | Current battery level |
fan_speed | percent | Current fan speed |
area | float | Last cleaned area (m2/ft2) |
duration | float | Time of the last cleaning (in seconds) |
Vacuum statuses
unknown
- Unknown statuscleaning
- Vacuum is in a cleaning statepaused
- Cleaning pauseddocked
- Vacuum is at the dockcharging
- Vacuum is charging and battery is lower than 80%, commands are disabled on UI. They will still work through the triggers/scripts.full
- Vacuum dust bag is full
Supported commands
Command | Input | Description |
---|---|---|
on |
Turns the device on | |
off |
Turns the device off | |
pause |
Pauses the device | |
dock |
Send vacuum to the dock station | |
find-me |
Makes vacuum to play Find Me sound |
|
set-fan-speed |
percent | Sets the fan speed |
Example
system: device
provider: vacuum/xiaomi
name: vacuum
ip: 192.168.0.31
key: 476d424348304f414776726d3330786e