Repository navigation
fix(web): say when FTW reads a charger but cannot control it - #2059
Merged
Merged
Conversation
A new owner added a Zaptec Go through zaptec_cloud. The driver declares read_only = true, so FTW accepted the charger, never controlled it and never said why: Settings showed only a small "telemetry only" badge. Core states the fact and the web chooses the words, once, in web/driver-control.js: - Catalog entries carry read_only_reason: the driver's description, from the sentence that talks about reading or control, and nothing when it only names the product. - /api/loadpoints carries driver_read_only and driver_read_only_reason for each charger, from the catalog entry its driver runs. - The EV card, Settings → Devices (the device row and the cards for adding one), Settings → Chargers, the setup wizard and the advanced charger panel say "FTW reads this charger but cannot control it", with the driver's reason when it gives one. Batteries, cars and heat pumps get the same note in their words; meters and solar inverters get none. No setting changes. Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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. |
The EV card still offered Charge now and Pause charging for a read-only charger. They cannot work, and they are what makes an owner think FTW controls the charger. The card now leaves them out when the loadpoint says driver_read_only; the note at the top of the sheet says why. A hold set before still shows, so it can be returned to the plan. The change sits in buildEvControls' update, clear of the open PRs that edit buildManualChargeSection. Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sons
Review of this branch.
- Speed: /api/loadpoints scanned every driver folder on each call, about
34 ms on a status poll. It now stats the one file each configured driver
runs and parses it again only after the file changes: 0.3 to 0.5 ms on
the local rig.
- Source of truth: driver_read_only comes from the registry's loaded
driver (new Registry.DeclaresReadOnly, which also says whether one is
loaded), and from observe_only, which now reads the same with its own
reason. The catalog entry of the file that runs gives the reason, and
the fact while the driver is not loaded. A resolved absolute path and a
user-folder copy shadowing the release's copy both resolve to the file
that runs.
- Reason text: readOnlyReason drops a lead-in that repeats the note ("FTW
can read it but not control it:", "Read-only:"), starts with a capital,
and gives nothing when fewer than five words remain, as for sonnen's
"Read-only." and zap's "The driver never writes." The driver catalog
page in srcfl/device-drivers does the same; each points at the other.
The web joins note and reason with a space.
- Noise: the note shows for chargers, cars, heat pumps and drivers whose
main job is a battery. A gateway or hybrid inverter that also reads a
battery beside solar (Zap, SMA, Fronius) gets none.
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
On 21 November a new owner added a Zaptec Go through
zaptec_cloud, which then declaredread_only = true. FTW accepted the charger and never controlled it. The box said nothing about it beyond a small "telemetry only" badge deep in Settings → Devices, and the EV card still offered Charge now. In Fredrik's words: "people come to the project and think it should work; they cannot understand that we have not turned on a flag for control".What changes
Core states the fact; the web chooses the words, once, in
web/driver-control.js.API
/api/loadpointscarriesdriver_read_onlyanddriver_read_only_reasonper charger.Registry.DeclaresReadOnly, which also says whether a driver is loaded;CanControlis false for an unloaded one too) and the owner'sobserve_only, which reads the same with the reason "Observe only is on for this device in Settings → Devices."/api/loadpointsnow answers in 0.3–0.5 ms./api/drivers/catalogentries carryread_only_reason: the driver's description from the sentence that talks about reading or control, without a lead-in that repeats the note ("FTW can read it but not control it:", "Read-only:"), with a capital first letter, and nothing when fewer than five words remain (sonnen's "Read-only.", zap's "The driver never writes.").readOnlyReasonpoints at the driver catalog's Python version, and the other way round.Where the owner sees it
buildEvControls' update, not inbuildManualChargeSection, which open PRs edit.The note shows where an owner expects FTW to steer: chargers, cars, heat pumps, and drivers whose main job is a battery (a battery and no solar). Meters, solar inverters and gateways or hybrid inverters that also read a battery (Zap, SMA, Fronius) get none. No new setting, and no change to control or dispatch.
Pairs with
srcfl/device-drivers#245: the public driver catalog says the same thing for every driver, reads control the way the signed channel does, and makes four stub drivers declare
read_only. Neither PR depends on the other to merge. The reason tests here use the drivers' descriptions at device-drivers c4c39af, which #2060 bundles.Overlap with open PRs
Several open PRs touch
web/app.js,web/loadpoints.js,web/index.html,web/setup.js,go/internal/api/api_control_feedback.goandgo/internal/drivers/registry.go(#2050, #2017, #2016, #1865, #1862, #1792, #1789, #1051). I checked their hunks: this PR's changes sit apart from all of them (buildEvControls' update and the EV note inapp.js; the loadpoint view struct and loop inapi_control_feedback.go; the new accessor afterCanControlinregistry.go; script tags at the bottom of the HTML pages). They have right of way; a rebase should be clean.Tests
cd go && go test ./internal/drivers ./internal/api: pass. New tests cover the reason fortesla_wall_connector,tesla_cloud,sonnen,zapandhuaweiat c4c39af;DeclaresReadOnlyagainst loaded, observe-only and removed drivers;/api/loadpointswith relative paths, an absolute path, a user-folder copy shadowing the bundled one, the loaded driver winning over a file edited after it loaded, observe only, and one parse per file until it changes.node --test 'web/**/*.test.mjs': 956 passed.web/driver-control.test.mjscovers the words and the battery rule, Settings → Chargers rendering and escaping, the wiring in Devices, setup and the EV card, and runsbuildEvControlsto check that a read-only charger gets no Charge now or Pause unless a hold from before is active.make verify: vet, tests and build clean.Seen in a browser
Core built from this branch with
sim-ferroampand a local fake that serves a Tesla Wall Connector charging a car and a sonnenBatterie. Both drivers are the c4c39af copies, loaded from a user-drivers folder. A second Core servedmaster's web for the before view. Nothing contacted a real site.Not in this PR
/api/loadpointsthroughapi.req. To show the same fact they adddriver_read_onlyanddriver_read_only_reasonto their loadpoint readers (WireLoadpointin ftw-webappsrc/lib/format/ev.ts,FTWKit/Format/EV.swift,kit/format/EV.kt) and their simulated boxes, say the same sentence on the charger view, and leave out their own Charge now for such a charger. No registry name changes.🤖 Generated with Claude Code