Here’s the instructions:
If you have access to an Android phone, you can download a hacked APK for the Mi Home app that shows the hidden token. Download Mi Home 5.4.54 APK
Install the hacked version of the Mi Home app and try again.
go to a directory named “.storage” under the home assistant config directory
edit “core.config_entries” file
locate two entries that look like [A] and delete them from the list. Please ensure the structure of file to be valid json format while tampering it.
restart home assistant
the device should be re-discovered and can be added normally again.
This was great but only after I read a lot of other data to just understand the instructions.
Clarification 1: The .storage directory is hidden by default when you use both the “File Editor” plugin or Visual Studio Code editor. You can change the settings in Visual Studio Code to show you the directory. I thought the instructions were old but the directory is there, you can find it in the terminal.
Clarification 2: To get the gateway password you have to:
Install the APK from the message above
Log in
Navigate to the Mi Control Hub device (or however you have it)
Click the 3 dots at the top (…) then go to “About”. In case you do not see the entry “Wireless communication protocol” keep tapping on the bottom on the screen the “Plug-in version: xxxx” text until you enable developer mode. After the “Wireless communication protocol” appears make sure you enable the first field “Wireless communication protocol” and use the password from the second field in the instructions above.
Clarification 3: here is the better-formatted JSON
You can use this Xiaomi-cloud-tokens-extractor This tool/script retrieves tokens for all devices connected to Xiaomi cloud and encryption keys for BLE devices.