mcpbeat

Mijia Device Manager Agent Skill

管理和控制小米/米家智能家居设备,直接调用 mijiaAPI CLI 命令通过小米云端 API 控制设备。支持设备发现、开关控制、亮度调节、颜色设置等功能。当用户需要控制小米智能设备(如台灯、灯泡、插座等)、获取设备列表或查看设备状态时使用此技能。

1k tokens
context cost
the whole folder, loaded on every use
2
files
instructions only
0
copies elsewhere
how many repositories repackaged it
126
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/dean2021/mijia-device-manager --skill mijia-device-manager

The instruction itself

3 sections, as written by the author

米家设备管理器

概述

此技能用于管理和控制小米/米家智能家居设备,直接调用 mijiaAPI CLI 通过小米云端 API 控制设备。

功能特性

  • 登录小米账号(扫码登录)
  • 获取设备列表和家庭列表
  • 获取和设置设备属性
  • 执行设备动作
  • 查看设备完整状态

前提条件

  • 安装依赖:
pip install mijiaAPI
  • 登录小米账号(首次使用需要):
python -m mijiaAPI --list_homes

快速开始

1. 首次登录

python -m mijiaAPI --list_homes

运行后会显示二维码,使用米家 APP 扫描即可完成登录。

2. 查看设备列表

python -m mijiaAPI -l

输出中每条设备信息包含 did,后续控制命令使用该值。

3. 控制设备

# 开灯
python -m mijiaAPI set --did "123456789" --prop_name "on" --value True

# 设置亮度
python -m mijiaAPI set --did "123456789" --prop_name "brightness" --value 50

# 获取状态
python -m mijiaAPI get --did "123456789" --prop_name "brightness"

命令参考

python -m mijiaAPI --help
python -m mijiaAPI get --help
python -m mijiaAPI set --help

常用命令示例:

# 列出所有设备
python -m mijiaAPI -l

# 从列表中找到 did
python -m mijiaAPI -l | grep did

# 列出所有家庭
python -m mijiaAPI --list_homes

# 获取设备属性
python -m mijiaAPI get --did "123456789" --prop_name "brightness"

# 设置设备属性
python -m mijiaAPI set --did "123456789" --prop_name "on" --value True
python -m mijiaAPI set --did "123456789" --prop_name "brightness" --value 50

# 执行场景
python -m mijiaAPI --run_scene "回家"

设备属性参考

常见设备属性名称:

| 属性名 | 说明 | 类型 | 示例值 |

|--------|------|------|--------|

| on | 开关状态 | bool | True/False |

| brightness | 亮度 | int | 0-100 |

| color-temperature | 色温 | int | 2700-6500 |

| color | 颜色 | int | RGB值 |

注意: 不同设备支持的属性不同,操作前先使用 --get_device_info DEVICE_MODEL 获取设备属性信息,确认可操作的属性后再执行控制命令。DEVICE_MODEL 可通过 --list_devices 获取。

操作步骤:

  • 使用 python -m mijiaAPI -l 列出设备,确认 didDEVICE_MODEL
  • 使用 python -m mijiaAPI --get_device_info DEVICE_MODEL 获取可用属性与范围。
  • 根据属性信息执行 getset 命令完成查询或控制。

故障排除

登录问题

问题:无法登录或提示认证失败

  • 删除认证文件重新登录:
   rm ~/.config/mijia-api/auth.json
   python -m mijiaAPI --list_homes
  • 检查网络连接是否正常
  • 确认米家APP账号和密码正确

设备控制问题

问题:找不到设备

  • 确认设备已在米家APP中添加
  • 检查设备名称是否正确(区分大小写)
  • 使用 -l 命令查看准确的设备名称

问题:不知道 did

  • 使用 python -m mijiaAPI -l 列出设备,在输出中找到设备的 did 字段

问题:属性设置失败

  • 确认设备支持该属性(使用 --get_device_info DEVICE_MODEL 获取属性信息)
  • 检查属性值范围是否正确
  • 确认设备在线且网络正常

问题:想知道某个设备都有哪些属性

  • 先用 --list_devices 获取 DEVICE_MODEL,再用 --get_device_info DEVICE_MODEL 获取属性信息,例如:
   python -m mijiaAPI --get_device_info yeelink.light.lamp27

获取帮助

  • mijiaAPI GitHub: https://github.com/Do1e/mijia-api
  • 米家规格平台: https://home.miot-spec.com/

Other skills for the same job

different authors, same section of the catalogue
MCP Builder
by anthropics
vendor ×13

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

30k tokens scripts
Changelog Generator
by frostant
×9

Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.

774 tokens
Finishing A Development Branch
by ZhanlinCui
×7

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

1k tokens
MCP Builder
by JayZeeDesign
×7

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

37k tokens scripts
Vercel React Native Skills
by vercel-labs
vendor ×6

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

39k tokens
Vercel React Best Practices
by ratacat
×5

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

34k tokens
Next Best Practices
by vercel-labs
vendor ×4

Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling

20k tokens
Using Git Worktrees
by ZhanlinCui
×4

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification

1k tokens

How to use it

Copy the folder

Take dean2021/mijia-device-manager from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.

Install what it needs

The instructions reference pip. Without those the skill loads but fails at the first command.