Owners of modern cleaning devices often face the need to deeply integrate the gadget into the ecosystem of the smart home. Xiaomi Vacuum Cleaner 1C (STYTJ01ZHM) has become popular due to the ratio of price and functionality, but its connection to third-party systems like Home Assistant or Yandex.Smart home requires a special access token. This unique encryption key allows external applications to manage the device directly, bypassing the standard limitations of the cloud server.
Many users mistakenly believe that the token is listed in the documentation or on the box, but it is not. A token is a dynamic or static string generated by the server when the device is first authenticated in an application. Without this code, you can not operate the vacuum cleaner locally, which is critical for those who appreciate responsiveness and independence from the Internet. In this article, we will discuss proven ways to obtain the key for your model.
β οΈ Note: The process of obtaining a token may require the use of third-party software or a temporary change in network settings.Make sure you understand the risks, although the methods described are considered safe for the device.
Before you start extracting the key, itβs important to understand why Xiaomi Vacuum 1C token is needed at all. The standard Mi Home app does a great job with basic tasks, but its functionality is limited to scenarios proposed by the manufacturer. Once you get the token, you open up access to advanced features: running a schedule from other systems, obtaining detailed statistics in real time and creating complex automation.
There are several methods of obtaining the necessary data, and they vary in complexity and hardware required. The easiest way does not require root rights on the phone, but may require a computer. More sophisticated methods involve traffic snipping, which is relevant for advanced users. The choice of method depends on your operating system and willingness to experiment with network settings.
Preparation for obtaining the Xiaomi token
The success of the operation depends on the correct preparation of the environment. Before starting the procedure, make sure that your Xiaomi Vacuum Cleaner 1C has already been added to the Mi Home application and works correctly. The region in the application must match the region selected when the vacuum cleaner was originally set up (usually "Russia" or "China", depending on the version of the device). If the region is selected incorrectly, the server will not issue a token.
You will need a smartphone with the Mi Home app installed and a Xiaomi account installed.It is also recommended to have a computer or a second phone on hand if you plan to use traffic sniffer techniques.Make sure both devices (smartphone and vacuum cleaner) are on the same Wi-Fi network, preferably in the 2.4GHz band, as the 1C model does not support 5GHz networks.
- π± Smartphone with Mi Home app installed (Android or iOS version).
- π€ Xiaomi Vacuum Robot Vacuum 1C, wifi-connected.
- π‘ A stable Internet connection for communication with Xiaomi servers.
- π» Computer (optional) for using Python scripts or sniffers.
β οΈ Note: In some cases, antivirus software or firewall on your computer may block the connection to Xiaomi servers. During the procedure, it is recommended to temporarily disable protection or add exceptions.
An important step is to check the version of the application. Often new versions of Mi Home change encryption algorithms or block third-party plugins. It is recommended to use a proven version of the application (for example, 6.x or early 7.x) if the standard methods do not work. For iOS users, the process can differ by having a jailbreak or using macOS for sniffing.
Method 1: Use the plugin in Mi Home (Android)
The most affordable method for Android users is to use a special plugin inside the Mi Home app itself. This method does not require installing additional software on your computer, but requires installing a modified version of the application or using the Plugins feature if it is available in your version.
First, you need to download and install the Mi Home version that supports plugin installation (often βModβ or older official versions). Once installed, open the app and go to the device profile. In some cases, the plugin to get the token appears automatically in the list of available tools.
If there is no automatic plugin, it can be found through an in-app search or manually installed through the Profile menu β Settings β Check plugin updates. After finding the plugin (often called Token Extractor or similar), click on it and select your Xiaomi Vacuum 1C device from the list.
βοΈ Check before launching the plugin
When you start the plugin, you'll see a string of characters on the screen -- that's your token -- and copy it and save it in a safe place. IP-the device address in the local network that will be needed to further configure the integrations.
- π Open Mi Home and go to your device profile.
- π Find the "Plugins" or "Tools" section".
- π² Launch the token receiving plugin.
- πΎ Copy the resulting line of 32 characters.
Method 2: Sniffing traffic over Wi-Fi (Universal)
If plugins are not available, the method of network traffic analysis (sniffing) is to intercept the data packet that sends the Mi Home application to the Xiaomi server when you log in, and this package contains the desired token in an open form (or easily decoded).
To implement this method, you will need a computer with an operating system installed (Windows, macOS or Linux) and a program Wireshark or tcpdump. You also need to configure traffic proxies from phone to computer. For Android, this can be done through ADB, for iOS, through setting up a Wi-Fi proxy in manual mode.
adb shell logcat | grep -E"miot-spec|token"Once you set up the proxy, start recording traffic on your computer and open the Mi Home app on your phone. Go to the Xiaomi Vacuum 1C. At which point the app will send a request to the server. Stop recording traffic and analyze the data received. Look for lines containing "token" or "auth".
β οΈ Warning: Be careful when using sniffers, do not share the intercepted data with third parties, as it may contain information about your network and account.
We need to find it in the logs. URL-address https://api.io.mi.com/app.... The parameters of this request will contain a data parameter, which when decoding (often requires an additional script to decrypt payload) will give out a token. To simplify the process, there are ready-made scripts in Python that automatically parse the log and give the result.
How to decode data from a log?
Method 3: Using Python-Miio script
For advanced users familiar with the command line, the ideal solution is to use the python-miio library. This (open-source) project that allows you to interact with Xiaomi devices directly.
First, install Python (versions 3.6 or higher) and a pip package manager. Then install the library with a command in the terminal. This method is good because it is cross-platform and runs on Windows, Linux and macOS without having to configure complex network interceptors.
pip install python-miioOnce the library is installed, use the miio command to obtain the token. However, the team often still requires to know the token in another way (for example, through a plugin), or use the method"extract_token", If it's implemented in your version, in the case of a model. 1C, Often used discovery command to search for a device on the network.
- π» Install Python and Pip on your computer.
- π¦ Installation command: pip install python-miio.
- π Start your search for the device: Mio discover.
- π Get a token through a special sub-command or plugin.
If direct receipt through the script does not work due to changes in the Xiaomi security protocol, this method can be used in conjunction with a previously received token to test its health and control the device from the console.
π‘
Save the token in a text file on your computer and make a backup. If you reset the vacuum cleaner or application settings, the token may change and you will have to repeat the procedure.
Table: Comparison of methods of obtaining a token
To make it easier for you to choose the right option, we have prepared a comparison table that will help you estimate the labor costs and resources required for each of the methods described.
| Method | Difficulty | I need a PC. | Risks. | Recommended for |
|---|---|---|---|---|
| Plugin Mi Home | Low. | No. | Minimum | Android users |
| Sniffing (Wireshark) | Tall. | Yes. | Medium (setting error) | Experienced users of iOS/Android |
| Python-miio | Medium | Yes. | Minimum | Developers and geeks |
| Root access (Logcat) | Tall. | No (needs Root) | High (loss of warranty) | Root rights holders |
As you can see from the table, for most users, the best option is to use a plugin. However, if you are an iPhone owner and do not want to install third-party versions of applications, sniffering remains the only working option. Python scripts are the choice of those who plan to automate the process or integrate a vacuum cleaner into server solutions.
Integration of the token into the smart home systems
Getting a token is only half the battle, and the main goal is to use it to manage Xiaomi Vacuum Cleaner 1C through automation systems. The most popular platform is Home Assistant. To integrate, you'll need to add the integration of Xiaomi Miio to the Home Assistant configuration.
In the configuration file configuration.yaml you need to add an entry indicating IP-When the system is restarted, Home Assistant will establish a local connection to the device, which will allow you to control the vacuum cleaner even if you don't have the Internet, using only the local Wi-Fi network.
vacuum:
- platform: xiaomi_miio
host: 192.168.1.50
Token: Your Token is here
name: Xiaomi Vacuum 1COnce integrated successfully, you can create complex scenarios, such as running a cleanup when all family members' smartphones leave the home geofence, or sending a notification to Telegram if the dust container is full. The 1C model supports cleaning cards, which can also be accessed through integration, depending on the component used.
π‘
Local management via token provides instant response of the device and works without the delays typical of cloud servers Xiaomi.
Possible problems and solutions
It can be difficult to get a token or set up integration, and one of the common problems is the βInvalid tokenβ error, which means that the token is copied incorrectly (extra space, symbol) or the device has changed the key after reconnecting, in which case the procedure for obtaining the token must be repeated.
The other problem is change. IP-The address of the vacuum cleaner. 1C plug-in DHCP, The router can give it a new address after the reboot. To avoid a break in the connection in Home Assistant, set up a static IP-address (Reservation) for MAC-Addresses of the vacuum cleaner in the settings of your router.
- β Connection Error: Check if the device is on the same subnet as the control server.
- π Lock: Make sure port 54321 (standard for Miio) is open on the local network.
- π Change of token: The token can change when the device is completely reset (Hard Reset).
Regional features are also important to remember: if your vacuum cleaner is for the Chinese market and your account is for Europe, it can be difficult to log in, sometimes by temporarily changing the region in the Mi Home app to China at the stage of receiving the token.