The Xiaomi and Roborock robot vacuum cleaners have long been an integral part of the smart home ecosystem, but their true potential is only revealed when integrated with Home Assistant. Unlike the standard Mi Home app, where functionality is limited to basic commands, connecting to the home is a must-have. HA allows you to create complex automation: cleaning according to a schedule taking into account motion sensors, zoning the rooms by time of day or even synchronization with other devices (for example, starting a vacuum cleaner after closing windows).
However, the integration process often raises questions: where to get a token for authorization, how to set up a map display in real time, or why the vacuum cleaner does not respond to commands through a computer. HA? This article covers all the steps from device preparation to fine-tuning, including solving typical problems.We will look at both the official methods through Xiaomi Miio, and alternative ways for older models where standard integration does not work.
1.Preparation: compatibility check and requirements
Before you start setting up, make sure your vacuum cleaner model is supported by Home Assistant. Xiaomi/Roborock release 2018 Compatible years, but there are exceptions:
- β Supported by: Roborock S5/S6/S7/S8, Xiaomi Mi Robot Vacuum 1S/2/Pro, Dreame D9/F9 newer.
- β οΈ Limited support: Xiaomi Mi Robot Vacuum 1 (first generation) β requires manual token acquisition.
- β Not supported: some OEM-models for the Chinese market (for example, Viomi without global firmware).
Also check the version of the vacuum cleaner firmware: for correct operation with the HA It is recommended to update it to the latest through the official Mi Home or Roborock app. S5) may not support API-team.
| Model vacuum cleaner | Minimum firmware version | Is a handheld token required? | Support for maps in HA |
|---|---|---|---|
| Roborock S7 | 4.1.0 | No (automatic) | Yes. |
| Xiaomi Mi Robot Vacuum 2 Pro | 3.3.9 | Yes. | Partially. |
| Dreame D10 Plus | 1.5.4 | No. | Yes. |
| Roborock S5 Max | 3.6.6 | No. | Yes. |
Requirements for Home Assistant:
- β‘ Version. HA 2023.12 or later (for full Miio Protocol support) v2).
- π Stable connection of vacuum cleaner and server HA to one network (Wi-Fi 2.4 GHz).
- π Xiaomi account with tied vacuum cleaner (to automatically receive token).
β οΈ Note: If the vacuum cleaner is connected to the network via 5 GHz, transfer it to 2.4 GHz β many models do not support dual-band Wi-Fi when integrating with the network. HA.
2. Obtaining an authorization token
The token is a unique key that allows Home Assistant to send commands to the vacuum cleaner, and there are two ways to get it:
Method 1: Automatically Received via Mi Home (recommended)
If your model supports automatic integration (see table above), follow the following steps:
- Install the official Mi Home app (or Roborock for the respective models).
- Log in to the account to which the vacuum cleaner is attached.
- In Home Assistant, go to Settings β Devices and services β Add integration β Xiaomi Miio.
- Select the server region (China, Europe or Russia β depending on the version of the application).
- Enter the username and password from the Xiaomi account β HA automatically receive the token.
Advantage: it does not require manual manipulation of configuration files, disadvantage: if you change the password in the Xiaomi account, the token will reset, and the integration will have to be configured again.
Method 2: Manual token extraction (for older models)
If the automatic method does not work (for example, for Mi Robot Vacuum 1), use this method:
Install the Packet Capture (Android) app or HTTP Toolkit (PC)
Connect your phone/PC to the same network as the vacuum cleaner
Log in to Mi Home and start capturing traffic
Find a request to api.io.mi.com with the token option
-->
Detailed instructions:
- Download MiHome Token Extractor (for Android) or use it Fiddler/Wireshark PC-only.
- Start capturing traffic and open the Mi Home app.
- Find in the logs a request to the domain api.io.mi.com with the method POST and the "token" parameter": "...".
- Copy the value of the token (32 characters) β this is your key.
β οΈ Warning: Don't share the token with third parties! it gives full access to vacuum control. If the token has fallen into the wrong hands, dump it through the Mi Home app (lodge and log in again).
Automatically through HA
Manually by Capturing Traffic
I haven't tried it yet.
Another option-->
3. Set up integration in Home Assistant
After receiving the token, add the vacuum cleaner to HA:
- Open configuration.yaml (via File Editor or en route) /config/configuration.yaml).
- Add the following block (replace). IP_ADRES and YOUR TOKEN for real values: vacuum: - platform: xiaomi_miio host: IP_Address token: Your Token Name: "Robot vacuum cleaner Xiaomi"
- Save the file and reboot the Home Assistant.
If you use YAML-Mod, after restarting, the vacuum cleaner will appear in the Devices section. UI-Mod (without editing configuration.yaml):
- Go to Settings β Devices and Services β Add Integration.
- Choose Xiaomi Miio.
- Enter. IP-vacuum cleaner address and token, then click Send.
Connection Check: After adding, open the Developers tab β Conditions and find the essence vacuum.xiaomi_vacuum. If it displays status (idle, cleaning, etc.), the integration has been successful.
π‘
If the vacuum cleaner doesn't respond to commands, check if your router blocks local traffic between devices. IP-vacuum address except for firewall.
4. Advanced settings: maps, zones and automation
Basic integration allows you to send commands (start, pause, return_to_base). To unlock your full potential, set up:
Displaying the map in real time
For models with mapping support (Roborock) S6/S7, Dreame D10 etc.):
- Install the Xiaomi Miio Map expansion through HACS (Home Assistant Community Store).
- Add to configuration.yaml: xiaomi_miio_map: vacuums: - host: IP_ADRES TOKEN: Your Token name: "xiaomi_vacuum" draw: ['all'] attributes: - calibration_points
- Reboot. HA and add a map to the dashboard via the Picture Entity widget, specifying the essence camera.xiaomi_vacuum_map.
Maps are updated with a delay 2-5 If the card is not displayed, check if the option "Save card" is enabled in the vacuum cleaner settings (via the official app).
Set-up of cleaning areas
To start cleaning in specific areas (e.g., only in the kitchen):
- In the official Mi Home or Roborock app, create virtual walls and zones.
- Export zone coordinates through Developer Tools β Services in HA, call-up xiaomi_miio.vacuum_clean_zone.
- Save the coordinates to script or automation. Example of a zone cleaning command: service: xiaomi_miio.vacuum_clean_zone data: entity_id: vacuum.xiaomi_vacuum zone: [[25000, 25000, 30000, 30000]] # Coordinators: [x1, y1, x2, y2] repeats: 2
How do you get the coordinates of the zones?
Examples of automation
- π Scheduled cleaning: Start vacuum cleaner at 10:00 if no one is home (presence sensor).
- πͺ Synchronization with windows: when closing the last window (sensor) binary_sensor.window) clean-up.
- π Pets mode: if the motion sensor in the corridor works more often 5 times per hour, the vacuum cleaner removes only the area near the bowl.
5. Solving typical problems
Even with the right setup, you can get errors, and here are the most common ways to fix them:
| Problem. | Possible cause | Decision |
|---|---|---|
| Vacuum cleaner not responding to commands | Wrong. IP token | Check it out. IP via router, regenerate token |
| Map not updated | Outdated vacuum cleaner firmware | Update the firmware through the official application |
| Unable to connect error | Locking ports with firewall | Open ports 54321 and 80 for local IP vacuumer |
| Commands are executed with a delay | Network or server congestion HA | Reduce the number of surveys in configuration.yaml (scan_interval: 30) |
If the vacuum cleaner is disconnected from Wi-Fi:
- Check the strength of the router signal at the docking station location (should be β₯ -60 dBm).
- Set up static. IP for the router vacuum cleaner (by MAC-address).
- Turn off the energy-saving Wi-Fi mode on the vacuum cleaner (some firmware has it).
β οΈ Note: If after updating the vacuum cleaner firmware, it stopped responding to commands through HA, Reset the token and reset the integration. The manufacturer sometimes changes the authorization protocol.
6. Alternative methods of integration
If the Xiaomi Miio standard integration doesnβt work, consider alternatives:
1.Valetudo firmware
Valetudo is an open alternative to standard firmware that provides full local control over the vacuum cleaner without the Xiaomi cloud.
Advantages:
- π No dependence on Xiaomi servers (works even when the Internet is disconnected).
- πΊοΈ Support for extended maps and zones.
- π οΈ Possibility of installing custom scripts.
Disadvantages: requires manual stitching (risk of losing warranty), not all models are supported.
Installation instructions:
- Download Valetudo from the official website.
- Connect to the vacuum cleaner SSH (The instructions for each model are different).
- Download the firmware via scp or web interface.
- Set up integration with HA through REST API or MQTT.
2. Integration through MQTT
If your vacuum cleaner supports MQTT (For example, through Valetudo or custom firmware, set up messaging:
- Install. MQTT-broker (e.g. Mosquitto) in HA.
- In the vacuum cleaner configuration, specify the brokerβs address and topics for teams (vacuum/command) and (vacuum/state).
- Create automation in HA, posting.
Example of a team to start cleaning through MQTT:
topic: vacuum/command
payload: '{"command": "start"}'3. Cloud Bridge (for remote access)
If you need to control the vacuum cleaner from the outside of the home network:
- Configure Nabu Casa Cloud or DuckDNS for remote access HA.
- Use a Telegram bot or Google Assistant to send commands.
π‘
Alternative methods are suitable for power users. If you're a beginner, start with the standard Xiaomi Miio integration.
7. Optimization and Operational Tips
To make the vacuum cleaner work more efficiently:
- π‘ Docking station: install it in the center of the apartment, at least 0.5 m from the walls and furniture. Avoid places with direct sunlight (the sensor may overheat).
- π Battery care: If the vacuum cleaner is not used for more than a week, remove the battery or store it with a charge 40-60%.
- π§Ή Clean sensors: wipe optical sensors every month (especially on models with a high-performance sensor). LDS-lidar) cotton swab soaked in alcohol.
- π± Updates HA: After updating Home Assistant, check the compatibility of Xiaomi Miio integration in the official repository.
Automation tip: To reduce vacuum cleaner wear, set up the condition to start cleaning only at the battery level > 50 percent, an example of an automation condition:
condition:
- condition: numeric_state
entity_id: sensor.xiaomi_vacuum_battery
above: 50For models with support for wet cleaning (Roborock) S7, Dreame W10):
- Use distilled water to extend the life of the pump.
- After each cleaning, wash the water tank and wipe the fabric nozzle.
- In automation, add delay: "00:02:00" between dry and wet cleaning - this will reduce the load on the engine.