How to find out the token of the vacuum cleaner Xiaomi on Windows: a detailed guide

Integrating smart tech into a single ecosystem often requires special access keys. If you’re an owner of Xiaomi Mi Robot Vacuum or any other brand model, you may need a device token to connect to third-party smart home systems like Home Assistant, or to use advanced features via APIs.

Windows users face difficulties, as official utilities for extracting this key are often sharpened for Linux or macOS. However, there are proven methods to circumvent this limitation.

In this article, we will discuss the current ways to obtain a token without having to install complex virtual machines or disassemble a device, and you will learn to use emulators and specialized software to safely extract the necessary data.

What is a device token and why is it needed

The token is a unique string of 32 hexadecimal characters that serves as the authorization key between your smartphone and a smart device. Without this key, the MiIO protocol used by Xiaomi will not allow third-party software to send commands to the vacuum cleaner.

The main purpose of the token implementation is security, even if the attacker finds out IP-The address of your router, it can't control the hardware without this secret bundle, which is why the token doesn't show up in the standard interface of the Mi Home app.

Obtaining this code is necessary in the following cases:

  • πŸ”‘ Set up integration with Home Assistant to create complex automation scenarios.
  • 🌐 Using local management through LAN, Installations to be executed instantly without cloud server delays.
  • πŸ›  Diagnostics and debugging of the device through the command line or specialized utilities like miio-cli.

⚠️ Warning: The token is a secret access key. Never give it to anyone else or publish screenshots of it in public.

It is important to understand that the token is tied to a specific Xiaomi Cloud account and a specific device. If you drop the vacuum cleaner to the factory settings or link it to another account, the token will change and you will have to repeat the procedure.

Workplace preparation and necessary tools

Before we start extracting data, we need to prepare the software environment on your Windows computer, and since it is impossible to connect directly to the phone database without root rights, we will go by emulation or using web interfaces.

You will need a stable internet connection and Xiaomi account, which is already tied to the vacuum cleaner. Make sure that the Mi Home app on your smartphone works correctly and displays the device on the network.

To work on Windows, we will need the following components:

  • πŸ’» Google Chrome or Chromium-based browser (Edge, Yandex.Browser) with installed extensions for working with the browser API.
  • πŸ“± Android Emulator (e.g. BlueStacks, NoxPlayer or LDPlayer) – optional if the web method doesn’t work.
  • πŸ“¦ Python 3.x A set of miio or python-miio libraries for advanced users who want to automate the process.

It is also recommended to back up important data, although the methods described are safe and do not require flashing the device.

πŸ“Š What is your main method of managing a smart home?
Official Mi Home appendix
Home Assistant
Yandex Smart Home
Google Home
Apple HomeKit

Method 1: Use of browser extension (the easiest)

The fastest way to get a token on Windows is to use a specialized browser extension, which does not require heavy emulators and works directly through the Xiaomi Web authorization interface.

First, you need to install an extension, such as Xiaomi Cloud Tokens Extractor. After installation, open the extension bar and find the corresponding plugin. You will be prompted to enter the username and password from your Mi Account.

The process is as follows:

  1. Click on the extension icon and select your server region (e.g. Europe or Russia).
  2. Enter the credentials and click the Get Tokens button.
  3. The system will request a confirmation code, which will come in the form of an SMS or push notification to your phone.
  4. Enter the code in the extension field, and after successful authorization, you will see a list of all the devices with their tokens.

Find your vacuum cleaner (usually designated as roborock.vacuum or similar identifier) and copy the 32-digit code. This is the key you want.

⚠️ Attention: Using third-party extensions requires you to enter a password from your account.Make sure you use an open source extension with positive community reviews to eliminate the risk of data theft.

If the extension can’t find the devices, check if the server region is correctly selected. A server error (e.g., choosing China over Europe) will result in an empty list of devices, even if the login is correct.

Method 2: Android Emulator on Windows

If the web method didn’t work or you prefer a more isolated environment, you can run a full-fledged Mi Home app inside the Android emulator on your PC, which is considered more secure since you don’t pass the password to third-party scripts.

Download and install any popular emulator, such as NoxPlayer or BlueStacks. Once you run the emulator, you need to download it. APK-It is best to download the latest version from the official Xiaomi website or a reliable resource like APKPure, since emulators often do not have Google Play Store or it works incorrectly.

