Xiaomiβs robot vacuum cleaners have become an integral part of smart homes, but integrating them fully with automation systems (like Home Assistant or Node-RED) often requires two key parameters: IP-The address of the device on the local network and the authentication token. Without them, you can not control the vacuum cleaner through the API, Configure complex scenarios or use alternative firmware.
In this article, we will look at all the current ways to get this data, from standard methods through the official Mi Home application to advanced techniques using Python scripts and analyzing network traffic. Particular attention will be paid to the Xiaomi Mi Robot Vacuum, Viomi V3 and Dreame D9 models, because the algorithms for them may differ. If you encounter errors like Invalid token or vacuum cleaner does not appear on the local network, here you will find solutions.
Why do we need to IP-address and token of Xiaomi vacuum cleaner
IP-The address and token are the passport of your robot vacuum cleaner on the local network:
- π It is impossible to connect to third-party smart home systems (for example, Home Assistant or OpenHab).
- π± Alternative apps like Valetudo or DreameBot that offer advanced features donβt work.
- π§ Closed access to API Automating cleaning on schedule or by triggers (for example, when opening a door).
- βοΈ It is impossible to update the firmware manually or install custom (for example, Valetudo). RE).
The official Mi Home app hides this data as Xiaomi seeks to centralize management through its servers, but enthusiasts have found workarounds, which we will explore below.
Method 1: Obtaining IP-router
The easiest way to find IP-The vacuum cleaner address is to see the list of connected devices in the admin panel of your router:
- Connect the vacuum cleaner to the charging station and turn it on.
- Make sure the robot is connected to the same Wi-Fi network as your computer/smartphone.
- Open the router's admin panel (usually at 192.168.0.1 or 192.168.1.1).
- Find Connected Devices (or DHCP Clients)
- In the list, look for a device called roborock.vacuum., miio: or viomi.vacuum.*.
If the name of the device is not obvious, you can:
- π Disconnect the vacuum cleaner from the network and see which device disappears from the list.
- π‘ Use applications to scan the network, such as Fing (Android/iOS) or advancedd IP Scanner (Windows).
π‘
If the vacuum cleaner is not displayed in the list of devices, check if the router is not enabled client isolation mode (AP Isolation), which blocks the interaction of devices on the local network.
IP-The address can be dynamic (changes with each connection) or static. IP behind the vacuum cleaner in the router settings (option) DHCP Reservation or Static Lease).
Method 2: Retrieval of the token through Mi Home (official method)
Until 2021, the token was easily retrieved through the Mi Home app, but after the updates, Xiaomi tightened its protection, but for some regions (such as China Mainland) and older versions of the app, the method still works.
Instructions for Android:
Open Mi Home and go to vacuum settings |Tap three dots in the top right |Select About or Device Information |Look for Token (may be called API Token or Local Token) |Copy the value (usually 32 characters)
-->
If the string with the token is missing:
- π± Try changing the region in Mi Home to China Mainland (in your account settings).
- β³ Install an older version of the app (e.g. 5.6.52 or 6.1.102).
- π Reconnect the vacuum cleaner to the application (sometimes the token appears after re-authorization).
β οΈ Warning: Changing the region in Mi Home can cause vacuum cleaner settings to reset.Before doing so, export cleaning maps and save important settings.
Why is Xiaomi hiding the token?
Method 3: Using a Python script to extract a token
If the official methods didnβt work, you can extract the token using a Python script that intercepts network traffic between the Mi Home app and Xiaomi servers.
- π» Computer with Python 3.6+.
- π± Android smartphone with Mi Home installed.
- π A program for intercepting traffic (Fiddler, Charles Proxy or mitmproxy).
Step-by-step:
- Install mitmproxy and configure it on your computer: pip install mitmproxy
- On your smartphone, configure a proxy server on your computerβs IP (port 8080).
- Start mitmproxy and log in to Mi Home.
- Open in the browser http://mi.com β this is necessary to intercept cookies.
- Use miio-cli script to extract the token: miio --discover --sync-see-other-devices
If the script gives a Device not found error, check:
- π Connecting a vacuum cleaner and a computer to the same network.
- π No firewall blocking port 54321 (MiIO protocol used).
- π‘ Correctness IP-address of the vacuum cleaner (can be manually specified: miio) --ip 192.168.1.100 --token YOUR_TOKEN info).
| Model vacuum cleaner | Supported protocol | Example of test team |
|---|---|---|
| Xiaomi Mi Robot Vacuum 1S | MiIO | miio --ip 192.168.1.100 --token YOUR_TOKEN vacuum |
| Roborock S5/S6 | MiIO (Outdated) / RRMap | mirobo --ip 192.168.1.100 --token YOUR_TOKEN status |
| Viomi V3 | MiIO | miio --ip 192.168.1.100 --token YOUR_TOKEN viomi_vacuum |
| Dreame D9 | MiIO (partially) | miio --ip 192.168.1.100 --token YOUR_TOKEN dreame_vacuum |
π‘
For Roborock models (such as the S7 or S8), it is better to use mirobo instead of miio, as it supports advanced commands for working with maps and cleaning areas.
Method 4: Retrieval of the token through the backup Mi Home (Android)
On Android devices, you can extract a token from the Mi Home app backup, which works even if the token is not displayed in the interface.
Instructions:
- Install Mi Home and log in.
- Connect the vacuum cleaner to the app.
- Create a Mi Home data backup through Settings β Account β Backup.
- Download the backup file to your computer (usually with the.mi extension).
- Use the mihome-binary-parser utility to extract the token: npm install -g mihome-binary-parser mihome-binary-parser your_backup.mi
As a result, you will receive JSON-A file with all devices, where each will be specified "token": "YOUR_TOKEN_HERE".
β οΈ Note: Mi Home backups contain personal data (including cleaning history and maps of premises).Do not pass backup files to third parties and delete them after the token is extracted.
Method 5: Receiving a token through Home Assistant (automatically)
If you use Home Assistant, the token can be extracted automatically through Xiaomi Miio integration.
- Add the line to configuration.yaml: vacuum: - platform: xiaomi_miio host: 192.168.1.100 token:!secret xiaomi_vacuum_token
- Reboot Home Assistant.
- In the logs (Developer Tools β Logs), find the line with the connection error - there will be the current token (if it is incorrect).
If the token is missing, Home Assistant can offer to generate it automatically when you first connect.
- π Remove the vacuum cleaner from Mi Home and connect again.
- π At the time of connection, Home Assistant will intercept the token (if the discovery mode is enabled).
π‘
For Roborock models, Home Assistant is better to use Xiaomi Miio 2 integration β it supports new protocols and works more stable.
Common mistakes and their solutions
When working with IP and Xiaomi vacuum cleaner token, users often face typical problems.
| Mistake. | Possible cause | Decision |
|---|---|---|
| Invalid token | Token is obsolete or incorrect | Get a new token or check out the region in Mi Home |
| Device not found | Vacuum cleaner not online or incorrect IP | Check Wi-Fi connection and correctness IP-address |
| Timeout error | Firewall blocks port 54321 | Turn off the firewall or add an exception for Python |
| Unsupported device | The model of vacuum cleaner is not supported by miio-cli | Use specialized utilities (e.g. mirobo for Roborock) |
If the vacuum cleaner does not respond to commands via the API, check:
- π Network connection β Wi-Fi indicator on the vacuum cleaner should burn green.
- π Firmware version β some models (for example, Roborock) S7) Requires updates to work with local API.
- π‘οΈ Router settings - turn off AP Isolation and check that devices see each other on the LAN.