Export the live Home Assistant (and Node-RED) config into this repo, scrub secrets, update docs and commit. Use after ANY change to Home Assistant or Node-RED, before a risky change (snapshot), or when asked to sync, back up, export or "update GitHub".
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Ha Sync?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/deanlongstaff-ha-sync)
---
name: ha-sync
description: Export the live Home Assistant (and Node-RED) config into this repo, scrub secrets, update docs and commit. Use after ANY change to Home Assistant or Node-RED, before a risky change (snapshot), or when asked to sync, back up, export or "update GitHub".
---
# HA sync
The repo mirrors the live system. Run this loop at the end of every change, and once
before a change so the diff shows only your work. Read `docs/home.md` first for the
local URL and install type.
## 1. Collect
Pick the first that works:
Commands say `python3`; on Windows use `py`.
**A. Browser tab (no token needed)** — when you have a browser tool (Claude desktop app,
Claude in Chrome, or similar).
1. Open the **local** HA URL from `docs/home.md` in your browser tool. If it shows a login
page, ask the owner to log in — never type credentials.
2. Run the contents of `tools/collect.js` as JavaScript in that tab, prefixed with
`await`. It returns `B64START…B64END<n>`. Browser tools usually save big results to a
file — use that file path in step 2; don't read the payload into context.
**B. Terminal** — every other agent (Codex, Gemini CLI, Claude Code in a plain terminal).
Needs Node 22+ and `HA_URL`/`HA_TOKEN` in `.env`; the owner sets that up with
`python3 tools/connect.py` (never read or print `.env` yourself).
```bash
node tools/collect-cli.mjs # writes .export/bundle.txt
```
**C. Neither works?** Tell the owner what you changed and that the repo needs a sync,
and how to run it (A or B). Don't fake the export by hand-writing files.
Config files (`configuration.yaml`, ESPHome) are only collected when the Studio Code
Server add-on is already running. That's optional: say "config files skipped" in one
line and carry on. Don't start the add-on unless the change touched those files.
## 2. Sync and check
```bash
python3 tools/sync.py <saved result file or .export/bundle.txt>
git status --short && git diff --stat
python3 tools/check_secrets.py && python3 tools/validate.py
```
- `sync.py` needs PyYAML; if it says it's missing, run `python3 tools/setup.py` (it installs it
privately in `.venv`, which the tools then use automatically).
- "Payload truncated" → collect again; save the result to a file rather than copying it.
- **Unexpected diffs** (things you didn't change) are the owner's manual changes or
another session's. Commit them separately first as `chore(sync): …` — never revert them.
- **Something was updated** — the diff touches `export-info.yaml`, `inventory/versions.yaml`,
`addons.yaml`, `node-red/palette.yaml` or `dashboards/resources.yaml`. Name the updates
in one line, read their notes for breaking changes, check the fallout, and adapt the
docs/tools (AGENTS.md §7a). Commit version bumps as `chore(sync): updates — <names>`.
Don't commit around a structural change (renamed domains, moved paths).
- **A secret-scan hit** means redaction missed something. Extend `tools/redact.py` (and
a rule in `check_secrets.py` if needed) and re-sync. For values that don't look secret
(a surname, an alarm code), ask the owner to add them to `.secrets-denylist`. Never
commit around it, never `--no-verify`.
- **Automation lint fails** (`automation_lint.py`) on an automation or script you just
wrote → fix it (docs/automations.md#house-rules). A device-only trigger with no
entity: `python3 tools/automation_lint.py --allow <id> "<why>"`. On many pre-existing
ones → the first-sync `--baseline` was never run: run it once and commit it.
- **"N automation(s) have no id"** → old YAML automations the API can't read. They're
listed in `docs/reference/automations.md`; mention it once, don't try to fix it unasked.
- **Node-RED function lint fails** on a function you just wrote → make it smaller or
native (docs/node-red.md); on one that existed before the kit → `--baseline` was
never run: run `python3 tools/function_lint.py --baseline` once and commit it.
## 3. Document
- Behaviour, convention or structure changed → update the matching file in `docs/`.
- A choice someone might question later → a dated entry in `docs/decisions.md`.
- Always add a dated line to `CHANGELOG.md` (newest first).
- `docs/reference/` is generated by sync — never edit it.
## 4. Commit (and push)
```bash
git add -A
git commit -m "feat(ha): hallway motion lights dim to 20% after 11pm"
git push # only if a remote exists
```
Prefixes: `feat`, `fix`, `refactor`, `docs`, `chore(sync)`. Scopes: `ha`, `dashboard`,
`node-red`, `esphome`, `repo`. Report the commit to the owner in one line, plus any
sync warnings.