Xiaomi Home smart home integration, free and open source

Robot vacuums paired in the Xiaomi Home app: state, start/stop, fan power, dock, battery.
Control the robot vacuums of your Xiaomi Home account from Gladys Assistant.
This integration targets robots paired in the Xiaomi Home (Mi Home) app. It talks to them directly over your local network, with an automatic fallback to the Xiaomi cloud when a robot is not reachable.
If your robot is paired in the Roborock app, it answers on an entirely different service: the Roborock integration is the one you need. Both can be installed at once if you use both apps.
Features
For every robot of your account:
- State — the operational state of the robot (cleaning, paused, returning to the dock, charging, docked, error…).
- Run mode — start or stop a cleaning cycle.
- Clean mode — the suction level (silent, balanced, turbo, max, gentle).
- Dock — send the robot back to its charging dock.
- Battery — the current battery level, in percent.
- Last clean start and Cleaned today — when the last cleaning started, and whether it was today (1) or not (0). Use Cleaned today as a scene condition, for example to start a cleaning only if the robot has not run yet.
Scenes
The robot can start a scene when it starts or finishes a cleaning, returns to its dock, runs low on battery (20 %), finishes charging, reports an error, when a consumable is worn (10 % left), or on any change of state.
A scene can also command the robot: start, pause, stop, return to the dock, clean some rooms (their names separated by commas, e.g. "Kitchen, Living room"), or set the suction power.
Scenes need Gladys 5.1.0 or later.
Map widget
Add the Vacuum widget to a dashboard and pick your robot: it shows the battery, the cleaned surface, the map with your rooms, the state and the wear of each consumable, with Start and Dock buttons plus two buttons you choose in its settings. While the robot cleans, the map refreshes about every 15 seconds.
The map is fetched through the Xiaomi cloud, even when the robot answers on your local network. The robots built by Roborock (S5, S6, S7…) provide it, and so does the Xiaomi Robot Vacuum S20+.
Configuration
- Click Connect: the Xiaomi sign-in page opens.
- Approve it (you can also scan it with the Xiaomi Home app).
- The badge turns green on its own.
- Open the Discovery screen and start a scan: your robots appear and can be added to Gladys.
You never type your Xiaomi password into Gladys, and this is only needed once: the session is stored and reused automatically after a restart.
There is nothing to configure: the Xiaomi server region, your robots, their local encryption keys and their IP addresses are all discovered automatically.
How it works
The integration discovers your robots through the Xiaomi cloud, along with their local encryption key and IP address. Commands and state readings then go through the local network first (encrypted miIO protocol), falling back to the cloud when a robot is unreachable. The transport in use is shown as a badge on the device.
Turn off Prefer the local (LAN) connection when available in the integration settings to send commands through the Xiaomi cloud first instead, with the local network as the fallback.
Limitations
- Robot vacuums only. The name matches the app, but a Xiaomi Home account carries many other device types and none of them is handled here.
- Among the robots Xiaomi builds itself (MIoT protocol), only the Xiaomi Robot Vacuum S20+ is supported so far: state, battery, suction, brushes, filter, the map, room cleaning and the start / pause / stop / dock commands. The last cleaning is not available on it.
- Suction-level codes vary across model generations. If your model behaves
differently, open an issue with the
fan_powervalue visible in the debug logs.
Configuration settings
These are the settings Xiaomi Home asks for in its configuration screen in Gladys.
| Setting | Type | Required | Description |
|---|---|---|---|
| Xiaomi account | account_link | No | Click Connect and approve the sign-in on the Xiaomi page that opens. Your robot vacuums are then detected automatically — there is nothing else to fill in. |
How to install Xiaomi Home in Gladys
- In Gladys, open Integrations: Xiaomi Home appears in the catalog, next to the native integrations, with a community badge.
- Click Install. Gladys pulls the Docker image (
ghcr.io/callemand/gladys-xiaomi-home:1.4.0), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration). - Open the Configuration screen of the integration, fill in the settings, and save.
- You can also install it directly from its repository URL: https://github.com/callemand/gladys-xiaomi-home.
Xiaomi Home requires Gladys >=5.1.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.
Not running Gladys yet? It is free and open source: follow the installation guide to get started.
About external integrations
Xiaomi Home is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by callemand, not by the Gladys core team.
- Browse all integrations, native and community
- Build and publish your own external integration
- Source code on GitHub — source of this documentation