Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xiaomi-home-cli

A command-line tool for managing Xiaomi smart home devices via the MiOT protocol. Supports both cloud API and direct LAN control.

Install

curl -fsSL https://raw.githubusercontent.com/xeodou/xiaomi-home-cli/main/install.sh | bash

Or download a binary from the Releases page.

Quick Start

# Authenticate with your Xiaomi account
xiaomi-home-cli auth login

# List all devices
xiaomi-home-cli device list

# Get a device property (e.g. power status: siid=2, piid=1)
xiaomi-home-cli prop get --name "Desk Lamp" --siid 2 --piid 1

# Set a device property
xiaomi-home-cli prop set --name "Desk Lamp" --siid 2 --piid 1 --value true

# Use LAN mode (faster, no cloud round-trip)
xiaomi-home-cli prop get --name "Desk Lamp" --siid 2 --piid 1 --lan

# Self-upgrade to latest release
xiaomi-home-cli self-upgrade

Commands

Command Subcommands Description
auth login, status Xiaomi OAuth authentication
device list, info, spec, scan Device management
device camera list, info, bridge, live, snapshot Camera device commands
home list List homes and rooms
scene list, run Automation scenes
prop get, gets, set, sets MiOT device properties (--lan supported)
action run, batch MiOT device actions (--lan supported)
config show, set CLI configuration
self-upgrade Update binary to latest GitHub release

Global Flags

  • --json -- output as JSON
  • --json-errors -- output errors as JSON on stderr

Device Selection

Most commands accept these flags to identify a device:

  • --did -- device ID (exact match)
  • --name -- device name
  • --room -- room name
  • --model -- device model
  • --home -- home name
  • --first -- pick first match if ambiguous

LAN Mode

The prop and action commands support --lan to communicate directly with devices over the local network using the miIO protocol (UDP port 54321). This is faster and works without internet access.

LAN mode requires cached device info. Run device list --force-refresh first.

Build from Source

Requires Go 1.22 or later.

git clone https://github.com/xeodou/xiaomi-home-cli.git
cd xiaomi-home-cli
go build -o xiaomi-home-cli ./cmd/xiaomi-home-cli

Cross-compile for Raspberry Pi:

GOOS=linux GOARCH=arm64 go build -o xiaomi-home-cli-linux-arm64 ./cmd/xiaomi-home-cli

License

MIT

About

Xiaomi Home / MiOT CLI — manage smart home devices from the terminal

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages