skills/homeassistant-ops/SKILL.md
Operate a Home Assistant instance via the official REST/WebSocket APIs and backups, with safe plan/apply workflows for bulk, reviewable changes.
npx skillsauth add goncalossilva/.agents homeassistant-opsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill as the operator's playbook for making bulk, reviewable changes to a Home Assistant instance without SSHing into the host.
Requires Node.js 22+ (uses built-in fetch + WebSocket; no npm deps).
Set environment variables (never pass tokens on the command line):
export HA_URL="http://<home-assistant-host>:8123"
export HA_TOKEN="<long-lived-access-token>"
Run scripts using node:
node scripts/ha_ops.js --help
Keep logs in a working folder (scripts write timestamped .md files by default).
All scripts read HA_URL and HA_TOKEN from environment variables.
ha_ops.js - Single CLI with subcommandsAll operations are available under a single CLI:
# List commands
node scripts/ha_ops.js --help
# Command help
node scripts/ha_ops.js cleanup --help
ha_ops.js cleanup - Bulk cleanup (dry-run by default)# Dry-run all default steps (default)
node scripts/ha_ops.js cleanup
# Apply specific steps
node scripts/ha_ops.js cleanup --apply \
--steps rename-switch-suffix,prefix-lights-cove
# Prefix custom patterns with area names
node scripts/ha_ops.js cleanup --apply \
--steps prefix-generic \
--pattern "Thermometer:^Thermometer" \
--pattern "Blinds:^Blinds"
# Output proposed changes as JSON
node scripts/ha_ops.js cleanup --json
Available steps:
rename-switch-suffix: Rename "Lights ... Switch" to "Lights ..."create-groups: Create/update switch groups for sync automationsprefix-lights-cove: Prefix Lights/Cove names with areaprefix-generic: Prefix entities matching --pattern with areaha_ops.js snapshot - Capture state for diffing# Full snapshot
node scripts/ha_ops.js snapshot
# Skip noisy sections
node scripts/ha_ops.js snapshot \
--no-lovelace --no-scenes
# Include runtime states (noisy for diffs)
node scripts/ha_ops.js snapshot --include-states
ha_ops.js rollback - Revert registry changes from a snapshot# Preview what would be rolled back
node scripts/ha_ops.js rollback \
snapshot_before.json --dry-run
# Apply rollback
node scripts/ha_ops.js rollback \
snapshot_before.json --yes
ha_ops.js find-references - Find entity_id usage# Search for entity references before renaming
node scripts/ha_ops.js find-references \
--needle "switch.bedroom_lights"
# Search from a rename mapping file
node scripts/ha_ops.js find-references \
--map-json rename_map.json --backup-root /path/to/backup
ha_ops.js update-groups - Update group memberships after renamesEntity ID renames (via the entity registry) do not propagate to config entry–based group helpers. This command rewrites group member lists using a rename map.
# Preview which groups would be updated
node scripts/ha_ops.js update-groups \
--map-json rename_map.json
# Apply changes
node scripts/ha_ops.js update-groups \
--map-json rename_map.json --apply
# Output plan as JSON
node scripts/ha_ops.js update-groups \
--map-json rename_map.json --json
ha_ops.js tail-events - Monitor events in real-time# Tail state changes
node scripts/ha_ops.js tail-events
# Filter to specific entities
node scripts/ha_ops.js tail-events \
--entity switch.bedroom_lights --entity switch.bedroom_lights_2
# Include ZHA events
node scripts/ha_ops.js tail-events \
--event-type state_changed --event-type zha_event
ha_ops.js name-review-from-backup - Offline naming analysis# Analyze backup for naming candidates
node scripts/ha_ops.js name-review-from-backup \
--backup-root /path/to/backup
If a script fails mid-way:
ha_ops.js rollback with your before-snapshot to revert registry changes.references/api.mdreferences/playbook.mdreferences/id_conventions.mdPrefer one markdown log per run (timestamped), listing every entity/automation changed and the before/after values.
tools
Interactive browser automation via Chrome DevTools Protocol. Use when you need to interact with web pages, test frontends, or when user interaction with a visible browser is required.
development
Design and implement distinctive, production-ready web interfaces with strong aesthetic direction. Use when asked to create or restyle web pages, components, or applications (HTML/CSS/JS, React, Vue, etc.).
documentation
Update CHANGELOG.md following Keep a Changelog (https://keepachangelog.com/en/1.1.0/)
development
Fetch and analyze Sentry issues, events, transactions, and logs. Helps agents debug errors, find root causes, and understand what happened at specific times.