Skip to content

feat(stats): count drivers by version from one, and every sharing box reports - #1989

Merged
frahlg merged 6 commits into
masterfrom
feat/driver-usage-counts
Nov 8, 2026
Merged

frahlg merged 6 commits into
masterfrom
feat/driver-usage-counts

Conversation

@frahlg

@frahlg frahlg commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Problem

FTW's driver lists show a hand-kept label: "untested", "in testing" or "verified on hardware". Nobody keeps it up. sma_pv is verified on four inverters and reads "untested", because its file says "tested", a value Core does not know. A driver running on many sites reads the same as one nobody has tried. Asked what it takes to get a driver "tested", the owner decided on 8 November 2026 to drop the idea:

en driver är en driver, och sen kan vi helt enkelt visa hur många det är som använder exakt den versionen

Change

  • The report. Each driver that delivered a reading in the last day, with its version: pixii@2.1.9. A configured driver that never answers does not count. A household's own file still reports as other, with no version. fleetwire accepts the new label, and also hyphens, which catalogue ids contain.
  • The lists. Setup, Settings, the catalogue and the version picker say "14 homes run this version", from zero up, with the most used first. The three labels are gone.
  • The counts. GET /api/drivers/catalog carries run_by, read from the fleet's public counts for the last closed day. The box asks only when someone opens a list, keeps an answer for 6 hours and waits 10 minutes after a failure. No answer leaves the number off. A box whose owner declined statistics never asks; the request carries only what any HTTP request does. Until boxes report versions, no number shows, so the lists do not say nobody runs anything.

verification_status stays in the driver files, unread by these screens.

Two more changes to the daily report, on the owner's word of 8 November 2026:

  • The battery is the nearest kWh (12), not a range. fleetwire accepts both.
  • Every box that shares reports. A box sharing by default, with no active yes, waited for a relay that does not exist, so only boxes with FTW Cloud reported. This reverses the owner's rule of 24 October. The report now goes straight to FTW Cloud, which sees the address while it answers and keeps neither the report nor the address. A box whose owner said no sends nothing.

Changeset: minor, on the owner's word.

Rollout

FTW Cloud must accept the new label before a Core release sends it: this PR's go/protocol, then the paired ftw-cloud PR pinned to it and deployed, then a Core beta.

Evidence

  • make verify passes; npm test 915 passed.
  • New tests: only a driver that delivered counts, with its version; an unknown file stays other; the wire accepts and refuses the right labels; counts read from the newest day and kept; no answer shows nothing; a feed without versions shows nothing; the catalogue carries the count.
  • In a browser against the home box's real catalogue of 44 drivers, read-only, with counts injected: "14 homes run this version", "1 home runs this version" and "0 homes run this version", most used first, none of the old labels, no console errors.

Review

An independent review (Sonnet) found the wire and UI sound. Fixed from it: the read ran under a lock, so one slow answer held up every list; a box that declined statistics still asked; right after a restart a report would have carried no drivers at all. Accepted: a household that edits a catalogue-named file can report its own number as a version, digits only; a count of 1 on a small day says one home runs that version, which is the point.

🤖 Generated with Claude Code

frahlg and others added 3 commits November 8, 2026 15:40
A driver is a driver. The hand-kept labels (untested, in testing, verified
on hardware) said little and went stale: one driver verified on four
inverters read as untested. A box now reports each driver that delivered
readings, with its version, and the driver lists say how many homes ran
exactly that version the last closed day, from one and up.

Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 8, 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-08T14:47:05.147400Z 93adce0 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93adce04a9

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +65 to +66
if name := driverFileType(d.Lua); name != "" {
out[name] = version(d.Lua)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve every running version of the same driver type

When two configured devices use different versions of the same driver filename (for example, bundled pixii.lua and a separately retained pixii.lua), this assignment overwrites the first version with the last one in configuration order. Both devices can have delivered readings within the reporting window, but driverTypes receives only one version, so the household is omitted from the other version's usage count. Collect and deduplicate driver/version pairs instead of storing a single version per driver type.

Useful? React with 👍 / 👎.

frahlg and others added 3 commits November 8, 2026 15:47
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st kWh

A box that shared by default waited for a relay that does not exist, so
only boxes with FTW Cloud reported. Every box that shares now reports
(Fredrik, 8 November 2026). FTW Cloud keeps no report and no address.

Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@frahlg frahlg changed the title feat(drivers): show how many homes run each driver version feat(stats): count drivers by version from one, and every sharing box reports Nov 8, 2026
@frahlg
frahlg merged commit 95f1c85 into master Nov 8, 2026
23 checks passed
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