home-assistant
Manage Home Assistant configuration safely and fast — edit and deploy YAML (automations, blueprints, scripts, scenes, templates, MQTT), validate with ha core check, deploy via git or rapid scp, reload-vs-restart correctly, verify changes from logs, traces and entity state, and build Lovelace dashboards. Use for any Home Assistant config, automation, template, or dashboard work over SSH/hass-cli/MCP.
1How It Works & Mechanism
Zero-code core: The skill includes no executable scripts; all capabilities are delivered via host tools + domain knowledge. Remote HA operations rely on three existing channels, with SKILL.md purely handling selection and orchestration.
- Access via one or more of: `hass-cli` (REST), SSH `ha`, or an MCP server (see below).
MCP-first strategy: If an MCP server is attached to the host, use its first-class tools for real-time state inspection and service calls, avoiding hass-cli environment variable preload friction; references both official and community servers.
juggling. Official `mcp_server` integration (HA core ≥2025.2) or community `ha-mcp`
Deployment pipeline formalized into a strict 6-step workflow (edit → check → commit/push → pull → reload/restart → verify), explicitly defining changes as live only after Step 4 via remote git pull.
Changes are not live until step 4.
Fast-feedback bypass: Skips git to scp single files directly to /config on the instance followed by reload, tailored for dashboard iteration and rapid prototyping; git commits are deferred until stable.
**Rapid iteration:** skip git and `scp` straight to the instance, then reload
Reload vs. restart decisions are table-driven rather than heuristic: domain entities (automations, scripts, scenes, templates, themes) use reload; core configuration.yaml, new integrations, platform sensors, MQTT platforms, and dashboard registries require restart.
| automations, scripts, scenes, groups, template entities, themes | **reload** the domain (`hass-cli service call automation.reload`, etc.) |
Rigorous verification loop: Reload/restart, manually trigger automations for instant feedback, grep logs by change identifier, and verify entity states, explicitly noting the trap that automation.trigger bypasses conditions by default.
`hass-cli service call automation.trigger --arguments entity_id=automation.<id>`
Tiered knowledge architecture: SKILL.md remains lightweight (107 non-empty lines; streamlined from 627 lines in v1.0.0), delegating in-depth automation and Lovelace details to two reference files routed on-demand for progressive disclosure.
**Full automation reference** (syntax table, `mode:` behavior, blueprints, trace debugging, pitfalls) → read [`reference/automations.md`](reference/automations.md) when writing or debugging automations.
Embedded security boundaries: Confines file edits strictly to .yaml/.yml/.md, explicitly forbids reading or writing .env and secrets.yaml (enforcing !secret), mandates passing ha core check before restart, and requires ha backups new snapshots prior to risky changes.
- Only edit `.yaml`/`.yml`/`.md`. Never read/write `.env` or `secrets.yaml`; use `!secret`.
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| api | Home Assistant REST API(经 hass-cli 调用) |
| cli | hass-cli(homeassistant-cli,pipx 安装) |
| cli | ssh / scp / 远端 `ha` CLI(HA 宿主 root@homeassistant.local 为占位符) |
| api | Home Assistant MCP server(官方 mcp_server 集成 / 社区 ha-mcp) |
| network | Context7 MCP(HA 官方文档检索,可选) |
| network | GitHub(README 安装方式三:curl 下载仓库 tarball) |
| package | HACS(安装 custom:mushroom-* 卡片的前提) |
| cli | Claude-in-Chrome 浏览器扩展(原生浏览器验证通道,参考中说明不用 Playwright/MCP) |
4Recommended Governance & Evidence
- scripts/: Executes local scripts or commands: ssh root@homeassistant.local "ha core check" (configuration validation, ~30-60s)
- 网络端点: Declares external network access: http://homeassistant.local:8123 — Home Assistant REST API, hass-cli via HASS_SERVER
- 本地工作目录: File I/O and artifact output: Writes .yaml/.yml within the HA instance /config (automations.yaml, scripts/scenes/templates, configuration.yaml)
5Second-Pass Verification
- [ok] skill 目录与 SKILL.md 定位(任务提示为待定位) — 实际路径 skills/home-assistant-manager/SKILL.md 存在,frontmatter name: home-assistant-manager 与 description 与任务给的一字不差;同目录含 reference/{automations,dashboards}.md 与 dashboard.png。
- [ok] 『MCP 还是原生 REST?』的事实核对 — 两者都给,但性质不同:SKILL.md 只对 MCP 表达偏好('MCP (preferred when available)')并点名官方 mcp_server 集成与社区 ha-mcp,却未给任何 MCP 安装/配置命令;真正可直接执行的命令全是 hass-cli/ssh/scp。README 中唯一的 claude mcp add 是 context7(文档检索),不是 HA 控制通道。故『MCP 优先』属策略声明,可执行面是 CLI/SSH。
- [ok] 凭证读取【决定档位的关键项】 — HASS_TOKEN 全仓命中 4 处:SKILL.md 第 22/24 行(hass-cli 需 HASS_SERVER/HASS_TOKEN、判存在 `[ -n "$HASS_TOKEN" ]`)、README 第 83 行(前置条件列出两个环境变量)、README 第 328 行(export 占位值)。无任何要求打印、回显、上传或写入 token 的指令;同时 SKILL.md 明令不读不写 .env/secrets.yaml。结论:存在环境变量依赖但无外泄路径,仍因持 token 的 CLI/MCP 通道记 orange。
- [ok] 隐藏脚本 / 可执行代码核查 — glob 含隐藏文件全量结果仅 9 个:.gitignore、LICENSE、README.md、release.txt、SKILL.md、dashboard.png、reference/automations.md、reference/dashboards.md、.claude-plugin/{plugin,marketplace}.json、.github/FUNDING.yml。无 .sh/.py/.js/.ts,无 package.json,无 hook 配置。所以 security.scripts_executed 列出的都是 SKILL.md 指示宿主去跑的外部命令,不是仓库自带脚本。
- [ok] 网络端点清点(区分服务端点与文档链接) — 真实服务端点仅两个:http://homeassistant.local:8123(HA REST,README 第 327 行)与 https://mcp.context7.com/mcp(README 第 347 行)。其余 URL 为 shields 徽章、github.com 仓库/安装 tarball、home-assistant.io 文档、buymeacoffee 按钮、semver.org,均非 skill 运行所需的调用面。websocket 与 supervisor 全仓零命中——SKILL.md 未声称也不使用 WebSocket API 或 Supervisor API。
- [discrepancy] 功能声明 vs 实际能力(夸大检查) — README『Workflow Optimization』bullet 写 'No Restart for Dashboards',而同仓库 dashboards.md 与 SKILL.md 都明确写直接文件编辑(scp/git)到 .storage/lovelace.* 可能不被识别、需 `ha core restart`(HA 缓存 lovelace store)。README 该 bullet 只在『UI 编辑 + 硬刷新』这一子情形下成立,属表述宽于实际;这是唯一发现的声明出入,不影响其余能力项(自动化语法、验证闭环、卡片选型等条条有正文支撑)。
- [ok] reference 分层是否真实被引用(而非死文件) — SKILL.md 正文对 reference/automations.md 与 reference/dashboards.md 各有一条显式指路句('→ read [`reference/…`](reference/…)'),且两个文件首行都反向声明 'Core deploy/verify rules are in `../SKILL.md`',双向链接成立。
- [ok] reload/restart 决策表与 HA 语义一致性 — 表内 reload 集合(automations/scripts/scenes/groups/template entities/themes)与 restart 集合(configuration.yaml core、新集成、platform sensors、MQTT 平台、lovelace_dashboards)与 automations.md 中 blueprint 改动需 reload、dashboard 注册需 restart 的说明自洽,无自相矛盾。
6Verdict & Scenarios
23d2cb212a09fcaf…