feat(ha): first-party Home Assistant add-on (deploy/homeassistant)#620
feat(ha): first-party Home Assistant add-on (deploy/homeassistant)#620HuggeK wants to merge 3 commits into
Conversation
Rebased onto current master (v1.4.0 / srcfl/ftw structure). The community add-on (erikarenhill/ha-addon-forty-two-watts) pinned ghcr.io/frahlg/forty-two-watts:v1.3.0 and stopped tracking releases after the Sourceful restructure: - Canonical image is now ghcr.io/srcfl/ftw; the frahlg path survives only as a byte-identical mirror (same manifest digest). - Runtime binary is /app/ftw; transparent to the wrapper (CMD overrides flags only, inherits ENTRYPOINT; the -config/-web/-drivers/-user-drivers interface is unchanged). - The MPC optimizer runs as a separate ftw-optimizer sidecar container -- the one restructure a single-container add-on can't mirror. Adds deploy/homeassistant/ (repository.yaml + ftw/ add-on): a rebase wrapper targeting srcfl/ftw:v1.4.0 onto Supervisor's /data, restoring the -user-drivers overlay, host networking, no ingress, self-update off. Version 1.4.0 matches the release line (package.json / release / compose), so the earlier semver-inversion concern does not apply. docs/ha-addon.md carries the full findings, storage-growth guidance (Parquet cold history ~a few GB/year, included in HA backups), and the open-items checklist. README gains a Home Assistant add-on install section. Co-Authored-By: Hugo Karlsson <48095810+HuggeK@users.noreply.github.com> Co-Authored-By: Erik Arenhill <758402+erikarenhill@users.noreply.github.com> Claude-Session: https://claude.ai/code/session_01HBjLafzpEYX1dptEE7AGsx
e781846 to
e1681ce
Compare
HA add-ons are single-container, but FTW now runs as several (core, Python/CVXPY optimizer, updater, mosquitto). Bundle the two that matter — core + optimizer — into one image so the add-on ships the full CVXPY optimizer with no extra setup. Enabler: core <-> optimizer already talk over a Unix socket (FTW_OPTIMIZER_TRANSPORT=auto, optimizer runs network_mode:none), so in one container they just share /run/ftw-optimizer/optimizer.sock. - Dockerfile bases on the optimizer image (Debian python:3.12-slim + CVXPY venv) and COPY --from the fully static, CGO-free Go core; runs unchanged. - run.sh supervises both under tini (PID1): start optimizer, start core; if either exits, tear down and exit non-zero so Supervisor restarts the whole add-on. Health check hits core's /api/health. - build.yaml pins both images (they version independently: core v1.4.0, optimizer v1.3.1) and passes FTW_CORE_FROM. - Drop the updater (Supervisor owns updates) and mosquitto (HA add-on). - Trade-off documented: the CVXPY stack makes the image a few hundred MB; a slim optimizer-less variant is a trivial derivative. docs/ha-addon.md gains a "multiple containers -> one image" section, the optimizer open-item is resolved, and the smoke-test command is updated. Co-Authored-By: Hugo Karlsson <48095810+HuggeK@users.noreply.github.com> Co-Authored-By: Erik Arenhill <758402+erikarenhill@users.noreply.github.com> Claude-Session: https://claude.ai/code/session_01HBjLafzpEYX1dptEE7AGsx
08ea5f7 to
f706f5c
Compare
|
Vad tycks @erikarenhill ? @frahlg om nu ftw-web-sidan skriver om ett HA-addon, vad sägs då om att skapa ett srcfl/ftw-ha-addon eller något liknande namn? |
The previous run.sh had two defects flagged in review: 1. It always exited 0 (the final `wait ... || true` swallowed the code), so a crashed core never signalled failure and Supervisor had no reason to restart the add-on. 2. `wait -n` on both PIDs plus an unconditional teardown coupled the optimizer's liveness to core: a transient optimizer crash (e.g. CVXPY OOM on a small Pi) tore down a healthy core, turning graceful degradation into a whole-add-on crash loop. Rework the supervision model around core as the primary process: - Wait on CORE only and `exit` with its code, so success/failure propagates to Supervisor (non-zero -> restart, SIGTERM -> clean 0). - Supervise the optimizer in a background loop with capped exponential backoff and a healthy-run reset; after repeated failures it gives up and leaves core running on the in-Go DP planner (transport=auto) instead of restarting the whole container. Its death no longer touches core. Control flow verified with stubbed binaries: optimizer crash-loop leaves core running, core rc=7 propagates, SIGTERM exits 0. The socket path and optimizer entrypoint still need the live Supervisor smoke test. Co-Authored-By: Hugo Karlsson <48095810+HuggeK@users.noreply.github.com> Co-Authored-By: Erik Arenhill <758402+erikarenhill@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HBjLafzpEYX1dptEE7AGsx
cc75d1e to
54d0ef5
Compare
låter rimligt med en officiell addon, den jag satte upp var mest ett snabbhack 😊 |
Packaging decision — 2026-07-22Recommendation: do not merge this subtree into Home Assistant requires Proposed boundary:
Minimum new repo: The add-on should use its own version, pin a tested Core and Optimizer pair, publish a pre-built amd64/aarch64 image to GHCR, pass a live Home Assistant OS/Supervisor smoke test, publish beta first, and promote the tested artifact to stable. Keep #620 as a draft source until the new repo gets approval. Then move and adapt the package in a new-repo PR, make a small docs-only FTW PR with the install link, and close #620 as moved. Do not merge this PR as-is. Current checks pass, but most code checks skip these paths. The PR still lacks a live Supervisor build and boot test. References: Home Assistant repository rules and publishing guidance. |
|
bra idé! Jag sätter igång en tråd !
… On 21 Jul 2026, at 20:06, Erik A ***@***.***> wrote:
erikarenhill
left a comment
(srcfl/ftw#620)
<#620 (comment)>
Vad tycks @erikarenhill <https://github.com/erikarenhill> ?
@frahlg <https://github.com/frahlg> om nu ftw-web-sidan skriver om ett HA-addon, vad sägs då om att skapa ett srcfl/ftw-ha-addon eller något liknande namn?
låter rimligt med en officiell addon, den jag satte upp var mest ett snabbhack 😊
—
Reply to this email directly, view it on GitHub <#620?email_source=notifications&email_token=ABUQT7SXGXDBWP4WBWGJJI35F6WJFA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMBTG42DANJWGYZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5037405662>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABUQT7TNBJUTGQFSKCP6FMD5F6WJFAVCNFSNUABGKJSXA33TNF2G64TZHMYTEMBYGY3TGMRSHE5US43TOVSTWNBZGM4DIOBXG44DDILWAI>.
You are receiving this because you were mentioned.
|
|
Moved to the official Home Assistant repository: https://github.com/srcfl/home-assistant-addons The usable add-on work from this PR now lives in the new repository and was merged through srcfl/home-assistant-addons#1. The new repository also records the source work and attribution in https://github.com/srcfl/home-assistant-addons/blob/main/ATTRIBUTION.md. Home Assistant requires |
Rebased onto current master (v1.4.0 /
srcfl/ftwstructure). The communityadd-on (
erikarenhill/ha-addon-forty-two-watts) pinnedghcr.io/frahlg/forty-two-watts:v1.3.0and stopped tracking releases after theSourceful restructure:
ghcr.io/srcfl/ftw; thefrahlgpath survives only asa byte-identical mirror (same manifest digest).
/app/ftw; the-config/-web/-drivers/-user-driversinterface is unchanged, so the wrapper drives it exactly as before.
ftw-optimizersidecarcontainer, is bundled into the add-on image rather than dropped (see below) —
a single-container add-on can't run a sidecar, so it supervises both processes
instead.
Adds
deploy/homeassistant/(repository.yaml+ftw/add-on): an all-in-oneimage that bundles the
srcfl/ftw:v1.4.0core with theftw-optimizer:v1.3.1Python/CVXPY optimizer in one container.
run.shsupervises both — core is theprimary process (its exit code propagates to Supervisor for correct
restart-on-crash), and the optimizer is optional: if it dies, core degrades over
FTW_OPTIMIZER_TRANSPORT=auto(bundled Python worker → in-Go DP planner) insteadof crash-looping the add-on. State lives on Supervisor's
/data, the-user-driversoverlay and host networking are restored, ingress is off (the appisn't
X-Ingress-Pathaware), and self-update is off (no updater container).Version 1.4.0 matches the release line (
package.json/ release / compose), sothe earlier semver-inversion concern does not apply.
docs/ha-addon.mdcarries the full findings, storage-growth guidance (Parquetcold history ~a few GB/year, included in HA backups), and the open-items
checklist (live Supervisor smoke test + publishing the subtree to a root-level
add-on repo remain before release). README gains a Home Assistant add-on install
section.
Claude-Session: https://claude.ai/code/session_01HBjLafzpEYX1dptEE7AGsx