{"id":51235121,"url":"https://github.com/ttys026/mit","last_synced_at":"2026-06-28T19:32:23.011Z","repository":{"id":364700970,"uuid":"1253149496","full_name":"ttys026/mit","owner":"ttys026","description":"MIT(MI-Terminal): A lightweight TUI and CLI for MiJia. 轻量化的米家设备控制 CLI","archived":false,"fork":false,"pushed_at":"2026-06-14T04:56:09.000Z","size":1592,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-14T06:29:15.401Z","etag":null,"topics":["cli","mijia","tui","xiaomi"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ttys026.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-29T07:38:03.000Z","updated_at":"2026-06-05T07:54:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ttys026/mit","commit_stats":null,"previous_names":["ttys026/mit"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ttys026/mit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys026%2Fmit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys026%2Fmit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys026%2Fmit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys026%2Fmit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttys026","download_url":"https://codeload.github.com/ttys026/mit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttys026%2Fmit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34901959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","mijia","tui","xiaomi"],"created_at":"2026-06-28T19:32:22.306Z","updated_at":"2026-06-28T19:32:23.006Z","avatar_url":"https://github.com/ttys026.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MIT(MI-Terminal)\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eA lightweight Xiaomi Home CLI \u0026amp; full-screen TUI for device control\u003c/strong\u003e\n  \u003cbr/\u003e\u003cbr/\u003e\n  \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License: MIT\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/ttys026/mit/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/ttys026/mit\" alt=\"Latest Release\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/ttys026/mit/actions/workflows/release.yml\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/ttys026/mit/release.yml?label=build\" alt=\"Build\"/\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey\" alt=\"Platforms\"/\u003e\n  \u003cbr/\u003e\u003cbr/\u003e\n  \u003ca href=\"README.zh-CN.md\"\u003e中文文档\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n`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.\n\n\u003e **Disclaimer:** This project is a community-maintained tool and is **not** affiliated with, endorsed by, or part of Xiaomi.\n\n## Features\n\n- **Full-screen TUI** — navigate accounts, rooms, and devices; read/write MIoT properties; invoke actions; all keyboard-driven\n- **Local-first LAN control** — automatically discovers local IPs and tokens, probes reachability, and falls back to cloud seamlessly\n- **CLI props access** — read/write device properties, trigger actions, and subscribe to live property changes without opening the TUI\n- **Push notifications** — send messages to any logged-in Xiaomi account\n- **Multi-account** — log in with multiple accounts across different regions\n- **JSON output** — commands have a `--json` mode for scripting and automation\n\n---\n\n## Demo\n\n| Sending a push notification                           | Reading \u0026 writing device properties                              | TUI(mobile view)                            |\n| ----------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------- |\n| ![Sending a push notification](docs/assets/push.webp) | ![Reading and writing device properties](docs/assets/props.webp) | ![TUI mobile view](docs/assets/mobile.webp) |\n\n---\n\n## Install\n\n**One-liner (macOS / Linux):**\n\n```bash\ncurl -sSfL https://raw.githubusercontent.com/ttys026/mit/main/install.sh | sh\n```\n\nThe 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).\n\n**Build from source (requires Rust ≥ 1.75):**\n\n```bash\ncargo install --git https://github.com/ttys026/mit.git --bin mit\n```\n\n**Custom install directory:**\n\n```bash\nINSTALL_DIR=~/.local/bin curl -sSfL https://raw.githubusercontent.com/ttys026/mit/main/install.sh | sh\n```\n\n### Supported platforms\n\n| Platform      | x86_64 | aarch64 |\n| ------------- | ------ | ------- |\n| Linux (musl)  | ✅     | ✅      |\n| Linux (glibc) | ✅     | ✅      |\n| macOS         | ✅     | ✅      |\n| Windows       | ✅     | ✅      |\n\n---\n\n## Quick Start\n\n```bash\n# 1. Log in to your Xiaomi account\nmit auth login\n\n# 2. List your devices\nmit devices list\n\n# 3. Launch the full-screen TUI\nmit tui\n```\n\n---\n\n## Commands\n\n```bash\n# Root help\nmit\nmit --help\n\n# ── Auth ───────────────────────────────────────────────────\nmit auth login                                   # Log in (opens browser)\nmit auth login --region cn                       # Specify region\nmit auth list                                    # List saved accounts\n\n# ── TUI ────────────────────────────────────────────────────\nmit tui                                          # Launch full-screen dashboard\nmit tui --uid 1234567                            # Start with a specific account\n\n# ── Devices ────────────────────────────────────────────────\nmit devices list                                 # List devices for all accounts\n\n# ── Push notifications ─────────────────────────────────────\nmit push \"Hello World\"                           # Push to all accounts\nmit push --uid 1001 \"Hello World\"                # Push to a specific account\n\n# ── MIoT properties \u0026 actions (no TUI required) ────────────\nmit props get did-1 2 1                          # Read property (siid=2, piid=1)\nmit props set did-1 2 1 true                     # Write property\nmit props act did-1 5 1 1 2                      # Invoke action with parameters\nmit props sub                                    # Subscribe to all device property changes\nmit props sub did-1                              # Subscribe to all changes for one device\nmit props sub did-1 2 1                          # Subscribe to one property\n```\n\n### Notes\n\n- After browser login completes, `mit auth login` finalises auth automatically and shows a success page in the browser.\n- `mit props get/set/act/sub` work directly without opening the TUI.\n- `mit props sub` streams subscription logs and property updates to stdout until interrupted.\n- `mit tui` syncs devices and caches MIoT specs under `~/.mit/cache/specs/`.\n- bare `auth` keeps compatibility with `mit auth --help`.\n- bare `devices` keeps compatibility with `mit devices --help`.\n\n### TUI tabs\n\n1. `1:Account` — account list, login/logout, push message\n2. `2:Devices` — device list and property/action dialog\n3. `3:Logs` — runtime logs and status information\n4. `4:Settings` — cache cleanup (keep auth) and full reset (delete `~/.mit`, double-confirmed)\n\n---\n\n## Local-First LAN Control\n\n`mit` prefers talking to your devices over LAN (UDP/MIIO protocol) instead of going through Xiaomi's cloud:\n\n1. On first sync, `mit` fetches each device's `localip` and `token` from Xiaomi cloud.\n2. Credentials are persisted per account to `~/.mit/accounts/{account_id}/local_credentials.json`.\n3. `mit` probes reachability for each device in the background.\n\n---\n\n## JSON Output\n\nCommands support machine-readable JSON output via the global `--json` flag:\n\n```bash\nmit --json                  # Help as JSON\nmit --json auth list        # Account list as JSON\nmit --json devices list     # Device list as JSON\nmit --json push \"hello\"     # Push result as JSON\n```\n\n- `--json` applies only to successful stdout. Parse errors and runtime errors are always printed as human-readable text on stderr.\n- Streaming commands such as `mit props sub` print live text lines to stdout and do not support `--json`.\n- This makes `mit` easy to use in scripts, CI pipelines, or any automation that needs structured output.\n\n---\n\n## Configuration\n\n| Environment variable                          | Description                                                               |\n| --------------------------------------------- | ------------------------------------------------------------------------- |\n| `MIT_PROFILE_DIR` / `MIT_HOME` / `XMCLI_HOME` | Override the directory where `~/.mit` data is stored                      |\n| `MIT_MIOT_SPEC_URL_BASE`                      | Override the MIoT spec API base URL (useful for testing)                  |\n| `MIT_MICO_BASE_URL`                           | Override the Mico API base URL (debug builds only)                        |\n| `MIT_LOG_DEVICE_LIST_PAGE_RAW`                | Set to any non-empty value to log raw device list API responses to stderr |\n\nProfile data is stored under `~/.mit/`:\n\n```\n~/.mit/\n├── auth.json                          # Saved account tokens\n├── accounts/{uid}/\n│   ├── devices.json                   # Cached device list for this account\n│   └── local_credentials.json         # Per-account LAN credentials\n└── cache/\n    └── specs/\n        ├── index.json                 # Model → URN mapping\n        ├── models/                    # Per-model MIoT spec JSON\n        └── sources/                   # Cached MIoT API index files\n```\n\n---\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttys026%2Fmit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttys026%2Fmit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttys026%2Fmit/lists"}