Get Xiaomi Robot Token & IP from Mi Home App (Android) without 3rd-party apps

I find a new and easier way to obtain Token & IP by using only the log file of Mi Home App on Android (I use the latest version on Play Store, currently: 5.4.54). This doesn’t involve third-party apps, except for a file manager and a text-viewer, any will do. And you can do it easily on Android.

First, use any file manager to access folder SMARTHOME/LOGS on INTERNAL MEMORY of your Android phone. Look for a log file with format yyyy-MM-dd.txt (for ex: 2019-02-01), choose the most recent file (today date).
Open that file with a text editor of your choice and search for the name of Xiaomi Robot (default: Mi Robot Vacuum), you will find something like this:

{"did":"117383849","token":"90557f13732y2494h278314a74d547b5","longitude":"x","latitude":"y","name":"Mi Robot Vacuum","pid":"0","localip":"192.168.88.68","mac":"40:31:3C:AA:BB:CC","ssid":"Your AP Name","bssid":"E4:8D:8C:EE:FF:GG","parent_id":"","parent_model":"","show_mode":1,"model":"rockrobo.vacuum.v1","adminFlag":1,"shareFlag":0,"permitLevel":16,"isOnline":true,"desc":"Zoned cleanup","extra":{"isSetPincode":0,"fw_version":"3.3.9_003460","needVerifyCode":0,"isPasswordEncrypt":0},"event":{"event.back_to_dock":"{\"timestamp\":1548817566,\"value\":[0]}

From here you can extract Token and Ip of the robot (“token”:“90557f13732y2494h278314a74d547b5”, “localip”:“192.168.88.68”

Can somebody confirm this method is working?

I can’t find this folder or file on my Android device.

Further testing indicates it’s only working on Mi Home v5.4.54. Read this https://github.com/jghaanstra/com.xiaomi-miio/issues/80

Yes, found out that downgrading the app did the trick. Used the MI Toolkit to get the token, it is working fine now.

With this trick, you need only official Mi Home app on Android, which is far more easier and convenient than any methods known before. And it works for all MIIO devices not just the vacuum robot.

1 Like

It is still the same solution, latest Xiaomi Home 5.5.x application doesn’t work (token is not shown in the text file)

Still have to install version 5.4.54 (link) - shows all the tokens for all xiaomi devices

I have had to retrieve a changed token for no known reason that I can identify. I used 5.4.54 successfully and we are back connected… HOWEVER…
The coords seem to be confused. I am using the xiaomi_vacuum_map_card and the debug mode suggests that the coords I set up before the token reset are still in the right place on the map but it is like the vacuum itself has turned its coord system through 180 degrees. Anyone seen this ? Any clues?

any ideea for 5.8.7? cause I cant fing in the daily logs.

The only way I ever managed to retrieve the token is by removing the Mi Home app and installing the older v5.4.49 as per the instructions here under “Alternative methods” https://www.home-assistant.io/integrations/xiaomi_miio/#retrieving-the-access-token. I have only had to repeat the procedure once over the last 3 years when the token was renewed for some reason.

In my journey around the web today I found this link micloud/README.md at master · Squachen/micloud (github.com) which allowed me to get my token out of the cloud.

Thanks to Retrieval of tokens from cloud · Issue #810 · rytilahti/python-miio (github.com)