/hermitd-homeassistant:hatchfrom hermitd-homeassistant
One-time Home Assistant setup: configures HA access, connects to the official HA MCP Server, and verifies CLI and MCP connectivity. Idempotent and safe to re-run.
Ships in hermitd-homeassistant. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Set up the Home Assistant layer for this project. Idempotent — safe to re-run; will skip completed steps and offer re-verify only.
Check whether .hermit/config.json exists.
If it is missing, print this block and stop:
## ▶ Next step — type this now
/hermitd:hatch
I can't run setup wizards for you (they're operator-run by design).
After it finishes, come back and type `/hermitd-homeassistant:hatch`.
If it is present: run .hermit/bin/hermitd-run domain-hatch preflight hermitd-homeassistant and parse the JSON verdict. Branch on action:
bootstrap_core / upgrade_core_package / upgrade_core_applied → tell the operator to run the next_steps commands in order, then stop. An older core prints the dashed form of these with a remedy instead: relay remedy and stop.verify → AskUserQuestion: "Already set up. Re-verify HA access only (skip setup wizard)?". Yes → skip to §5. No → continue.full → continue with setup.error, or any domain-hatch command in this skill that prints error → tell the operator in plain words what its token means, then stop.Run ${CLAUDE_PLUGIN_ROOT}/bin/ha-agent-lab boot status and inspect the JSON output.
Important: do NOT use
grep,cat, orechoon.env— the deny-pattern hook blocks any Bash command whose arguments contain the literal stringTOKEN. Always use the CLI to check credential state.
token_configured: true and local_url non-null → proceed..env is missing or incomplete. Please create `.env` at the project root with:
HOMEASSISTANT_URL=http://homeassistant.local:8123 # or your remote URL
HOMEASSISTANT_TOKEN=<your long-lived access token>
Long-Lived Access Tokens: Home Assistant → Profile → Long-Lived Access Tokens.
AskUserQuestion: "When your .env is ready, type done to continue (or abort to stop)."
boot status and re-check. If still missing, repeat from step 1. If valid, proceed..env — it is the user's responsibility.Do not collect or store the token — it stays in .env only.
The CLI runs on bun, which the core hermit requirement guarantees — no runtime deps to install.
Run ${CLAUDE_PLUGIN_ROOT}/bin/ha-agent-lab boot status (read-only, no --probe) to confirm the launcher resolves correctly. If it fails with "bun not found", stop and tell the user to install bun (https://bun.sh) — it is required by hermitd core.
Step A — Enable the integration in Home Assistant
Tell the user: go to Home Assistant → Settings → Devices & Services → Add Integration → search "Model Context Protocol Server". Enable it. This exposes the MCP endpoint at <your HA URL>/api/mcp.
Reference: https://www.home-assistant.io/integrations/mcp_server/
Step B — Write .mcp.json
Run:
${CLAUDE_PLUGIN_ROOT}/bin/ha-agent-lab boot mcp-config
It writes the homeassistant entry from .env itself, so the token never enters the conversation. Do not Read .env or write this entry by hand. It prints JSON with no secret:
action: "added" → entry written.action: "replaced" → an old ${...} placeholder entry was rewritten with literal values; tell the user the stale entry was replaced.action: "updated" → an existing literal entry had a different URL or token than .env; only those values were refreshed.action: "skipped" → the existing entry already matches .env.status: "missing_keys" → relay missing (key names), return to §2, then re-run.{"error":"invalid_mcp_json"} → .mcp.json is not a JSON object with an mcpServers object; ask the user to fix or remove it, then re-run.The entry it writes has this shape:
{
"mcpServers": {
"homeassistant": {
"type": "http",
"url": "<HOMEASSISTANT_URL>/api/mcp",
"headers": { "Authorization": "Bearer <HOMEASSISTANT_TOKEN>" }
}
}
}
The URL is the active_url from boot status (HOMEASSISTANT_URL, or HOMEASSISTANT_LOCAL_URL for existing installs).
The name homeassistant is required — skills and the safety hook match on mcp__homeassistant__* tool IDs.
Note:
.mcp.jsonnow contains a live bearer token. Claude Code reads MCP env vars from the process environment, not from.env, so literal values are required here.
After writing .mcp.json, check the project's .gitignore:
.mcp.json is absent from it → append .mcp.json on a new line.Step C — Activate and verify
Tell the user: restart Claude Code in this project directory. On first use, Claude Code will prompt you to trust the homeassistant server — approve it. Then run /mcp to confirm homeassistant appears as connected. Run /hermitd-homeassistant:ha-house-status to check live house state.
Run ${CLAUDE_PLUGIN_ROOT}/bin/ha-agent-lab boot status --probe and present the result. If it fails:
HOMEASSISTANT_LOCAL_URL in .env.HOMEASSISTANT_TOKEN.Read ha_safety_mode from .hermit/config.json.
AskUserQuestion: "Current safety mode is <value>. Change it?" Yes → re-prompt. No → skip this step.lock, alarm_control_panel, security-related cover/button/switch):
strict blocks autonomous actuation entirely; work goes through a proposal instead.ask (recommended) prompts the operator before any actuation of a sensitive entity. Build/validate normally; both YAML apply and direct MCP calls require an explicit operator confirmation before execution.Write the chosen value to config.json as ha_safety_mode. Default to ask if the operator skips or is unsure.
Read ha_assist_control_enabled from .hermit/config.json.
HassTurnOn, HassLightSet, etc.) pass through the safety gate and HA's expose-to-Assist setting controls which devices the agent can reach. Requires the HA MCP Server's control tools to be enabled and each entity exposed in HA (Settings → Voice assistants → Expose)."
ha_assist_control_enabled: true to config.json.Read ha_update_auto_apply from .hermit/config.json.
ha-update-check always proposes pending Home Assistant updates for your review. With this on, accepting an add-on or HACS update installs it immediately (HA backs it up first, and rolls back on failure). Core, OS, and Supervisor updates always wait for your explicit go-ahead in chat, even with this enabled — those can affect dashboard access and have no software undo."
ha_update_auto_apply: true to config.json.Read .hermit/knowledge-schema.md.
Check if either - analysis: or - **analysis**: is present in the file. This string only appears as the last Raw Captures bullet written — so its presence means both blocks were fully written on a prior run.
If absent, append the following block under ## Work Products (create the section header if the base schema only has a template stub):
- brief: morning/evening house brief. location: compiled/brief-ha-<morning|evening>-<date>.md
- context: foundational house/system profile. location: compiled/context-house-profile-<date>.md
- presence-report: presence history and tracker diagnostics. location: compiled/presence-report-<date>.md
- domain-brainstorm: report from a domain plugin's `domain-brainstorm` skill, written only when the run created at least one proposal. location: compiled/domain-brainstorm-<YYYY-MM-DD-HHMM>.md
And under ## Raw Captures (create if absent):
- audit: HA operational audit (safety, integration-health, context-refresh). location: raw/audit-ha-<type>-<date>.md
- simulation: HA automation simulation result. location: raw/audit-ha-simulation-<slug>-<date>.md
- apply: HA automation apply result. location: raw/audit-ha-apply-<slug>-<date>.md
- remove: HA automation/script delete audit. location: raw/audit-ha-remove-<slug>-<date>.md
- analysis: HA pattern analysis. location: raw/patterns-<date>.md
Omit the domain-brainstorm bullet when ## Work Products already declares it (another domain plugin's hatch may have added it).
If already present: skip (idempotent).
Use Edit to make the changes.
Write _hermit_versions["hermitd-homeassistant"] into .hermit/config.json, set to self_version from Step 1's preflight.
Compiled templates: Copy ${CLAUDE_PLUGIN_ROOT}/state-templates/compiled/acknowledged-violations.md to .hermit/compiled/acknowledged-violations.md if that file does not already exist. Set created in the frontmatter to today's ISO date. This gives the operator a ready-to-use suppression list for the safety audit.
HA routine registration: config.routines is an array of objects with {id, schedule, skill, enabled}. A row matches a seeded entry when its full skill string (including arguments) or its id equals the seeded one's; preserve every field on a matching row. If a match exists, skip registration. Otherwise offer the optional house routine and append its namespaced id. Never replace or disable core routines.
Context refresh — "Add daily HA context-refresh routine (08:30 every day)? Keeps entity snapshots fresh automatically."
{"id": "hermitd-homeassistant:daily-ha-context", "schedule": "30 8 * * *", "skill": "hermitd-homeassistant:ha-refresh-context", "enabled": true}
Morning brief — "Add morning house brief routine (08:30 every day)? Includes house state, overnight anomalies, energy and HA updates."
{"id": "hermitd-homeassistant:morning-brief", "schedule": "30 8 * * *", "skill": "hermitd-homeassistant:ha-morning-brief", "enabled": true}.Evening brief — "Add evening house-check routine (22:30 every day)? Includes security, device status and energy."
{"id": "hermitd-homeassistant:evening-brief", "schedule": "30 22 * * *", "skill": "hermitd-homeassistant:ha-evening-brief", "enabled": true}.After adding or updating any entries, remind the operator: "Run /hermitd:hermit-routines load to activate routines in the current session."
Analysis routine registration
Merge these entries into config.routines by the same matching rule. Create the array if absent. Append each entry with no matching row and leave all other config fields unchanged. No prompt is needed for these read-only analyses.
{"id": "hermitd-homeassistant:ha-patterns", "schedule": "5 9 * * 1", "skill": "hermitd:reflect --check-id ha-patterns --check hermitd-homeassistant:ha-analyze-patterns", "enabled": true}
{"id": "hermitd-homeassistant:ha-safety-audit", "schedule": "5 9 * * 1", "skill": "hermitd:reflect --check-id ha-safety-audit --check hermitd-homeassistant:ha-safety-audit", "enabled": true}
{"id": "hermitd-homeassistant:ha-integration-health", "schedule": "5 9 * * *", "skill": "hermitd:reflect --check-id ha-integration-health --check hermitd-homeassistant:ha-integration-health", "enabled": true}
{"id": "hermitd-homeassistant:ha-update-check", "schedule": "5 9 * * *", "skill": "hermitd:reflect --check-id ha-update-check --check hermitd-homeassistant:ha-update-check", "enabled": true}
Each routine owns its cadence and passes findings through reflection gates into the proposal pipeline.
If needs_target_question is true, ask with AskUserQuestion (header: "Visibility") — target_default at position 0 with (recommended): .local files (gitignored — operator-personal) / Committed files (shared with teammates). Then record it:
.hermit/bin/hermitd-run domain-hatch ensure-target hermitd-homeassistant --target <choice>
Resolve the project settings target through .hermit/bin/hermitd-run domain-hatch preflight hermitd-homeassistant. Map target (or target_default when absent): local to .claude/settings.local.json, committed to .claude/settings.json.
Run bun ${CLAUDE_PLUGIN_ROOT}/scripts/native-permissions.ts <resolved-settings-file>. It prints OK, or {"status":"installed","deny_conflicts":[...]} naming operator denies that still override these asks (tell the operator), or {"error":...} with exit 1 (relay it and stop).
Summarize:
hatch complete
✓ .env verified (user-managed)
✓ CLI: bin/ha-agent-lab boot status --probe → OK / FAILED
✓ .mcp.json: homeassistant entry written / already present
✓ config.json stamped v<version>
✓ Routines registered under hermitd-homeassistant: daily-ha-context, morning-brief, evening-brief, ha-patterns, ha-safety-audit, ha-integration-health, ha-update-check
✓ knowledge-schema.md: HA types added (or already present)
Manual steps remaining:
- Enable 'Model Context Protocol Server' integration in Home Assistant (if not done)
Settings → Devices & Services → Add Integration → search "MCP"
- Restart Claude Code and approve the 'homeassistant' server on first use
- Run /mcp to confirm 'homeassistant' is connected
Go always-on (recommended):
- Docker: /hermitd:docker-setup
Builds the container and walks you through channel pairing in one go.
- Bare tmux: hermitd start
For channels (Discord/Telegram) with tmux, run
/hermitd:channel-setup first.
Prefer to test interactively first?
1. /hermitd-homeassistant:ha-house-status
— shows live house state. Run /hermitd-homeassistant:ha-refresh-context
to refresh the context snapshot.
2. /hermitd:hermit-routines load
— activates scheduled routines in the current Claude session.
The always-on runtime loads routines automatically. The
hermitd-homeassistant:daily-ha-context and hermitd-homeassistant:ha-integration-health
routines keep house snapshots fresh between manual checks.
Ready to organize your house?
/hermitd-homeassistant:ha-setup-house
— create areas, assign entities and devices, provision helpers,
and scaffold starter automations.
Read by /hermitd:docker-security when the operator enables LAN containment + DNS policy. Each entry is surfaced as a per-entry confirmation prompt; nothing here is auto-applied.
The nabu.casa entry covers Nabu Casa Cloud (<id>.ui.nabu.casa) since dnsmasq's server=/nabu.casa/... pattern matches subdomains. home-assistant.io covers integration docs (www.home-assistant.io) and the developer API reference (developers.home-assistant.io) that skills consult when verifying REST/WebSocket endpoints. READ_FROM_ENV:HOMEASSISTANT_URL resolves to the hostname of the operator's configured HA instance — covers custom remote domains (e.g. ha.mydomain.com) that are not under nabu.casa. Operators on a self-hosted local HA instance should accept ASK_OPERATOR_FOR_HA_IP and provide the LAN IP of their HA box. mDNS / homeassistant.local does not work through dnsmasq — use the IP directly.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
19 skills in this plugin
/domain-brainstormOn-demand HA-voice brainstorm — reads entity inventory, automation/script listings, and operator intent to surface at most 2 capability-gap ideas, each gated by proposal-triage before becoming a proposal task. Invoke when the operator asks "what automations am I missing?", "any coverage gaps?", or "brainstorm improvements". Never runs autonomously./ha-analyze-patternsAnalyze Home Assistant history data and entity patterns to identify automation opportunities, unused devices, and energy anomalies. Use periodically or when looking for optimization opportunities./ha-apply-changenpx claudepluginhub gtapps/hermitd --plugin hermitd-homeassistantOther plugins' skills for the same job