Repository navigation
feat(ha): take Home Assistant's MQTT broker from the app - #2096
Merged
Merged
Conversation
The Home Assistant app now asks Supervisor for Home Assistant's broker (`services: mqtt:want`) and passes it in FTW_HA_MQTT_HOST, _PORT, _USERNAME and _PASSWORD. Core reads them only when FTW_BUNDLE is home_assistant_addon. - An enabled bridge with an empty saved broker connects to that broker with its login. A saved broker still wins. - A site that never set up the bridge starts it, in memory. The default is saved only when the owner saves settings, so Settings shows Enabled and the switch still turns it off. - The broker and its password never enter the saved settings or the API. Tests cover the variables, the fill and default rules, the owner, and a real broker that receives discovery with no settings at all. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg
added a commit
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
marked this pull request as ready for review
November 28, 2026 05:52
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Paired with srcfl/home-assistant-addons#56 (the app side; the stable app in #57 uses the same recipe). Neither PR needs the other to be safe: without this one the app's variables are ignored, and without the app PR Core sees no variables.
Problem
In the Home Assistant app, FTW's entities need four MQTT fields typed by hand: broker, port, user and password. Home Assistant already knows its broker. The onboarding review (row 8) counts this among the steps a new user should not have.
Change
services: mqtt:want) and passes it inFTW_HA_MQTT_HOST,_PORT,_USERNAME,_PASSWORD. Core reads them only whenFTW_BUNDLE=home_assistant_addon(go/cmd/ftw/ha_bundle_broker.go).docs/ha-integration.mdsays the app needs no broker typed.minor, since the HA app changes a default (the bridge now starts by itself there). Owner approval needed.Outside the Home Assistant app nothing changes. Files touched:
go/cmd/ftw/ha_bundle_broker.go(new),ha_bridge_owner.go(fills the broker inApply),main.go(8 lines where the owner is built), the test file, the doc and the changeset.Evidence
make verifypasses locally (vet, tests, build).go test -race -run 'TestHABundle|TestHABridgeOwner' ./cmd/ftw/passes. The new tests cover the variables, the fill and default rules, the owner, and a real (mochi) broker that requires a login and receiveshomeassistant/sensor/forty_two_watts/grid_power/configwith no bridge settings at all./services/mqtt, and Mosquitto 2.1.4 with a password. FTW announced 30 sensors,forty-two-watts/statusreadonline,/api/ha/statusthrough ingress saidconnectedtocore-mosquitto:1883,/api/configshowedenabled: true, broker: "", and the broker password was in neitherstate.dbnorconfig.yaml. amd64 ran under emulation.Not tested
/services/mqttanswer was a stub with the documented shape./api/ha/statusstill shows?for the broker in the short time before the first connect, because it reads the saved (empty) broker.Refs srcfl/home-assistant-addons#25
🤖 Generated with Claude Code