Next, perform the following actions:

  • πŸ“² Install. APK to the emulator and launch the application.
  • πŸ” Sign in to your Xiaomi account.
  • πŸ“‚ Enable Root access in the emulator settings (usually through the emulator settings in the Root permissions section").
  • πŸ“ Install a file manager with access to system folders (e.g., Root Explorer).

β˜‘οΈ Preparation of the emulator

Done: 0 / 4

After authorization and the vacuum cleaner appears in the list of devices, go to the file manager on the way:

/data/data/com.xiaomi.smarthome/files/miio_storage

Or, depending on the version of the app:

/data/data/com.xiaomi.smarthome/databases/miio.db

You need to find a file with the.token extension or a database containing tokens. UID Copy this file onto a computer and open it with a text editor or HEX-editor to see the string of token.

Method 3: Using Python scripts (For Advanced)

For those who are not afraid of the command line, the python-miio library is a great solution, and it works on any operating system, including Windows, with Python installed.

First, install Python from the official site, be sure to tick Add Python to PATH when you install it. Then open the command prompt (cmd) or PowerShell and install the required library with the command:

pip install python-miio

Next, we need to get the token through interception or using a known bug in older versions of the protocol, but the most reliable way for Windows is to use the miio utility in conjunction with an emulator or a pre-received token. However, if you have the ability to run a Linux script or use WSL (Windows Subsystem for Linux), you can use the command:

miio extract-tokens --username your login --password your password

The table below shows a comparison of methods in terms of complexity and reliability:

MethodDifficultySecuritySkills required
Browser extensionLow.MediumBasic
Android emulatorMediumTall.Average.
Python / CLITall.Tall.Advanced
Root on the phoneVery high.Tall.Expert

Using Python gives you the most control. You can not only get a token, but you can also immediately send a test command to the vacuum cleaner, for example, start cleaning or send it to the base.

⚠️ Warning: When working with the command line, carefully check the syntax of commands. Error in arguments can lead to blocking IP-Xiaomi servers because of too frequent requests.

Problems with server regions and their solution

One of the most common problems when trying to learn a token is the wrong region: Xiaomi’s ecosystem is divided into several independent clusters: China, Europe, Russia, India, the United States and others.

If your account is registered in the Russia region and you are trying to get a token through the China server, the request will return an authorization error or an empty list of devices.

How to determine the correct server:

  • 🌍 Open the Mi Home app on your phone.
  • πŸ‘€ Go to the profile (the tab "My").
  • πŸ“ Look at the top of the screen and see the current region (e.g., "Russia" or "Germany").
What if the region is not defined?
If the app does not explicitly specify the region, try to remember where you registered an account. Often users from the CIS use a server "Russia" or "Germany". Try to go through the main European servers in the utility to get a token.

Also, you should consider that some devices may be β€œlocked” in the Chinese region, and if you bought a vacuum cleaner on AliExpress, it may require a connection to a cn server (China), even if you are in Europe, in which case the application will have to change region, which may take time.

Set up local management after receiving the token

Once you have successfully copied the 32-character key, it’s time to apply it, most often in the integration settings in Home Assistant or in the configuration file of the plugin for the smart home.

The process of adding a device usually looks like this: you choose the Xiaomi Miio platform, type in IP-the address of the vacuum cleaner (it can be found in the router or in the Mi Home application in the properties of the device) and insert the received token.

To check the performance, you can use a simple command in the terminal (if you have python-miio installed):

miio --ip 192.168.1.XXX --token your status

In return, you should receive JSON-object with the current vacuum cleaner state: charge level, cleaning status, dust container volume and noise level.

πŸ’‘

Keep the token safe. It's best to write it to a password manager or an encrypted file. Losing the token will require you to repeat the whole procedure all over again, especially if you reset the device.

Now your vacuum cleaner is fully integrated into the local network, and you can create automations, like running a cleaning operation when all the family's phones leave the geofence at home, or sending a notification to Telegram if the dust container is full.

πŸ’‘

Getting the token is a key step to turning a regular Xiaomi vacuum cleaner into a full-fledged element of a smart home with local control without delay.

Frequently Asked Questions (FAQ)

Can I get a token without root rights on my phone?
Yes, it's possible. Using an Android browser extension or emulator on a PC bypasses the need to obtain root rights on your main smartphone, which are isolated and secure for the main system of the phone.
Will the token change after the vacuum cleaner firmware update?
Normally, the token remains unchanged after the firmware updates to the device, and it's tied to the account-device bundle, but if you untie the device from the account and re-attach it, the token will change.
Is it safe to use third-party scripts to get a token?
Open Source scripts that have many stars on GitHub and positive feedback from the community are considered safe, but there is always a risk when you enter a password into unverified code. The emulator method is safer because you enter a password into an official application.
What to do if the token is not suitable?
Check if the server region is correctly selected, make sure you copy the token completely, without any spaces at the beginning or end of the line, and check if it has changed. IP-Device address on your network (it is better to fix it) IP down MAC-router).
Can I use a single token for multiple devices?
No, every device in the Xiaomi ecosystem has its own unique token, and even if you have two identical vacuum cleaners, they have different keys, and you have to repeat the extraction procedure for each gadget separately.