ha-snapshot-restore
Capture the state of a set of Home Assistant entities (lights, covers, climate, switches) to a named artifact and restore it later via scene.apply. Use to make automation testing reversible — snapshot before a risky change, restore if it misbehaves. Restore of sensitive entities is gated by ha_safety_mode.
- License 许可
- MIT
- 所属仓库
- gtapps/hermitd
- 最近更新
- 2026-11-15
- Stars
- ★ 85
- Forks
- 16
01 前言 Front Matter
- name
- ha-snapshot-restore
- description
- Capture the state of a set of Home Assistant entities (lights, covers, climate, switches) to a named artifact and restore it later via scene.apply. Use to make automation testing reversible — snapshot before a risky change, restore if it misbehaves. Restore of sensitive entities is gated by ha_safety_mode.
- allowed-tools
- [ "Bash", "Read" ]
03 SKILL.md 正文
HA Snapshot / Restore
Purpose
Make changes reversible: capture an entity set's current state before testing a new automation or applying a risky change, then restore those exact states if it misbehaves. Capture is read-only; restore actuates devices in one scene.apply call.
Capture (read-only)
${CLAUDE_PLUGIN_ROOT}/bin/ha-agent-lab ha snapshot-states --name <label> [--domains light,cover,climate,switch] [--entities <id> ...]
--namelabels the snapshot (defaultsnapshot); it becomes part of the artifact filename.--domainsselects which domains to capture (comma-separated; defaultlight,cover,climate,switch).--entitiescaptures an explicit list instead of whole domains.- Writes
.hermit/raw/snapshot-ha-states-<label>-latest.json(plus a timestamped copy). Only restore-relevant attributes are stored.
Restore (actuation — gated)
${CLAUDE_PLUGIN_ROOT}/bin/ha-agent-lab ha restore-states <artifact>
Restore is the plugin's one direct device-actuation path, so it runs through the same ha_safety_mode policy as every other actuation:
- strict (explicit): if the snapshot contains any sensitive entity (lock, alarm, security-keyworded cover/switch), restore is blocked: the CLI prints
{"status":"blocked","reason":"strict_mode",...}listing thesensitiveentities; surface it as a proposal. Non-sensitive entities (lights, climate) restore normally. - ask: show the affected entities before restoration; Claude Code requests native approval for sensitive targets before the command executes.
- A successful restore writes an audit report under
.hermit/raw/audit-ha-restore-*.
Output contract
Capture prints { name, captured, entities, report_path }.
Restore prints { applied, entities, sensitive, report_path }, or a status with exit 0: {"status":"blocked","reason":"strict_mode"} or {"status":"empty","reason":"no_entities"}.
Failure modes
- HA unreachable or erroring: the CLI prints
{"error":"ha_unreachable:<detail>"}or{"error":"ha_http_<status>:<detail>"}and exits 1. An unreadable snapshot file prints{"error":"snapshot_unreadable:<detail>"}. - A snapshot with no matching entities: capture reports
captured: 0; restore reportsstatus: "empty". - Restore replays state + captured attributes via
scene.apply; for cover position and climate setpoints the result depends on what HA's scene integration can reproduce — verify the outcome rather than assuming an exact match.
04 同仓库更多 Skills
task-decide
Record the operator's typed task decision.
dream
Nightly memory maintenance from transcript ground truth. Verifies, enriches and tidies auto-memory and topic pages with snapshot validation and undo. Also handles 'undo the dream'.
when-done-switch-to
Arm a deferred model or effort switch. Use for "when done switch to", "after this drop to sonnet", or "switch model when idle".
weekly-review
Generate the weekly review report for the current ISO week. Writes to .hermit/compiled/review-weekly-YYYY-Www.md (dev-facing detail) and sends a plain-language channel summary (Delivered / Decisions / Waiting on you / Spend). Runs every Sunday at 23:00 via routine.
watch
Background events via the config watch monitor or ad-hoc Monitor tool. Quiet watches cost zero tokens.
watch-activate
Activate the config watch monitor.