homelab-codex-ws/services/home-assistant/README.md
oskar ee48319a86 feat(ha): skeleton for Home Assistant configs-as-code subproject
Structure only, no deploy path: DESIGN.md decision registry (phasing,
per-instance adapter, bidirectional sync with drift-abort on deploy,
reload-vs-restart gating, token handling), instances.yaml (ken/piha via
docker-exec, chelsty-ha via api), config/storage-export/fixtures dirs,
and a read-only scripts/ha/import.sh (docker-exec adapter only) with a
canonical YAML normalize+split library and an offline determinism test.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-21 15:29:39 +02:00

46 lines
1.6 KiB
Markdown

# home-assistant (configs-as-code)
**Status: skeleton.** Structure and read-only import tooling only — no
deploy path exists yet. See `DESIGN.md` for the full phasing, adapter, sync,
and validation model, and for the open questions still blocking phase 2/3.
## Layout
```
services/home-assistant/
├── DESIGN.md # decision registry — read this first
├── instances.yaml # per-instance adapter/host/token config
├── .gitignore # excludes secrets/db/log/token paths from every import
├── config/<instance>/ # canonical, normalized /config mirror per instance
├── storage-export/<instance>/ # curated .storage/* export (registries, dashboards)
└── fixtures/ # dated /api/states snapshots
```
Instances: `ken` (PIHA, container `homeassistant5`, docker-exec adapter),
`chelsty-ha` (Tailscale, api adapter — see `instances.yaml`).
## Import
```bash
scripts/ha/import.sh ken
```
Read-only: pulls `/config` from the instance, filters it through
`.gitignore`, normalizes and splits it into `config/ken/`, exports curated
`.storage/*` into `storage-export/ken/`, and (if a deploy token exists at
`~/.config/ha-deploy/ken.token`) writes a dated `/api/states` fixture.
Idempotent — re-running against an unchanged instance produces no diff.
Only the `docker-exec` adapter is implemented; running `import.sh
chelsty-ha` today exits with a clear "not implemented" error (its `api`
adapter is out of scope for this skeleton).
## Tests
```bash
scripts/ha/tests/test_split_normalize.sh
```
Offline determinism check for the split+normalize pipeline — no network,
no HA instance required.