Link to instructions

This commit is contained in:
Fabian Affolter 2017-08-26 13:42:19 +02:00
parent 9224600683
commit db6aa5e0b0
No known key found for this signature in database
GPG Key ID: DDF3D6F44AAB1336
2 changed files with 6 additions and 70 deletions

View File

@ -17,73 +17,7 @@ The `xiaomi` vacuum platform allows you to control the state of your [Xiaomi Mi
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.
Before you begin you need to install `libffi-dev` by running the command below. This is needed for `python-mirobi` to be installed correctly.
```bash
$ sudo apt-get install libffi-dev
```
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.
```bash
$ sudo su -s /bin/bash homeassistant
$ source /srv/homeassistant/bin/activate
```
To fetch the token follow these instructions depending on your mobile phone platform.
### {% linkable_title 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:
```bash
$ adb backup -noapk com.xiaomi.smarthome -f backup.ab
```
5. If you have this message: "More than one device or emulator", use this command to list all devices:
```bash
$ adb devices
```
and execute this command:
```bash
$ adb -s DEVICEID backup -noapk com.xiaomi.smarthome -f backup.ab # (with DEVICEID the device id from the previous command)
```
6. On the phone, you must confirm the backup. DO NOT enter any password and press button to make the backup.
7. Get ADB Backup Extractor: https://sourceforge.net/projects/adbextractor/
8. Extract All files from the backup:
```bash
$ java.exe -jar ../android-backup-extractor/abe.jar unpack backup.ab backup.tar ""
```
9. Unzip the ".tar" file.
10. Open the SQLite DB `miio2.db` with a tool like SQLite Manager extension for FireFox.
11. Get the token from "devicerecord" table.
### {% linkable_title Linux and Android (rooted!) %}
1. Configure the light with the Mi-Home app.
2. Enable developer mode, USB debugging and root permission only for ADB on the Android phone and plug it into the computer.
3. Get ADB f.e. `apt-get install android-tools-adb`
4. `adb devices` should list your device
5. `adb root` (does work for development builds only: ones with `ro.debuggable=1`)
6. `adb shell`
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.
### {% linkable_title 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/1234567_mihome.sqlite`** to your computer, where _1234567_ is any string of numbers.
5. Open the sqlite DB with a tool like SQLite Manager extension for FireFox, DB Browser, etc. You will then see the list of all the devices in your account with their token. The token you need is in the column **`ZToken`** and looks like **`123a1234567b12345c1d123456789e12`**.
## {% linkable_title Configuration %}
Please follow the instructions on [Retrieving the Access Token](/xiaomi/#retrieving-the-access-token) to get the API token to use in the `configuration.yaml` file.
To add a vacuum to your installation, add the following to your `configuration.yaml` file:
@ -92,13 +26,13 @@ To add a vacuum to your installation, add the following to your `configuration.y
vacuum:
- platform: xiaomi
host: 192.168.1.2
token: your-token-here
token: YOUR_TOKEN
```
Configuration variables:
- **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.
- **token** (*Required*): The API token of your robot.
- **name** (*Optional*): The name of your robot.
### {% linkable_title Platform services %}

View File

@ -46,6 +46,8 @@ What's not available?
Follow the setup process using your phone and Mi-Home app. From here you will be able to retrieve the key from within the app following [this tutorial](https://community.home-assistant.io/t/beta-xiaomi-gateway-integration/8213/1832)
Please check the instructions in this [section](/xiaomi/#retrieving-the-access-token) to get the API token to use with your platforms.
To enable Xiaomi gateway in your installation, add the following to your `configuration.yaml` file:
### {% linkable_title One Gateway %}
@ -127,7 +129,7 @@ Automation example
gw_mac: xxxxxxxxxxxx
```
### {% linkable_title Retrieving Access Token %}
### {% linkable_title Retrieving the Access Token %}
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. This token is needed for using various `xiaomi` platforms.