From 0fa6469cf0d5b2edecf68f50f1e27565dd944be0 Mon Sep 17 00:00:00 2001 From: Willian Z Date: Thu, 10 Jan 2019 20:04:39 +0800 Subject: [PATCH 1/2] Update obtain_token.md for Mac/Linux users --- docs/obtain_token.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/obtain_token.md b/docs/obtain_token.md index d4de28f..107820e 100644 --- a/docs/obtain_token.md +++ b/docs/obtain_token.md @@ -41,13 +41,17 @@ Use these methods to obtain the device token for devices that hide their tokens #### Non-Rooted Android Phones * Setup your Android device with the Mi Home app * Enable developer mode and USB debugging on your phone and connect it to your computer -* Get the ADB tool for Windows: https://developer.android.com/studio/releases/platform-tools.html -* Create a backup of the Mi Home app: .\adb backup -noapk com.xiaomi.smarthome -f backup.ab +* Get the ADB tool + - for Windows: https://developer.android.com/studio/releases/platform-tools.html + - for Mac: `brew install adb` +* Create a backup of the Mi Home app: `.\adb backup -noapk com.xiaomi.smarthome -f backup.ab` * On your phone you must confirm the backup. Do not enter any password and press button to make the backup -* Get ADB Backup Extractor and install it: https://sourceforge.net/projects/adbextractor/ -* Extract all files from the backup on your computer: java.exe -jar ../android-backup-extractor/abe.jar unpack backup.ab backup.tar +* (Windows Only) Get ADB Backup Extractor and install it: https://sourceforge.net/projects/adbextractor/ +* Extract all files from the backup on your computer: + - for Windows: `java.exe -jar ../android-backup-extractor/abe.jar unpack mi-home-backup.ab backup.tar` + - for Mac & Unix: `( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 mi-home-backup.ab) | tar xfvz -` * Unzip the ".tar" file -* Open /com.xiaomi.smarthome/database/miio2.db with a SQLite browser (for instance http://sqlitebrowser.org/) +* Open /com.xiaomi.smarthome/db/miio2.db with a SQLite browser (for instance http://sqlitebrowser.org/) * Execute the query "select token from devicerecord where localIP is '192.168.0.1'" where you replace the IP address with the IP address of the Mi Home device you want to get the token from. It will show you the 32 character device token for your Mi Home device. ### iOS users From 6d3ae84537df579ff90f6ff6bb31cef6dd8616d4 Mon Sep 17 00:00:00 2001 From: Willian Z Date: Thu, 10 Jan 2019 20:07:03 +0800 Subject: [PATCH 2/2] Update obtain_token.md --- docs/obtain_token.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/obtain_token.md b/docs/obtain_token.md index 107820e..fdbd65d 100644 --- a/docs/obtain_token.md +++ b/docs/obtain_token.md @@ -44,7 +44,9 @@ Use these methods to obtain the device token for devices that hide their tokens * Get the ADB tool - for Windows: https://developer.android.com/studio/releases/platform-tools.html - for Mac: `brew install adb` -* Create a backup of the Mi Home app: `.\adb backup -noapk com.xiaomi.smarthome -f backup.ab` +* Create a backup of the Mi Home app: + - for Windows: `.\adb backup -noapk com.xiaomi.smarthome -f mi-home-backup.ab` + - for Mac: `adb backup -noapk com.xiaomi.smarthome -f mi-home-backup.ab` * On your phone you must confirm the backup. Do not enter any password and press button to make the backup * (Windows Only) Get ADB Backup Extractor and install it: https://sourceforge.net/projects/adbextractor/ * Extract all files from the backup on your computer: