Xiaomi Mijia Device Controller

VerifiedCaution

Control Xiaomi Mijia smart home devices: list devices/scenes, get/set properties, run scenes, and issue natural language commands via Xiao Ai speaker.

Sby Skills Guide Bot
ProductivityBeginner
7/24/2026
Claude Code
#smart-home#iot#xiaomi-mijia#cli#home-automation

Recommended for

Automated summary

This skill controls Xiaomi Mijia smart home devices (lights, purifiers, scenes) by running the mijiaAPI CLI through uvx, reading and writing device properties and triggering scenes.

Strengths

  • Covers the full practical loop: list devices/homes/scenes, read a property, set it, and run a scene
  • No manual install thanks to uvx, and the auth token is reused after the initial QR-code login
  • Step-by-step instructions with concrete get/set command examples (brightness, color temperature, fan level)
  • Includes a --get_device_info lookup so the agent can discover valid property names and allowed values per model

Limitations

  • First-time authentication requires scanning a QR code with the Mijia app, which is a manual step outside the agent
  • Property names and value ranges differ by device model and must be checked case by case
  • Depends on uvx, the mijiaAPI package and network access to Xiaomi's servers
When to use it

Use it when the user wants to turn a Mijia device on or off, adjust brightness or temperature, trigger a scene, or check a device's current state.

When not to use it

Avoid it for devices from other ecosystems (HomeKit, Tuya, Philips Hue) or when the user cannot complete the initial QR-code login.

Security analysis

Caution
Quality score85/100

The skill leverages a third-party CLI via uvx and network access to control smart home devices. The actions are legitimate and not destructive or exfiltrating, but they involve powerful tools and external code execution, warranting caution.

Findings
  • •Uses uvx to download and execute mijiaAPI from PyPI, introducing a supply-chain risk.
  • •Issues commands that control physical smart home devices and Xiao Ai speakers, which could affect the user's environment.
  • •Stores authentication token at ~/.config/mijia-api/auth.json; if compromised, it could be used to control devices.
How this analysis is made

Examples

Turn on lamp and set brightness
Turn on the bedroom lamp and set its brightness to 60%.
Inspect devices and scenes
List all my Xiaomi Mijia devices and the scenes I have available.
Read current state
What is the current brightness and color temperature of the living room light?

name: xiaomi description: Control Xiaomi Mijia smart home devices — list devices/scenes, get/set device properties, run scenes, and issue natural language commands via Xiao Ai speaker. Use when users ask to control smart home devices, turn on/off lights, adjust brightness or temperature, run scenes, or query device status.

Xiaomi Mijia Device Controller

Control Xiaomi Mijia smart home devices via the mijiaAPI CLI, powered by Do1e/mijia-api.

Prerequisites

Uses uvx to run mijiaAPI — no manual installation required.

First-time login: Authentication is stored at ~/.config/mijia-api/auth.json. On first run, a QR code will be printed in the terminal — scan it with the Mijia (米家) app to authenticate. Subsequent runs reuse the saved token automatically.

Usage

When the user wants to control a Xiaomi Mijia device: $ARGUMENTS

Instructions

Important: All commands use uvx mijiaAPI. uvx handles installation and environment isolation automatically.

Set MIJIA_LOG_LEVEL=DEBUG if you need verbose output for troubleshooting.


Step 1: Determine what the user wants

Identify the intent from the user's request:

  • List devices / homes / scenes → go to Step 2
  • Get a device property (e.g. "what's the brightness?") → go to Step 3
  • Set a device property (e.g. "turn on the light", "set brightness to 60") → go to Step 4
  • Run a scene (e.g. "activate sleep mode") → go to Step 5
  • Natural language command via Xiao Ai speaker → go to Step 6

If the intent is unclear, ask the user to clarify before proceeding.


Step 2: List resources

List all devices (includes shared devices)

uvx mijiaAPI -l

Output includes each device's name, model, and did (device ID). Use device names in subsequent commands.

List homes

uvx mijiaAPI --list_homes

List scenes

uvx mijiaAPI --list_scenes

List consumable items (filters, bulbs, etc.)

uvx mijiaAPI --list_consumable_items

Show the output to the user in a readable format.


Step 3: Get a device property

If the user doesn't know which property name to use, first look up the device spec:

# Replace MODEL with the model from --list_devices output (e.g. yeelink.light.lamp4)
uvx mijiaAPI --get_device_info MODEL

This prints all supported property names and actions for the device. Use the property name shown there.

Then get the value:

uvx mijiaAPI get --dev_name "DEVICE_NAME" --prop_name "PROP_NAME"

Examples:

# Get brightness of bedroom lamp
uvx mijiaAPI get --dev_name "卧室台灯" --prop_name "brightness"

# Get power state
uvx mijiaAPI get --dev_name "客厅灯" --prop_name "on"

# Get color temperature
uvx mijiaAPI get --dev_name "卧室台灯" --prop_name "color-temperature"

Report the result to the user in plain language (e.g. "The brightness is currently 60%").


Step 4: Set a device property

If the property name is unknown, first run --get_device_info MODEL (see Step 3) to find the correct property name and its allowed values.

uvx mijiaAPI set --dev_name "DEVICE_NAME" --prop_name "PROP_NAME" --value VALUE

Examples:

# Turn on a device 开灯
uvx mijiaAPI set --dev_name "卧室台灯" --prop_name "on" --value True

# Turn off a device 关灯, “关闭书房台灯”
uvx mijiaAPI set --dev_name "书房台灯" --prop_name "on" --value False

# Set brightness (0–100)
uvx mijiaAPI set --dev_name "卧室台灯" --prop_name "brightness" --value 60

# Set color temperature
uvx mijiaAPI set --dev_name "卧室台灯" --prop_name "color-temperature" --value 4000

# Set fan speed
uvx mijiaAPI set --dev_name "空气净化器" --prop_name "fan-level" --value 2

Confirm success to the user. If the command fails with a value error, check allowed ranges using --get_device_info.


Step 5: Run a scene

Scenes can be specified by name or ID (get the list with --list_scenes).

# Run one or more scenes by name or ID
uvx mijiaAPI --run_scene "SCENE_NAME_OR_ID"

# Run multiple scenes
uvx mijiaAPI --run_scene "睡眠模式" "晚安"

Confirm to the user which scene(s) were triggered.


Step 6: Natural language command via Xiao Ai speaker

Use this only when the user wants to issue a command through a Xiao Ai (小爱) smart speaker.

# Send a natural language command (uses first available Xiao Ai speaker)
uvx mijiaAPI --run "PROMPT"

# Target a specific speaker
uvx mijiaAPI --run "PROMPT" --wifispeaker_name "SPEAKER_NAME"

# Silent execution (device obeys but speaker doesn't speak)
uvx mijiaAPI --run "PROMPT" --quiet

Examples:

uvx mijiaAPI --run "打开卧室台灯"
uvx mijiaAPI --run "把亮度调到50%"
uvx mijiaAPI --run "关闭所有灯" --quiet
uvx mijiaAPI --run "播放音乐" --wifispeaker_name "客厅小爱"

Troubleshooting

Login / QR code expired:

  • Re-run the command; a new QR code will be printed. Scan with the Mijia app.
  • If auth persists across sessions, the token is cached at ~/.config/mijia-api/auth.json.

Device not found:

  • Run uvx mijiaAPI -l to verify the exact device name (names are case-sensitive, must match the Mijia app).
  • For shared devices they should appear in the -l listing.

Property name unknown:

  • Run uvx mijiaAPI --get_device_info MODEL with the device model from -l output.

Value out of range / invalid:

  • Check allowed values with --get_device_info MODEL and retry with a valid value.

Debug logging:

MIJIA_LOG_LEVEL=DEBUG uvx mijiaAPI -l

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/xiaomi-mijia-device-controller-mryiqhcw/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/xiaomi-mijia-device-controller-mryiqhcw' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/xiaomi-mijia-device-controller-mryiqhcw/download' --output '.skill-downloads/xiaomi-mijia-device-controller-mryiqhcw/SKILL.md.part' && mv '.skill-downloads/xiaomi-mijia-device-controller-mryiqhcw/SKILL.md.part' '.skill-downloads/xiaomi-mijia-device-controller-mryiqhcw/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Original excerpt: Prerequisites

Uses uvx to run mijiaAPI — no manual installation required.

First-time login: Authentication is stored at ~/.config/mijia-api/auth.json. On first run, a QR code will be printed in the terminal — scan it with the Mijia (米家) app to authenticate. Subsequent runs reuse the saved token automatically.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/xiaomi-mijia-device-controller-mryiqhcw/SKILL.md' && test -s '.skill-downloads/xiaomi-mijia-device-controller-mryiqhcw/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/xiaomi' && cp -R '.skill-downloads/xiaomi-mijia-device-controller-mryiqhcw' '.claude/skills/xiaomi'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/xiaomi-mijia-device-controller-mryiqhcw'

openskills read 'xiaomi-mijia-device-controller-mryiqhcw'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/xiaomi-mijia-device-controller-mryiqhcw/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills