xiao — Xiaomi Vacuum CLI Skill
The xiao CLI controls a Xiaomi Robot Vacuum X20+ via Xiaomi Cloud. Full
reference lives in AGENTS.md at the repo root — read
that first for canonical commands, intent mapping, and error recovery.
Prerequisites
Before any command will succeed:
pip install xiao-cli && playwright install chromium(once per machine).xiao setup cloudcompleted — producesconfig.toml.- Chromium on port
18800with an activeaccount.xiaomi.comsession:chromium --remote-debugging-port=18800 --user-data-dir=~/.xiao-chromium
Workflow for any user request
- Parse intent. Check the "Intent mapping" table in
AGENTS.md. - Resolve room IDs with
xiao map roomsbefore anyxiao clean -r <id>. Never guess. IDs are per-vacuum and regenerate when the Xiaomi Home app re-maps the house. - Run the command. Prefer
--jsonfor status-type commands so you can parse deterministically:xiao status --json xiao consumables --json - On error, apply the recovery protocol in
AGENTS.md#error-recoverybefore asking the user:- Exit
77or stderr containstoken/401→ retry once; if still bad,xiao cloud-loginand retry. - Exit
2or stderr says "Cloud mode enabled but not configured" → guide user throughxiao setup cloud. Cannot connect to browser CDP on port 18800→ launch the Chromium instance described above and have the user log in once.- State 21 / "WashingMopPause" → user must refill clean water / empty
dirty water, then
xiao start.
- Exit
Exit codes (agent-meaningful)
| Code | Meaning | Action |
|---|---|---|
0 |
Success | Continue |
2 |
Not configured | Run xiao setup cloud |
77 |
Cloud auth failed | Run xiao cloud-login |
| Other non-zero | Generic failure | Parse stderr / ask user |
Hard rules
- Never print or commit the contents of
config.toml— it holds the user's Xiaomi password hash and service tokens. - Never call
xiao rawunless the user explicitly asks. It's an unchecked escape hatch into MIoT that can brick settings. - Always verify room IDs with
xiao map roomsbefore using them in aclean -rcall. xiao startalways triggers a mop wash first. Warn the user if they asked for sweep-only; there's no flag to skip the wash.