Skip to content

feat(ftw-0x-beta): open FTW inside Home Assistant, find its MQTT broker, name it FTW (beta) - #56

Merged
frahlg merged 8 commits into
mainfrom
ha-simple
Nov 28, 2026
Merged

frahlg merged 8 commits into
mainfrom
ha-simple

Conversation

@frahlg

@frahlg frahlg commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Finishes #25 on current main, adds Home Assistant's MQTT broker and renames the app. Rebased onto main after #55 (v0.169.1-beta.1); the pins equal main's. Paired with srcfl/ftw#2096 (Core reads the broker). The stable app (slug ftw-0x) and the rule that the beta app also takes a stable that outranks its beta are in #57, stacked on this one.

This branch is new: it carries #25's commits af0b502, ff21dc2 and d8d32d9 (cherry-picked, conflicts with #26 and the newer pins resolved), then three commits of mine. It leaves out 7873560, the app revision format, because the owner chose to ship ingress with the next beta (onboarding review, decision 2).

Problem

The onboarding review (row 8): the app opens Core on port 8080 in a new tab through a launcher page, not inside Home Assistant and not through Nabu Casa. Entities need four MQTT fields typed by hand. The name is "FTW (0.x beta)". Core has supported ingress (FTW_HA_INGRESS, srcfl/ftw#1786) in every beta since 21 October.

Change

  1. Ingress and Home Assistant's login (feat: use HA ingress and the HA login for FTW #25). Core listens only on 18099 for Supervisor's ingress proxy, with the HA admin login; no FTW password. The sidebar panel (feat(ftw-0x-beta): let people pin FTW to Home Assistant's sidebar #26's title and icon) now opens FTW itself, so feat(ftw-0x-beta): let people pin FTW to Home Assistant's sidebar #26's launcher page, its busybox httpd and the empty port translations go. Port 8080 is closed: no other client needs it on the home network. The iPhone app pairs with the link or QR and then talks through FTW Cloud. Only the short pairing code needs FTW's own web port, so it cannot work here (see open points).
  2. MQTT without typing. services: - mqtt:want. run.sh sources mqtt-service.sh, which asks http://supervisor/services/mqtt with SUPERVISOR_TOKEN and passes the broker to Core in FTW_HA_MQTT_*. No broker, a refusal, TLS only or a bad answer leaves them unset, logs one line, and Core starts anyway. Only Supervisor's answer can set them. The image gains jq.
  3. Name "FTW (beta)", slug unchanged, so installs keep their data. I added neither boot: nor watchdog:. The pinned linter (frenck/[email protected], now v2.21.3) refuses both as errors: boot: auto repeats Supervisor's default, and watchdog: "is obsolete. Use the native Docker HEALTHCHECK directive instead". A lint failure would also block every automatic pin. Start on boot is on by default already. Supervisor's Watchdog acts on the Docker HEALTHCHECK, which already asks Core's /api/health, but the person still has to turn the Watchdog switch on; no manifest key does that.
  4. The README and install steps get the My Home Assistant "add repository" button.
  5. homeassistant: "2026.10.2" from feat: use HA ingress and the HA login for FTW #25 is gone. Nothing needs it: ingress and the X-Remote-User-Id header Core relies on come from Supervisor, which has sent it since 2023 and updates itself. The floor would only turn away beta users on an older Home Assistant.
  6. No version bump. Notes go under ## Unreleased in CHANGELOG.md; native_pin.py bump now turns that heading into the next pin's version, so these changes reach users with the next beta.

What a new user sees

  1. Click Add repository (or paste the URL), open FTW (beta), Install. Start on boot is already on; turn on Watchdog, Start.
  2. Open Web UI opens FTW inside Home Assistant, signed in. Show in sidebar on the Info tab adds an FTW entry.
  3. The setup wizard runs inside Home Assistant.
  4. With the Mosquitto broker app and the MQTT integration, FTW's entities appear in Home Assistant with nothing typed (once Core has feat(ha): take Home Assistant's MQTT broker from the app ftw#2096). Without the broker the log says to add it.
  5. Settings → FTW app: pair the iPhone with the link or QR.

Existing beta installs get all of this with the next beta pin. A bookmark to :8080 stops working; FTW opens from Home Assistant instead.

Evidence

  • python scripts/validate.py passes; python -m unittest discover -s tests -p 'test_*.py': 192 tests OK (Python 3.12), including the pin rehearsal.
  • Linter v2.21.3 run locally on ftw-0x-beta: exit 0. The same config with boot: auto and watchdog: added: exit 1 with the two errors quoted above.
  • ShellCheck 0.11.0 on every script Check lists: clean.
  • New tests/test_mqtt_service.py runs mqtt-service.sh with a stub curl and real jq: passes Mosquitto's answer through (a password with quotes and $ intact, never logged), stays empty for a refusal, no broker, non-JSON, TLS or a bad port, and drops inherited FTW_HA_MQTT_*.
  • smoke_native.sh now reads the log, the redirect headers and the setup page into a variable before grep -q. Under pipefail, cmd | grep -q failed at random: grep stops at its first match and the writer dies of SIGPIPE. That failed the aarch64 smoke in run 46113515200. After the fix, the smoke passed 3 times on aarch64 and once on amd64 in a row.
  • Docker on this Mac (OrbStack): built the app for aarch64 and amd64 (amd64 under emulation) from the pinned package and ran scripts/smoke_native.sh on both: PASS with v0.169.0-beta.1, and again after rebasing onto the v0.169.1-beta.1 pin (chore: pin ftw-0x-beta to FTW v0.169.1-beta.1 #55). The smoke now gives Core a Supervisor that offers no broker and checks that Core starts without one.
  • With feat(ha): take Home Assistant's MQTT broker from the app ftw#2096's Core overlaid on that image, a stub Supervisor answering /services/mqtt and Mosquitto 2.1.4 with a password, on both arches: 30 sensors announced, forty-two-watts/status = online, /api/ha/status through ingress connected to core-mosquitto:1883, and the password in neither state.db nor config.yaml.

Not tested

  • No real Home Assistant OS or Supervisor. Ingress, the sidebar entry and the login rest on feat: use HA ingress and the HA login for FTW #25's own test on an aarch64 HA OS VM in October and on the stub-Supervisor smoke. /services/mqtt was a stub with the documented shape. No energy equipment.
  • That a host-network app resolves core-mosquitto. Supervisor's code gives every app its DNS server, host network included, but I did not see it on a device.

Open points for the owner

  • The pairing page in Core shows a short code with "Box address: <Home Assistant's address>" inside ingress. That path cannot work here. Another branch is reworking web/settings/tabs/app.js; it should hide the short code when window.FTWHomeAssistant is set.
  • The retired 3.x app was also called "FTW (beta)". Someone who still has it installed sees two entries with that name. The docs now add "version 0.x" or "3.x".
  • Entities appear only if FTW starts after the broker. On a reboot Supervisor starts Mosquitto first; right after installing Mosquitto, FTW needs one restart.

Refs #25, Refs srcfl/ftw#2096

🤖 Generated with Claude Code

frahlg and others added 7 commits November 28, 2026 06:44
(cherry picked from commit af0b502)
Signed-off-by: Fredrik Ahlgren <[email protected]>
(cherry picked from commit ff21dc2)
Signed-off-by: Fredrik Ahlgren <[email protected]>
(cherry picked from commit d8d32d9)
Signed-off-by: Fredrik Ahlgren <[email protected]>
Builds on #25's ingress commits (cherry-picked above) and on #26,
which main merged since.

- Drop #26's launcher page and its busybox httpd. Core now answers
  ingress itself on 18099, so the sidebar panel opens FTW directly.
- Drop the `.ha.N` app revision from #25. Fredrik chose to ship
  ingress with the next beta, so the app keeps the Core version.
  Notes under "## Unreleased" in CHANGELOG.md now ship with the
  next pin instead of sitting below it.
- Drop the empty translations; the app has no ports or options.
- Tell people to pair the FTW app with the link or QR: the short
  code needs FTW's own web port, which the app closes.

Refs #25

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
The app now declares `services: - mqtt:want`. At start, run.sh asks
Supervisor for the broker (GET http://supervisor/services/mqtt) and
passes host, port, user and password to Core in FTW_HA_MQTT_*. Core
uses them while its own broker setting is empty (paired Core PR), so
FTW's entities appear in Home Assistant without typing anything.

No broker, a refusal, TLS only or a bad answer leaves the variables
unset and logs one line; Core always starts. Only Supervisor's answer
may set them: run.sh unsets any inherited values first.

The image gains jq to read the answer. The smoke test now runs Core
with a Supervisor that offers no broker and checks that Core starts
without one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
Rename the store entry from "FTW (0.x beta)" to "FTW (beta)". The slug
stays ftw-0x-beta, so installs keep their data. The docs now say
"version 0.x" or "3.x" where the retired 3.x app, once also called
FTW (beta), could be confused with this one.

Start on boot is already Supervisor's default (`boot: auto`), and the
app linter refuses a key that repeats a default. It also refuses the
old `watchdog:` key as obsolete: Supervisor's Watchdog acts on the
Docker HEALTHCHECK, which already asks Core's /api/health. So the
manifest gains neither key; the docs drop the Start on boot step and
keep the one Watchdog switch Supervisor leaves off by default.

The README and the install steps get the My Home Assistant button that
opens the add-repository dialog with this repository filled in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit to srcfl/ftw that referenced this pull request Nov 28, 2026
A newcomer met version history first and had to copy a tag from Releases
into a twelve-line block. With #2095 the installer picks the
release itself, so every install page now gives one line:

    curl -fsSL https://ftw.energy/install.sh | bash -s -- --fresh-host

README opens with five lines: Home Assistant, a Linux computer, what FTW
runs on, what a home needs, and the iPhone app. docs/before.md holds the
2.x/3.x, old Docker, second-card and old Home Assistant app material; each
first-install page links to it in one line.

The Home Assistant pages describe the app after
srcfl/home-assistant-addons#56 and #2096: FTW (beta) opens inside
Home Assistant behind its login, port 8080 is closed, entities need no
broker typed, and a stable app named FTW follows the first stable.

The Pi guides in five languages run the line in step 11, show the printed
address and list what the setup page asks. native-beta.md and update-sv.md
change only their install section, the hardware line and the app rows.

scripts/test_install_docs.py now requires the one line, exactly once, on
each page that installs, and no other --fresh-host block in README or
docs/. CI runs it when those pages change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit to srcfl/ftw-web that referenced this pull request Nov 28, 2026
srcfl/home-assistant-addons#56 renames the app "FTW (beta)" and opens it
inside Home Assistant through ingress. The home page and both support
pages now use that name, and say FTW opens from Open Web UI or the
sidebar. The pairing step on the support pages says the same. A test
keeps "0.x beta" off these pages.

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- smoke_native.sh captured nothing before `grep -q`. Under pipefail,
  grep stops reading at its first match, the writer can die of
  SIGPIPE, and the line fails at random. That failed the aarch64 smoke
  in run 46113515200 ("MQTT broker lookup did not report"). The log,
  the redirect headers and the setup page are now read into a variable
  first.
- Drop `homeassistant: "2026.10.2"` from #25. Nothing here needs it:
  ingress and the X-Remote-User-Id header the app relies on come from
  Supervisor (since 2023), which updates itself, and the floor would
  only turn away beta users on an older Home Assistant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
@frahlg
frahlg marked this pull request as ready for review November 28, 2026 06:08
@frahlg
frahlg merged commit 40ed932 into main Nov 28, 2026
7 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T06:09:59.351411Z bf2967b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

frahlg added a commit to srcfl/ftw that referenced this pull request Nov 28, 2026
…wn page (#2002)

* docs: a short first-install path, with Home Assistant first

A newcomer met the architecture first, then a warning about 2.x and 3.x,
and reached the install command on line 170 of a 541-line guide.

README now opens with what FTW does, a dashboard screenshot and Get
started: Home Assistant, then Raspberry Pi or Linux. docs/install.md is
the first-install page, with a Swedish copy. The switch guide keeps the
old-version material and is not changed here.

The Home Assistant guide describes the app as shipped: Open web UI goes
to port 8080. Core has an ingress mode, but the app does not turn it on
yet. Both guides gain the one-click "add repository" button.

The paragraphs about the bundled driver pin move from README to
docs/device-repository.md. The install-docs test now checks that the new
pages carry the same native block as docs/native-beta.md.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

* docs: one install line, and old versions on their own page

A newcomer met version history first and had to copy a tag from Releases
into a twelve-line block. With #2095 the installer picks the
release itself, so every install page now gives one line:

    curl -fsSL https://ftw.energy/install.sh | bash -s -- --fresh-host

README opens with five lines: Home Assistant, a Linux computer, what FTW
runs on, what a home needs, and the iPhone app. docs/before.md holds the
2.x/3.x, old Docker, second-card and old Home Assistant app material; each
first-install page links to it in one line.

The Home Assistant pages describe the app after
srcfl/home-assistant-addons#56 and #2096: FTW (beta) opens inside
Home Assistant behind its login, port 8080 is closed, entities need no
broker typed, and a stable app named FTW follows the first stable.

The Pi guides in five languages run the line in step 11, show the printed
address and list what the setup page asks. native-beta.md and update-sv.md
change only their install section, the hardware line and the app rows.

scripts/test_install_docs.py now requires the one line, exactly once, on
each page that installs, and no other --fresh-host block in README or
docs/. CI runs it when those pages change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

---------

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-authored-by: Claude Fable 5.2 <[email protected]>
frahlg added a commit to srcfl/ftw-web that referenced this pull request Nov 28, 2026
* Get FTW: two paths first, one install line and /install.sh

Section 05 now opens with the two ways to run FTW: the Home Assistant
button that adds srcfl/home-assistant-addons, and one line for a Linux
computer. It says what FTW runs on and what a home needs, links the
device catalog, and says the iPhone app needs FTW at home and Android
is coming. The box waitlist is one row after the paths.

_redirects sends /install.sh to scripts/install.sh on FTW's master with
a 302. Pages applies it because _routes.json keeps the path away from
_worker.js; a new test checks the rule, the routes and the page's line.

The English support page sent bug reports to the Swedish Discord
invite; it now uses the English one. The beta lines say "app beta" so
they still fit when FTW gets a stable channel. Both support pages point
to the two paths.

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Link docs/install.md and ask for a country on the waitlist row

The Linux path's "Step by step" now opens docs/install.md, the short
first-install page from srcfl/ftw#2002. The waitlist row asks for a
country again, optional, between the email and the button; at phone
width it stacks under the email. Tests check the link and that the
choices match the countries the worker accepts.

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Name the Home Assistant app FTW (beta), opened inside Home Assistant

srcfl/home-assistant-addons#56 renames the app "FTW (beta)" and opens it
inside Home Assistant through ingress. The home page and both support
pages now use that name, and say FTW opens from Open Web UI or the
sidebar. The pairing step on the support pages says the same. A test
keeps "0.x beta" off these pages.

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant