A lightweight Xiaomi Home CLI & full-screen TUI for device control
中文文档
mit is a fast, zero-dependency Xiaomi Home CLI written in Rust. It lets you log in to your Xiaomi account, browse and control smart home devices from the terminal, and send push notifications — all without opening the app.
Disclaimer: This project is a community-maintained tool and is not affiliated with, endorsed by, or part of Xiaomi.
- Full-screen TUI — navigate accounts, rooms, and devices; read/write MIoT properties; invoke actions; all keyboard-driven
- Local-first LAN control — automatically discovers local IPs and tokens, probes reachability, and falls back to cloud seamlessly
- CLI props access — read/write device properties, trigger actions, and subscribe to live property changes without opening the TUI
- Push notifications — send messages to any logged-in Xiaomi account
- Multi-account — log in with multiple accounts across different regions
- JSON output — commands have a
--jsonmode for scripting and automation
| Sending a push notification | Reading & writing device properties | TUI(mobile view) |
|---|---|---|
![]() |
![]() |
![]() |
One-liner (macOS / Linux):
curl -sSfL https://raw.githubusercontent.com/ttys026/mit/main/install.sh | shThe script detects your platform, downloads the latest pre-built binary, verifies the SHA-256 checksum, and installs to /usr/local/bin (or ~/.local/bin if that's not writable).
Build from source (requires Rust ≥ 1.75):
cargo install --git https://github.com/ttys026/mit.git --bin mitCustom install directory:
INSTALL_DIR=~/.local/bin curl -sSfL https://raw.githubusercontent.com/ttys026/mit/main/install.sh | sh| Platform | x86_64 | aarch64 |
|---|---|---|
| Linux (musl) | ✅ | ✅ |
| Linux (glibc) | ✅ | ✅ |
| macOS | ✅ | ✅ |
| Windows | ✅ | ✅ |
# 1. Log in to your Xiaomi account
mit auth login
# 2. List your devices
mit devices list
# 3. Launch the full-screen TUI
mit tui# Root help
mit
mit --help
# ── Auth ───────────────────────────────────────────────────
mit auth login # Log in (opens browser)
mit auth login --region cn # Specify region
mit auth list # List saved accounts
# ── TUI ────────────────────────────────────────────────────
mit tui # Launch full-screen dashboard
mit tui --uid 1234567 # Start with a specific account
# ── Devices ────────────────────────────────────────────────
mit devices list # List devices for all accounts
# ── Push notifications ─────────────────────────────────────
mit push "Hello World" # Push to all accounts
mit push --uid 1001 "Hello World" # Push to a specific account
# ── MIoT properties & actions (no TUI required) ────────────
mit props get did-1 2 1 # Read property (siid=2, piid=1)
mit props set did-1 2 1 true # Write property
mit props act did-1 5 1 1 2 # Invoke action with parameters
mit props sub # Subscribe to all device property changes
mit props sub did-1 # Subscribe to all changes for one device
mit props sub did-1 2 1 # Subscribe to one property- After browser login completes,
mit auth loginfinalises auth automatically and shows a success page in the browser. mit props get/set/act/subwork directly without opening the TUI.mit props substreams subscription logs and property updates to stdout until interrupted.mit tuisyncs devices and caches MIoT specs under~/.mit/cache/specs/.- bare
authkeeps compatibility withmit auth --help. - bare
deviceskeeps compatibility withmit devices --help.
1:Account— account list, login/logout, push message2:Devices— device list and property/action dialog3:Logs— runtime logs and status information4:Settings— cache cleanup (keep auth) and full reset (delete~/.mit, double-confirmed)
mit prefers talking to your devices over LAN (UDP/MIIO protocol) instead of going through Xiaomi's cloud:
- On first sync,
mitfetches each device'slocalipandtokenfrom Xiaomi cloud. - Credentials are persisted per account to
~/.mit/accounts/{account_id}/local_credentials.json. mitprobes reachability for each device in the background.
Commands support machine-readable JSON output via the global --json flag:
mit --json # Help as JSON
mit --json auth list # Account list as JSON
mit --json devices list # Device list as JSON
mit --json push "hello" # Push result as JSON--jsonapplies only to successful stdout. Parse errors and runtime errors are always printed as human-readable text on stderr.- Streaming commands such as
mit props subprint live text lines to stdout and do not support--json. - This makes
miteasy to use in scripts, CI pipelines, or any automation that needs structured output.
| Environment variable | Description |
|---|---|
MIT_PROFILE_DIR / MIT_HOME / XMCLI_HOME |
Override the directory where ~/.mit data is stored |
MIT_MIOT_SPEC_URL_BASE |
Override the MIoT spec API base URL (useful for testing) |
MIT_MICO_BASE_URL |
Override the Mico API base URL (debug builds only) |
MIT_LOG_DEVICE_LIST_PAGE_RAW |
Set to any non-empty value to log raw device list API responses to stderr |
Profile data is stored under ~/.mit/:
~/.mit/
├── auth.json # Saved account tokens
├── accounts/{uid}/
│ ├── devices.json # Cached device list for this account
│ └── local_credentials.json # Per-account LAN credentials
└── cache/
└── specs/
├── index.json # Model → URN mapping
├── models/ # Per-model MIoT spec JSON
└── sources/ # Cached MIoT API index files


