loki888666/dsh-mihome 预览 preview

loki888666/dsh-mihome

Project Overview项目介绍

dsh-mihome is a native plugin built exclusively for DeepSeek Harness, designed to give the DSH agent the ability to control Xiaomi Mijia smart home devices. It connects Mijia devices through a Home Assistant bridge, supporting both Mijia cloud and local area network connection protocols. It exposes three tools that the large language model can call directly: listing devices, controlling devices, and checking device status. Users can install it via npm, or patch it into DSH temporarily for testing, or add it permanently to DSH’s configuration for automatic loading on every startup.

The typical workflow is straightforward for end users. All a user needs to do is describe their request in natural language, for example saying “turn on the living room light”. The DSH agent will automatically find the matching device entity, call the correct tool to generate a Home Assistant REST API request, then pass the control command through HA to the Mijia device. This plugin is made for users who want to use an LLM agent to control their Mijia smart home devices, and it automatically translates actions based on device type so users don’t need to memorize any technical service names or entity IDs.

This plugin requires a working Home Assistant instance and a valid Mijia account to operate, and it works with any HA deployment method, including containers, NAS packages, and native operating system installs. It is released under the open source MIT license, and no credentials are hard coded into the source code — all access tokens are injected via environment variables for security. A known limitation is that cloud mode can have timeout issues if HA is on a different network from your Mijia devices; for better stability, deploy HA on the same local network as your devices.

这是一款专门为 DeepSeek Harness 开发的原生插件,核心功能是让 DSH 获得控制米家智能设备的能力,支持列设备、开关设备、调节亮度、开合窗帘、启停扫地机、锁门调温等操作。插件通过 Home Assistant 桥接米家设备,支持走米家云端或局域网协议,向 DSH 暴露了三个可供大模型调用的工具。插件支持临时补丁加载、永久配置加载和 npm 安装三种接入 DSH 的方式。

用户只需要用自然语言描述需求,比如“把客厅灯打开”,DSH 就会自动匹配对应的设备实体,调用工具生成 Home Assistant REST API 请求,再通过 HA 下发控制指令给米家设备,最终完成操作。它面向想要让大模型代理控制家中米家设备的用户,不需要记住复杂的设备ID和服务名称,大模型会自动根据设备类型翻译对应动作,适配不同设备的控制需求。

本插件依赖已部署的 Home Assistant 实例和米家账号,不要求特定部署方式,容器、NAS、原生系统部署的 HA 都可以用。它采用 MIT 许可证开源,token 仅通过环境变量注入,没有硬编码,安全可靠。已知限制是如果 HA 和设备跨网段,云端模式可能出现设备状态超时,需要把 HA 部署到同网段走局域网连接更稳定。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 2 warnings2 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
  • No DSH plugin manifest detected - it may only carry the dsh-plugin topic, so the install method must be confirmed on the spot未检测到 DSH 插件清单:可能只是打了 dsh-plugin 话题,安装方式要现场确认
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:loki888666/dsh-mihome

把 loki888666/dsh-mihome 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-mihome

npm version license GitHub stars

DeepSeek Harness × Mijia

English | 中文

给 DeepSeek Harness 装上"控制米家智能设备"的能力:列设备、开关、调亮度、开合窗帘、启停扫地机、锁门、调温等。通过 Home Assistant 桥接,走米家云端或局域网协议。

你说:"把客厅灯打开"
  └─> dsh agent 调 home_device_list   找到 light.客厅_吸顶灯
  └─> dsh agent 调 home_device_set    动作 on
  └─> 本插件 POST /api/services/light/turn_on(HA REST API)
  └─> HA 经米家云(或局域网协议)下发指令
  └─> 灯亮,返回"已执行 light.turn_on"

特性

  • 3 个模型可见工具:home_device_list(列设备/关键字过滤)、home_device_set(控制)、home_device_state(查状态)
  • 动作按设备域自动翻译:灯/插座/风扇/空调 → turn_on/off,窗帘 → open/close,扫地机 → start/stop,门锁 → lock/unlock;未知动作直通任意 HA 服务名(如 set_temperature)
  • 凭据零硬编码:token 只经环境变量注入,可安全开源
  • 设备 attributes 白名单截取,避免整包状态塞进上下文

环境要求

依赖 说明
DeepSeek Harness dsh 源码仓库(提供 CLI 与运行时)
Home Assistant 米家设备桥接层(部署方式不限,见工作原理)
米家账号 中国大陆或海外区均可(Miot Auto 支持多区域)

快速开始

1. 部署 Home Assistant(macOS/Linux,docker)

docker compose -f docker/docker-compose.ha.yml up -d
# 打开 http://127.0.0.1:8123 初始化

已有 HA 实例?跳过这一步,把第 4 步的 HA_BASE_URL 指向你自己的 HA 即可。

2. 接入米家(中国大陆账号)

⚠️ 不要用 HA 自带的 "Xiaomi Home" 集成(那个用户名密码框实际是老 Miio,国区登录不稳)。装 HACS + Xiaomi Miot Auto:

docker exec -it homeassistant bash -c "wget -O - https://get.hacs.xyz | bash -"
docker restart homeassistant

浏览器:设置 → 设备与服务 → 添加集成 → 搜 HACS → GitHub 授权 → 左侧出现 HACS → HACS → 集成 → 浏览并下载存储库 → 搜 Xiaomi Miot Auto → 安装并重启 → 添加集成 → 搜 Xiaomi Miot Auto → 账号集成 → 米家账号密码 + 区域 cn → 选家庭导入设备。

账号登录报 verification ticket rejected 时,先在浏览器登录一次 account.xiaomi.com 解锁风控,再回 HA 重试。

3. 创建长期访问令牌

HA 里 个人资料 → 安全 → 长期访问令牌 → 创建令牌。

4. 配置环境变量

写入 deepseek-harness 仓库根 .env(或 export):

HA_BASE_URL=http://127.0.0.1:8123
HA_TOKEN=<上一步的令牌>
DEEPSEEK_API_KEY=<你的 DeepSeek key>

5. 运行

./scripts/mihome.sh "列出我家的设备"
./scripts/mihome.sh "把客厅主灯调亮到 50%"
./scripts/mihome.sh "关掉空气净化器"

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-novel-forge 下一个 Next dsh-win-bash-fix →