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
Copy file name to clipboardExpand all lines: source/_components/xiaomi.markdown
+65-4Lines changed: 65 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -44,10 +44,7 @@ What's not available?
44
44
- Decoupled mode of the Aqara Wall Switches (Single & Double)
45
45
- Additional alarm events of the Gas and Smoke Detector: Analog alarm, battery fault alarm (smoke detector only), sensitivity fault alarm, I2C communication failure
46
46
47
-
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)
48
-
49
-
50
-
47
+
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)
51
48
52
49
To enable Xiaomi gateway in your installation, add the following to your `configuration.yaml` file:
53
50
@@ -130,6 +127,70 @@ Automation example
130
127
gw_mac: xxxxxxxxxxxx
131
128
```
132
129
130
+
### {% linkable_title Retrieving Access Token %}
131
+
132
+
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.
133
+
134
+
Before you begin you need to install `libffi-dev` by running the command below. This is needed for `python-mirobi` to be installed correctly.
135
+
136
+
```bash
137
+
$ sudo apt-get install libffi-dev
138
+
```
139
+
140
+
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.
141
+
142
+
```bash
143
+
$ sudo su -s /bin/bash homeassistant
144
+
$ source /srv/homeassistant/bin/activate
145
+
```
146
+
147
+
To fetch the token follow these instructions depending on your mobile phone platform.
148
+
149
+
#### {% linkable_title Windows and Android %}
150
+
151
+
1. Configure the robot with the Mi-Home app.
152
+
2. Enable developer mode and USB debugging on the Android phone and plug it into the computer.
153
+
3. Get ADB tool for Windows: https://developer.android.com/studio/releases/platform-tools.html
154
+
4. Create a backup of the application com.xiaomi.smarthome:
10. Open the SQLite DB `miio2.db` with a tool like SQLite Manager extension for FireFox.
174
+
11. Get the token from "devicerecord" table.
175
+
176
+
#### {% linkable_title Linux and Android (rooted!) %}
177
+
178
+
1. Configure the light with the Mi-Home app.
179
+
2. Enable developer mode, USB debugging and root permission only for ADB on the Android phone and plug it into the computer.
180
+
3. Get ADB f.e. `apt-get install android-tools-adb`
181
+
4. `adb devices` should list your device
182
+
5. `adb root` (does work for development builds only: ones with `ro.debuggable=1`)
183
+
6. `adb shell`
184
+
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.
185
+
186
+
#### {% linkable_title macOS and iOS %}
187
+
188
+
1. Setup iOS device with the Mi-Home app.
189
+
2. Create an unencrypted backup of the device using iTunes.
190
+
3. Install iBackup Viewer from here: http://www.imactools.com/iphonebackupviewer/
191
+
4. Extract this file: **`/raw data/com.xiami.mihome/1234567_mihome.sqlite`** to your computer, where _1234567_ is any string of numbers.
192
+
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`**.
0 commit comments