Skip to content
Back to skills

Ha Snapshot Restore

ASecurity

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.

  • 74 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 2, 2026
ai-agentsbashtestingsecurity

Works with

  • claude code
  • cli

Security analysis

A100/100

Scanned September 20, 2026

npx -y skills add gtapps/claude-code-hermit --skill ha-snapshot-restore --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ha Snapshot Restore?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ha Snapshot Restore
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gtapps-ha-snapshot-restore/badge)](https://www.skillsdirectory.com/skills/gtapps-ha-snapshot-restore)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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
---

# 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> ...]
```

- `--name` labels the snapshot (default `snapshot`); it becomes part of the artifact filename.
- `--domains` selects which domains to capture (comma-separated; default `light,cover,climate,switch`).
- `--entities` captures an explicit list instead of whole domains.
- Writes `.claude-code-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** and exits non-zero with `blocked:true` and a suggestion to 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 `.claude-code-hermit/raw/audit-ha-restore-*`.

## Output contract

Capture prints `{ ok, name, captured, entities, report_path, message }`.

Restore prints `{ ok, blocked, applied, entities, sensitive, reason, ... }`. Exit code is 0 only when `ok` is true.

## Failure modes

- HA unreachable → CLI exits non-zero with an error message.
- A snapshot with no matching entities → capture reports `captured: 0`; restore reports an error.
- 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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…