You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Instructions how to integrate your Xiaomi Mi Robot Vacuum within Home Assistant."
4
+
description: "Instructions on how to integrate your Xiaomi Mi Robot Vacuum within Home Assistant."
5
5
date: 2017-05-05 18:11
6
6
sidebar: true
7
7
comments: false
@@ -13,16 +13,29 @@ ha_release: 0.51
13
13
ha_iot_class: "Local Polling"
14
14
---
15
15
16
-
The `xiaomi miio` vacuum platform allows you to control the state of your [Xiaomi Mi Robot Vacuum](http://www.mi.com/roomrobot/).
16
+
The `xiaomi miio` vacuum platform allows you to control the state of your
17
+
[Xiaomi Mi Robot Vacuum](http://www.mi.com/roomrobot/).
17
18
18
-
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.
19
+
Currently supported features are:
19
20
20
-
Please follow the instructions on [Retrieving the Access Token](/components/vacuum.xiaomi/#retrieving-the-access-token) to get the API token to use in the `configuration.yaml` file.
21
+
-`turn_on`
22
+
-`pause`
23
+
-`stop`
24
+
-`return_to_home`
25
+
-`turn_off` (stop all activity and return to dock)
26
+
-`locate`
27
+
-`clean_spot`
28
+
-`set_fanspeed`
29
+
- remote control of your robot.
21
30
22
-
To add a vacuum to your installation, add the following to your `configuration.yaml` file:
31
+
Please follow [Retrieving the Access Token](/components/vacuum.xiaomi/#retrieving-the-access-token) to retrieve the API token used in
32
+
`configuration.yaml`.
33
+
34
+
## {% linkable_title Configuring the Platform %}
35
+
36
+
To add a vacuum to your installation, add the following to `configuration.yaml`:
23
37
24
38
```yaml
25
-
# Example configuration.yaml entry
26
39
vacuum:
27
40
- platform: xiaomi_miio
28
41
host: 192.168.1.2
@@ -35,77 +48,99 @@ Configuration variables:
35
48
- **token** (*Required*): The API token of your robot.
36
49
- **name** (*Optional*): The name of your robot.
37
50
38
-
### {% linkable_title Platform services %}
51
+
## {% linkable_title Platform Services %}
39
52
40
-
In addition to all [`vacuum` component services](/components/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.
53
+
In addition to [all of the services provided by the `vacuum` component]
| `entity_id` | yes | Only act on specific botvac. Else targets all. |
79
-
| `velocity` | no | Speed, between -0.29 and 0.29. |
80
-
| `rotation` | no | Rotation, between -179 degrees and 179 degrees. |
81
-
| `duration` | no | Parameter affecting the duration of the movement. |
99
+
| `entity_id` | yes | Only act on specific robot; default targets all |
100
+
| `velocity` | no | Speed:between -0.29 and 0.29. |
101
+
| `rotation` | no | Rotation:between -179 degrees and 179 degrees. |
102
+
| `duration` | no | The number of seconds that the robot should move for |
82
103
83
-
### {% linkable_title Attributes %}
104
+
## {% linkable_title Attributes %}
84
105
85
-
In addition to all [`vacuum` component attributes] (`battery_icon`, `cleaned_area`, `fan_speed`, `fan_speed_list`, `status`, `params`), the `xiaomi` platform introduces specific attributes to get information of the botvac.
106
+
In addition to [all of the attributes provided by the `vacuum` component](https://home-assistant.io/components/vacuum/#attributes),
107
+
(`battery_icon`, `cleaned_area`, `fan_speed`, `fan_speed_list`, `status`, and
108
+
`params`), the `xiaomi` platform introduces specific attributes. These are:
86
109
87
-
These are: `cleaning_time`, `do_not_disturb`, `main_brush_left`, `side_brush_left`, `filter_left`, `cleaning_count`, `total_cleaned_area` and `total_cleaning_time`.
110
+
- `cleaning_time`
111
+
- `do_not_disturb`
112
+
- `main_brush_left`
113
+
- `side_brush_left`
114
+
- `filter_left`
115
+
- `cleaning_count`
116
+
- `total_cleaned_area`
117
+
- `total_cleaning_time`
88
118
89
-
The following table shows the units of measurement for the single attributes.
119
+
The following table shows the units of measurement for each attribute:
| `cleaning_time` | minutes | Last / actual cleaning time in minutes |
95
-
| `cleaned_area` | square meter | Last / actual cleaned area in square meter |
125
+
| `cleaned_area` | square meter | Last / actual cleaned area in square meters |
96
126
| `main_brush_left` | hours | Hours left until a change of the main brush is needed |
97
127
| `side_brush_left` | hours | Hours left until a change of the side brush is needed |
98
128
| `filter_left` | hours | Hours left until a change of the filter is needed |
99
-
| `cleaning_count` | | Number of total cleaning passage |
100
-
| `total_cleaned_area` | square meter | Total cleaned area in square meter |
129
+
| `cleaning_count` | | Number of total cleaning cycles |
130
+
| `total_cleaned_area` | square meter | Total cleaned area in square meters |
101
131
| `total_cleaning_time` | minutes | Total cleaning time in minutes |
102
132
103
-
### {% linkable_title Retrieving the Access Token %}
133
+
## {% linkable_title Retrieving the Access Token %}
104
134
105
135
<p class='note'>
106
-
This token (32 hexadecimal characters) is required for the Xiaomi Mi Robot Vacuum and Xiaomi Philips Light. The Xiaomi Gateway uses another security method and requires a `key` (16 alphanumeric chars) which can be obtained easily via a hidden menu item at the Mi-Home app.
136
+
This token (32 hexadecimal characters) is required for the Xiaomi Mi Robot
137
+
Vacuum and Xiaomi Philips Lights. The Xiaomi Gateway uses another security
138
+
method and requires a `key` (16 alphanumeric chars), which can be obtained
139
+
easily via a hidden menu item at the Mi-Home app.
107
140
</p>
108
141
142
+
#### {% linkable_title Windows and Android %}
143
+
109
144
Follow the pairing process using your phone and Mi-Home app. You will be able to retrieve the token from a SQLite file inside your phone.
110
145
111
146
Before you begin you need to install `libffi-dev` and `libssl-dev` by running the command below. This is needed for `python-mirobo` to be installed correctly.
#### {% linkable_title Linux and Android (rooted!) %}
154
187
155
-
1. Configure the light with the Mi-Home app.
188
+
Follow the pairing process using your phone and Mi-Home app. You will be able to retrieve the token from a SQLite file inside your phone.
189
+
190
+
Before you begin you need to install `libffi-dev` and `libssl-dev` by running the command below. This is needed for `python-mirobo` to be installed correctly.
191
+
192
+
```bash
193
+
$ sudo apt-get install libffi-dev libssl-dev
194
+
```
195
+
196
+
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.
197
+
198
+
```bash
199
+
$ sudo su -s /bin/bash homeassistant
200
+
$ source /srv/homeassistant/bin/activate
201
+
```
202
+
203
+
To fetch the token follow these instructions depending on your mobile phone platform.
204
+
205
+
1. Configure the robot with the Mi-Home app.
156
206
2. Enable developer mode, USB debugging and root permission only for ADB on the Android phone and plug it into the computer.
157
207
3. Get ADB f.e. `apt-get install android-tools-adb`
158
208
4. `adb devices` should list your device
159
209
5. `adb root` (does work for development builds only: ones with `ro.debuggable=1`)
160
210
6. `adb shell`
161
211
7. `echo "select name,localIP,token from devicerecord;" | sqlite3 /data/data/com.xiaomi.smarthome/databases/miio2.db` returns a list of all registered devices including IP address and token.
212
+
213
+
#### {% linkable_title iOS %}
214
+
215
+
1. Configure the robot with the Mi-Home app.
216
+
2. Using iTunes, create an unencrypted backup of your iPhone.
217
+
3. Install [iBackup Viewer](Get ADB f.e. `apt-get install android-tools-adb`), open it, and open your backup.
218
+
4. Open the "Raw Data" module.
219
+
5. Navigate to `com.xiaomi.mihome`.
220
+
6. Search for a file that looks like this: `123456789_mihome.sqlite`– note that `_mihome.sqlite` is *not* the correct file.
221
+
7. Save this file to your filesystem.
222
+
8. Install [DB Browser for SQLite](http://sqlitebrowser.org/).
223
+
9. Open DB Browser and load the `.sqlite` file you saved from your backup.
224
+
10. Click on the `Execute SQL` tab.
225
+
11. Input and run this query: `SELECT ZTOKEN FROM ZDEVICE WHERE ZNAME = "Mi Robot Vacuum"`
226
+
12. Copy the returned 32-digit hexadecimal string to your clipboard.
227
+
13. Open `Terminal` and execute this command: `echo '0: <YOUR HEXADECIMAL STRING>' | xxd -r -p | openssl enc -d -aes-128-ecb -nopad -nosalt -K 00000000000000000000000000000000`
0 commit comments