Xiaomiโs robot vacuum cleaners are some of the most popular smart home devices, but fully managing them through third-party applications (like Home Assistant or ioBroker) requires a dedicated access token. Without it, you wonโt be able to integrate the vacuum cleaner into your own automation system, customize advanced scenarios, or use alternative branded clients.
The problem is that Xiaomi doesnโt officially provide the token to users โ it needs to be extracted independently. In this article, we will discuss all the current ways to obtain the token for Mi Robot Vacuum, Mi Robot Vacuum-Mop, Xiaowa and others, including bypassing the new restrictions of 2023-2026. You will learn how to do this through Mi Home, ADB, HTTP-Proxies and even without root rights on the phone.
Importantly, the procedure is different for devices tied to cn (China), ru (Russia) and eu (Europe), and we will specify the nuances for each region.
1 What is Xiaomi Token and Why is it Needed
A token is a unique 32-character key (e.g. a1b2c3d4e5f6...1234567890abcdef) that identifies your device in the Xiaomi cloud.
- ๐ Integration with Home Assistant, ioBroker or Node-RED โ without a token, these systems will not be able to send commands to the vacuum cleaner.
- ๐ฑ Use alternative applications (such as Mi Home Lite or Vacuum Map) that offer advanced map, cleaning and statistics features.
- ๐ ๏ธ Debugging and Diagnostics through Python libraries like python-miio.
- โ๏ธ Automatic scripting settings (for example, running a scheduled cleaning service through Google Assistant or Alice without a branded app).
Since 2022, Xiaomi has tightened its security policy, with tokens being dynamically updated (every 2-3 months) and the old methods of extracting them no longer working.
โ ๏ธ Warning: Donโt give your token to third parties! It can be used to control your vacuum cleaner remotely, including starting a cleaning or changing settings.
2. Method 1: Receiving a token through Mi Home (the easiest)
This method works for most models (Mi Robot Vacuum 1S, Mi Robot Vacuum-Mop 2 Lite, etc.) if the device is tied to a Xiaomi account on the ru, eu or us server. For Chinese servers (cn), additional configuration will be required (see section 4).
Steps:
- Install the latest version of Mi Home from Google Play or App Store.
- Log in to your Xiaomi account and make sure the vacuum cleaner is connected to the app.
- Go to Profile โ Settings โ General settings โ About the program and tap 5-7 times according to the application version until the inscription โYou became a developerโ appears.
- Return to the main menu, open the list of devices and select your vacuum cleaner.
- Put three points on it (โฎ) in the upper right corner and select "Device Information".
- Scroll down to the Token block - copy it.
โ๏ธ What to do if the token is not in Mi Home
If the token is not in the device information, then your account is tied to a Chinese server (cn), or Xiaomi has hidden this option for your model.
3. Method 2: Extracting a token through HTTP-proxy (no root rights)
This method is suitable for Android users who do not have root rights, but have access to the vacuum cleaner's Wi-Fi network.We will intercept traffic between the Mi Home app and Xiaomi servers using the help of the Wi-Fi vacuum cleaner. HTTP-proxy.
It is necessary:
- ๐ฑ Android smartphone (version 8.0 and higher).
- ๐ป Computer with Python 3.8 installed+ and the mitmproxy library.
- ๐ก The vacuum cleaner and phone must be connected to the same Wi-Fi network.
Instructions:
- Install mitmproxy on your computer: pip install mitmproxy
- Launch a proxy server: mitmproxy --mode transparent --showhost (remember IP-address and port, for example, 192.168.1.100:8080).
- On your phone, set up your Wi-Fi connection so that traffic goes through a proxy: Open your Wi-Fi settings. Tap on the current network โ Change Network โ More. Select Manual Proxy Setup and enter your mitmproxyโs IP/port.
- Install mitmproxy certificate on your phone: Open in the browser http://mitm.it. Download the certificate for Android and install it in Settings โ Security โ Certificate Installation.
Mi Home
mitmproxy
api.io.mi.com
/home/device_list
Example of server response (see the "token" field):
{
"result": [
{
"did": "1234567890",
"token": "a1b2c3d4e5f67890123456789abcdef01",
"name": "Mi Robot Vacuum",
"model": "roborock.vacuum.s5"
}
]
}โ ๏ธ Note: Since 2023, Xiaomi has been encrypting some of the traffic. If there is no token in the response, try Method 3 or use Packet Capture (an Android app with interception function). HTTPS).
4. Method 3: Obtaining a token through ADB (for advanced)
If previous methods failed, you can extract the token directly from the memory of the Mi Home app using ADB (Android Debug Bridge), which requires USB debugging on the phone, but does not require root rights.
Preparation:
- ๐ง Turn on Developer Mode on your phone (tap 7 times on build number in Settings) โ The phone).
- ๐ Turn on Debugging. USB developer-setting.
- ๐ป Install. ADB on the computer (instructions for Windows/Linux/macOS).
Step-by-step:
- Connect the phone to your computer via USB and confirm access for debugging.
- Execute the command to obtain a list of packages: adb shell pm list packages | grep mihome (should display com.xiaomi.smarthome).
- Download the Mi Home database: adb pull /data/data/com.xiaomi.smarthome/databases/mihome.db
- Open mihome.db with SQLite Browser or DB Browser for SQLite.
- Go to the device table โ the token column will have the desired key.
If the table of devices is empty or there is no token:
- ๐ Update the data in Mi Home (pull the screen down).
- ๐ฑ Restart the application.
- ๐ Check the other tables: device_record or miot_devices.
adb backup -f mihome.ab com.xiaomi.smarthomeThen extract the data from the backup with abe (Android Backup Extractor).-->
5. Method 4: For vacuum cleaners on a Chinese server (cn)
Devices tied to the cn server in China require additional actions due to the strict restrictions of Xiaomi, which can help to change the account region or use an intermediary (for example, the Mi Account Unlocker service).
Option 1: Change the region of the account
- Go to account.xiaomi.com and log in.
- Go to Personal Info โ Country/Region.
- Change the region to Russia (ru), Europe (eu) or Singapore (sg).
- Confirm the change by SMS/email.
- Remove the vacuum cleaner from the Mi Home and add it again โ the token will appear in the device information.
Option 2: Use Mi Account Unlocker
If the change of region did not help, use services like com.xiaomi_miio (Risk: such methods may violate Xiaomiโs user agreement.
| server | Method of obtaining a token | Difficulty | Risks. |
|---|---|---|---|
| ru/eu/us | Through Mi Home (Section "Device Information") | โญ (simple) | No. |
| cn | Change of account region + re-binding | โญโญ (middle-of-the-road) | You may need a VPN. |
| Anybody. | HTTP-proxy (mitmproxy) | โญโญโญ (difficult) | Requires skills to work with ADB |
| Anybody. | ADB (DB extraction) | โญโญโญโญ (advanced) | I need a USB debugging. |
โ ๏ธ Note: After the change of cn region โ Some vacuum cleaner functions (such as voice commands in Chinese) may stop working, and Xiaomi may block an account for frequent changes in the region (limit - 1 time every 30 days).
6. Frequent errors and their solutions
When you get a token, you're going to have a typical problem, and we've collected some of the most common ways to fix it.
- ๐ด "Token not in Mi Home": Check the version of the app (should be the last one). Make sure the vacuum cleaner is tied to the same account as the phone. Change server region (see Method 4).
- ๐ด "Mitmproxy doesn't intercept traffic": "Verify that the certificate is installed in trusted. HTTPS-Check in Mi Home settings (if you have one). Use Packet Capture instead of mitmproxy.
- ๐ด "ADB Not seeing the device: Install drivers for your phone (e.g. Google) USB Driver. Try another one. USB-Cable (original, preferably) Turn on Debugging USB (safety settings).
- ๐ด "Token doesn't work in Home Assistant": Check you've copied the token without spaces. Update Xiaomi Miio integration into Home Assistant. make sure the vacuum cleaner is on the network (Wi-Fi indicator burns blue).
What to do if the token has changed?
7 Security: How to Protect Your Token
The token gives you complete control over your vacuum cleaner, so it should be stored as carefully as the password from your Xiaomi account.
- ๐ Do not publish the token in open sources (forums, GitHub, comments).
- ๐ Store the token in a secure location (for example, in the Bitwarden or KeePass password manager).
- ๐ Regularly update the token (every 3-6 months), especially if you suspect a leak.
- ๐ก๏ธ Use two-factor authentication in your Xiaomi account.
If you suspect that the token has been compromised:
- Untie the vacuum cleaner from your Mi Home account immediately.
- Change the password from your Xiaomi account.
- Get a new token and update it in all integrations.
๐ก
Never enter a token on suspicious sites promising โextended featuresโ for a vacuum cleaner, and fraudsters can use it to remotely control your device or steal account data.