How to get Xiaomi token on iOS device
May 25, 2020
Based on this tutorial you can extract tokens for all Xiaomi devices like Air Purifier, Smartmi Standing Fan, Da Fang camera or Mi LED Desk Lamp. It works for all iOS devices regardless it's jailbroken or not. You can use extracted token to control your Xiaomi device using alternative apps like Apple HomeKit through Homebridge, Domoticz or Home Assistant.
If you have tried the method using miIO library without luck this might be the solution for you.
Before start you have to get and install Xiaomi Home iOS app. Also you need to add there and configure your Xiaomi device with WiFi. If you can control your device using Xiaomi Home means that you are good and you can continue on this tutorial.
How to get the device token out of the iOS backup
npm i ibackuptool --save
- List all the backups on your computer.
- Extract Xiaomi Home database from your backup.
ibackuptool -b "UUID_FROM_PREVIOUS_STEP" -r backup.files --extract extraction_destination --filter "mihome.sqlite"
- Open Xiaomi Home databse.
cd extraction_destination/AppDomain-com.xiaomi.mihome/Documents/ sqlite3 1595971111_mihome.sqlite
- Run this query to get Xiaomi tokens.
select ZTOKEN, ZLOCALIP from ZDEVICE;
- Go to this webpage and decrypt extracted Xiaomi token.