Loading...
Loading...
Operate a Home Assistant instance via the official REST/WebSocket APIs and backups, with safe plan/apply workflows for bulk, reviewable changes.
npx skill4agent add goncalossilva/.agents homeassistant-opsfetchWebSocketexport HA_URL="http://<home-assistant-host>:8123"
export HA_TOKEN="<long-lived-access-token>"nodenode scripts/ha_ops.js --help.mdHA_URLHA_TOKENha_ops.js# List commands
node scripts/ha_ops.js --help
# Command help
node scripts/ha_ops.js cleanup --helpha_ops.js cleanup# 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 --jsonrename-switch-suffixcreate-groupsprefix-lights-coveprefix-generic--patternha_ops.js snapshot# 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-statesha_ops.js rollback# 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 --yesha_ops.js find-references# 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/backupha_ops.js tail-events# 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_eventha_ops.js name-review-from-backup# Analyze backup for naming candidates
node scripts/ha_ops.js name-review-from-backup \
--backup-root /path/to/backupha_ops.js rollbackreferences/api.mdreferences/playbook.mdreferences/id_conventions.md