Owners of Xiaomi smart appliances often face the need to integrate their devices into third-party management systems such as Home Assistant, or simply want to access advanced features through a local API. A key element in this chain is the device token, a unique digital key that allows external applications to manage a robot vacuum cleaner without the involvement of the Mi Home cloud server. Without this code, most advanced automation scenarios will remain unavailable.
Xiaomi Vacuum Mop Essential (often labeled STYTJ01YM or MJSTG1) has its own connectivity features, different from the flagship versions with a laser rangefinder. The process of obtaining a token here can be fraught with certain difficulties due to the specifics of the encryption protocol and the requirements for the WiFi network. The token is generated at the first authorization and stored in secure memory, so it sometimes has to resort to special methods to extract it.
In this article, we will discuss all the current ways to obtain an access key for your robot. We will look at both software methods through Android debugging, and simpler options through third-party plugins, and also pay attention to the frequent mistakes that occur when trying to โfriendโ a vacuum cleaner with new systems.
Why do we need a token and where does it apply?
Understanding the role of a token is critical before you start extracting it, and it's essentially a password that connects your account to a particular physical device on the local network. The standard Mi Home app hides that information from the user because it's not required for basic cleaning, but if you plan to go beyond the standard functionality, knowing the token becomes a must.
Most often, the token is necessary to integrate the robot into the Home Assistant system, which allows you to create complex scenarios: start cleaning when you leave the house, receive notifications about the state of filters directly in Telegram or synchronize the vacuum cleaner with smart outlets. Without the token, Home Assistant will not be able to send commands to Xiaomi Vacuum Mop Essential, limited only to the status of โonlineโ or completely ignoring the device.
โ ๏ธ Attention: The token is sensitive information. Anyone who has this code and is on your WiFi network can theoretically control your vacuum cleaner. Never publish it publicly or share it with third parties.
You may also need to use the token when you change region in the app or transfer your device to another account if standard binding methods fail. In some cases, developers of third-party plugins for Mi Home (for example, for voice control through Alice or Google Assistant with advanced commands) also request this key to configure the device throw.
Preparation of the device and network for the procedure
Before you start extracting the key, you need to make sure that your environment meets the requirements.The Xiaomi Vacuum Mop Essential robot vacuum cleaner, like most ecosystem devices, operates in the 2.4 GHz frequency range. If your router broadcasts a 5 GHz network of the same name (SSID), the process may not go according to plan. It is recommended to temporarily split networks or create a guest network exclusively at 2.4 GHz for settings.
The second important aspect is the account region. The STYTJ01YM model often comes with a regional reference. If you bought the global version, but the application selects the region "Russia" and the vacuum cleaner is "Chinese", you may have problems displaying the device in the list to receive the token. Make sure that the Mi Home settings select the correct region that matches your account.
โ๏ธ Checklist of preparations
It's also worth checking the firmware version of the robot. Sometimes there are bugs in the old versions of the software that interfere with the correct work with the tokens, and in the new ones there are enhanced protection. Go to the settings of the device in the application and make sure that Xiaomi Vacuum Mop Essential is updated to the latest available version, which minimizes the risk of errors when requesting data.
Method 1: Using the Mi Home plugin for Android
The most affordable method for ordinary users is to install a modified version of the Mi Home application or a special plugin that can display hidden device data. The official application will never show you the token in plain form, so you will have to use third-party solutions such as Vevs Mi Home or plugins for Home Assistant that have the extraction function.
To do this, you'll need an Android smartphone. On iPhones, this procedure is often limited to iOS security via plugins. APK-a modified application file from a verified source (such as GitHub or profile forums) and install it, allowing installation from unknown sources.
In a modified version of the application, an additional menu or Token button often appears right in the device card. When you click on it, you'll see a long string of characters -- that's the token you're looking for. Copy it and save it in a safe place. If there's no direct button, try.long-press on the robot card in the device list.
Where to look for modified versions?
Method 2: Retrieving a token through ADB on Android
A more complex but versatile method is USB debugging (ADB), which does not require suspicious mods to be installed, but requires a computer and minimal technical skills, and is to count the Mi Home application database, where tokens are stored in an encrypted but accessible form.
To start, you need to turn on the developer mode on your Android smartphone. Go to Settings โ On the phone and press. 7-10 Once you go to "Build Number," and then you'll see "Developers" in the settings menu. USB. Connect your phone to your computer through USB-cable.
Next, you need to install Android Debug Bridge (ADB) on your computer. Open the command line and enter the command to check the connection:
adb devicesYou'll see a debugging permission request on your phone screen, confirm it. If the console displays the serial number of the device, the connection is established. The next step is to get permissions to access the application files. This is only possible on rooted devices or if you use an emulator. However, there is a method through a backup of data.
โ ๏ธ Note: This method requires a superuser (Root) right on an Android device to access the file directory directly. /data/data/com.xiaomi.smarthome/. Without root rights to extract the database by standard means ADB fail.
If you have root rights, go to the database directory:
adb shell
cd /data/data/com.xiaomi.smarthome/databases
sqlite3 miio.db "select name, token from device WHERE name like '%vacuum%';"In response, you will receive a list of devices and their tokens. Find the string corresponding to Xiaomi Vacuum Mop Essential, and copy the value.
Method 3: Using Python-script miio
For users who prefer to work with PC and command line, the python-miio utility is an excellent solution.It is the official community tool for managing Xiaomi devices, which is able, among other things, to pull tokens from the Mi Cloud cloud if you have a login and password from an account.
First, make sure your computer has Python version 3.7 or higher. Then install the library via pip:
pip install python-miioOnce installed, you can use the command to extract the token. You will need a login, password and account region (e.g., ru, de, cn).
miio-cloud --username your login --password your password --region ruThe script logs in to the Xiaomi cloud, gets a list of all the devices tied to the account, and displays their tokens to the console. Find a STYTJ01YM or MJSTG1 model in the list. The good thing about this method is that it doesn't require the robot to be on hand when you extract it, it's enough account data.
๐ก
If two-factor authentication (2FA) is enabled, you may be asked to enter code from SMS when you start a script. Be prepared to enter it promptly, as the code is limited in duration.
Table: Comparison of methods of obtaining a token
To make it easier for you to choose the right option, we have systematized the basic methods into a table, each method has its advantages and limitations, depending on your technical training and the equipment available.
| Method | Difficulty | Need a Root/PC | Security |
|---|---|---|---|
| Plugin Mi Home | Low. | No (Android) | Medium |
| ADB + Root | Tall. | Yeah (Root) | Tall. |
| Python-miio | Medium | Yes (PC) | Tall. |
| WiFi reset | Low. | No. | Low. |
As you can see from the table, using a Python script or root-right ADB is the safest, as it does not require the installation of modified software from unknown developers.
What to do if the token cannot be found
Sometimes users are faced with a situation where none of the methods is working: the Xiaomi Vacuum Mop Essential robot may not appear in the list, or the script may give an authorization error. Often the reason is the use of the wrong region or server. Make sure you specify the correct server (for example, mi.com for global accounts or mi.com.cn for Chinese).
Another common problem is blocking by Xiaomi. The company periodically changes encryption algorithms and APIs. If the python-miio script stopped working, check the updates on the GitHub repositories of the project.
๐ก
The main reason for the failure is the desynchronization of the region in the application and when requesting a token. Always check whether the region of the account in the settings and in the extract tool matches.
It is also worth trying to temporarily disconnect. VPN, If it is active, Xiaomi can block requests from the IP-Addresses that often change geolocation, considering them suspicious. IP-address of your country of account registration.
WiFi reset and device re-binding
If you have changed your router, your WiFi password, or just want to refresh your connection, you may need to reset your network settings on the robot. For Xiaomi Vacuum Mop Essential, the procedure looks specific. There are two buttons on the top of the device: turn on and mode (or charge, depending on the revision).
To reset your WiFi settings, you need to press and hold two buttons simultaneously for 5-7 seconds, you will hear a voice message about the transition to pairing mode, and the WiFi indicator will start flashing, and then you can add the robot again to the Mi Home application.
โ ๏ธ Note: When you add a device to your account again, the token is not changed. The token is tied to the device itself, not the connection session. So if you have already mined the token before, you can still use the old token after you reset WiFi.
If it can't find a familiar network, it goes into standby mode.Make sure the phone is near the vacuum cleaner during setup, as Xiaomi Vacuum Mop Essential uses Bluetooth for primary configuration in some firmware versions.
Frequently Asked Questions (FAQ)
Does the token change after the robot is flashed?
Can I find out the token without root rights on the iPhone?
Is it safe to use the modified Mi Home app?
What if a robot writes โDevice Offlineโ after entering a token?
Where can I find my Essential model?
๐ก
Save the received token in a text file on your computer or in the password manager. In the case of reinstalling the system or losing the settings of Home Assistant, you do not have to go through the extraction procedure again.