home-assistant.github.io/source/_components/vacuum.xiaomi.markdown
2017-08-07 09:59:45 +02:00

6 KiB

layout title description date sidebar comments sharing footer logo ha_category ha_release
page Xiaomi Mi Robot Vacuum Instructions how to integrate your Xiaomi Mi Robot Vacuum within Home Assistant. 2017-05-05 18:11 true false true true xiaomi.png Vacuum 0.51

The xiaomi vacuum platform allows you to control the state of your Xiaomi Mi Robot Vacuum.

Current supported features are turn_on, pause, stop, return_to_home, turn_off (stops goes to dock), locate, clean_spot, set_fanspeed and even remote control your robot.

{% linkable_title Getting started %}

Follow the pairing process using your phone and Mi-Home app. From here you will be able to retrieve the token from a SQLite file inside your phone.

If your Home Assistant installation is running in a [Virtualenv](/docs/installation/virtualenv/#upgrading-home-assistant), make sure you activate it by running the commands below.

$ sudo su -s /bin/bash homeassistant
$ source /srv/homeassistant/bin/activate

In order to fetch the token follow these instructions depending on your mobile phone platform.

Windows and Android

  1. Configure the robot with the Mi-Home app.
  2. Enable developer mode and USB debugging on the Android phone and plug it into the computer.
  3. Get ADB tool for Windows : https://developer.android.com/studio/releases/platform-tools.html
  4. Create a backup of the application com.xiaomi.smarthome:
.\adb backup -noapk com.xiaomi.smarthome -f backup.ab
  1. If you have this message : "More than one device or emulator", use this command to list all devices:
.\adb devices

and execute this command:

.\adb -s DEVICEID backup -noapk com.xiaomi.smarthome -f backup.ab # (with DEVICEID the device id from the previous command)
  1. On the phone, you must confirm the backup. DO NOT enter any password and press button to make the backup.
  2. Get ADB Backup Extractor : https://sourceforge.net/projects/adbextractor/
  3. Extract All files from the backup:
java.exe -jar ../android-backup-extractor/abe.jar unpack backup.ab backup.tar ""
  1. Unzip the ".tar" file.
  2. Open the sqlite DB miio2.db with a tool like SQLite Manager extension for FireFox.
  3. Get token from "devicerecord" table.

macOS and iOS

  1. Setup iOS device with the Mi-Home app.
  2. Create an unencrypted backup of the device using iTunes.
  3. Install iBackup Viewer from here: http://www.imactools.com/iphonebackupviewer/
  4. Extract this file /raw data/com.xiami.mihome/_mihome.sqlite to your computer
  5. Open the file extracted using notepad. You will then see the list of all the device in your account with their token.

{% linkable_title Configuration %}

# Example configuration.yaml entry
vacuum:
- platform: xiaomi
  name: 'name of the robot'
  host: 192.168.1.2
  token: your-token-here

Configuration variables:

  • name (Optional): The name of your robot
  • host (Required): The IP of your robot
  • token (Required): The token of your robot. Go to Getting started section to read more about how to get it

{% linkable_title Platform services %}

In addition to all vacuum component services (turn_on, turn_off, start_pause, stop, return_to_home, locate, set_fanspeed and send_command), the xiaomi platform introduces specific services to access the remote control mode of the botvac.

These are: xiaomi_remote_control_start, xiaomi_remote_control_stop, xiaomi_remote_control_move and xiaomi_remote_control_move_step.

{% linkable_title Service vacuum/xiaomi_remote_control_start %}

Start the remote control mode of the vacuum cleaner. You can then move it with remote_control_move, when done call remote_control_stop.

Service data attribute Optional Description
entity_id yes Only act on specific botvac. Else targets all.

{% linkable_title Service vacuum/xiaomi_remote_control_stop %}

Exit the remote control mode of the vacuum cleaner.

Service data attribute Optional Description
entity_id yes Only act on specific botvac. Else targets all.

{% linkable_title Service vacuum/xiaomi_remote_control_move %}

Remote control the vacuum cleaner, make sure you first set it in remote control mode with remote_control_start.

Service data attribute Optional Description
entity_id yes Only act on specific botvac. Else targets all.
velocity no Speed, between -0.29 and 0.29.
rotation no Rotation, between -179 degrees and 179 degrees.
duration no Parameter affecting the duration of the movement.

{% linkable_title Service vacuum/xiaomi_remote_control_move_step %}

Use this call to enter the remote control mode, make one movement, and stop and exit the remote control mode.

Service data attribute Optional Description
entity_id yes Only act on specific botvac. Else targets all.
velocity no Speed, between -0.29 and 0.29.
rotation no Rotation, between -179 degrees and 179 degrees.
duration no Parameter affecting the duration of the movement.