Skip to content

fix(web): say when FTW reads a charger but cannot control it - #2059

Merged
frahlg merged 3 commits into
masterfrom
read-only-shown
Nov 21, 2026
Merged

frahlg merged 3 commits into
masterfrom
read-only-shown

Conversation

@frahlg

@frahlg frahlg commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Why

On 21 November a new owner added a Zaptec Go through zaptec_cloud, which then declared read_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/loadpoints carries driver_read_only and driver_read_only_reason per charger.
    • The fact comes from what runs: the registry's loaded driver (new Registry.DeclaresReadOnly, which also says whether a driver is loaded; CanControl is false for an unloaded one too) and the owner's observe_only, which reads the same with the reason "Observe only is on for this device in Settings → Devices."
    • The catalog entry of the file the driver runs gives the reason, and the fact while the driver is not loaded. A resolved absolute path and a user-folder copy that shadows the release's copy both resolve to the file that runs.
    • Each driver file is parsed once and again only after it changes (path, size, modification time). The first version scanned every driver folder on each call, about 34 ms per status poll; on the local rig /api/loadpoints now answers in 0.3–0.5 ms.
  • /api/drivers/catalog entries carry read_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."). readOnlyReason points at the driver catalog's Python version, and the other way round.

Where the owner sees it

  • EV card: "FTW reads this charger but cannot control it." with the driver's reason, at the top of the sheet. Charge now, Pause charging and the current slider are left out for such a charger: they cannot work, and they are what made people think FTW controls it. A hold set before still shows, so it can be returned to the plan. The change sits in buildEvControls' update, not in buildManualChargeSection, which open PRs edit.
  • Settings → Devices: the device row's badge says "reads only" instead of "telemetry only", with the sentence beneath. The cards for adding a device carry a "reads only, no control" tag.
  • Settings → Chargers: the charger card carries the sentence, and both charger lists mark the driver "(reads only)". The card has no control action to remove, only the charger's limits.
  • Setup wizard: the driver list marks it "— reads only", and the chosen driver's details open with the sentence.
  • Advanced → Chargers: the Driver row adds "reads only, FTW cannot control it".

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.go and go/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 in app.js; the loadpoint view struct and loop in api_control_feedback.go; the new accessor after CanControl in registry.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 for tesla_wall_connector, tesla_cloud, sonnen, zap and huawei at c4c39af; DeclaresReadOnly against loaded, observe-only and removed drivers; /api/loadpoints with 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.mjs covers the words and the battery rule, Settings → Chargers rendering and escaping, the wiring in Devices, setup and the EV card, and runs buildEvControls to 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-ferroamp and 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 served master's web for the before view. Nothing contacted a real site.

  • EV card, before: "Are we in control? Waiting for the plan", the charging state, the plan, then Charge now and Pause charging, and nothing about control.
  • EV card, after: "FTW reads this charger but cannot control it. Tesla offers no way for another system to set its current. Control goes through the car (tesla_vehicle) or a charger FTW can control, such as one on OCPP." No Charge now or Pause; the sheet goes from Car battery straight to Your goal. Also checked at 375 px.
  • Settings → Devices: the sonnen row reads "YOUR OWN FILE · READS ONLY" with "FTW reads this battery but cannot control it." beneath; the Wall Connector row carries its sentence and reason. In the cards for adding a device, Zap, SMA, Fronius and GoodWe carry no tag; the Wall Connector, the Tesla car drivers and sonnen carry "reads only, no control".
  • Settings → Chargers, setup and Advanced → Chargers as described above.

Not in this PR

  • "Are we in control?" still reads "Waiting for the plan" for a read-only charger. Control feedback is busy with open PRs, so the note sits beside it for now.
  • The goal (ready time, "Use 80 % by 07:00", solar only) stays on the sheet: it is stored state, and hiding it would leave a saved goal nobody can clear. The planner still plans for a read-only charger; keeping such chargers out of the plan is a Core change for later. Boost for 1 h stays, since it steers the house battery, not the charger.
  • Clients: the web client and the iOS and Android apps read /api/loadpoints through api.req. To show the same fact they add driver_read_only and driver_read_only_reason to their loadpoint readers (WireLoadpoint in ftw-webapp src/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

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>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 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-21T17:06:30.069207Z 7916bb2 PR opened
ℹ️ 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 and others added 2 commits November 21, 2026 18:13
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>
@frahlg
frahlg merged commit 5d1d93b into master Nov 21, 2026
21 checks passed
@frahlg
frahlg deleted the read-only-shown branch November 21, 2026 18:07
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