Skip to content

fix(meters): read the meter again after a silent start, send no zeros - #313

Open
frahlg wants to merge 1 commit into
mainfrom
fix/meter-wake
Open

frahlg wants to merge 1 commit into
mainfrom
fix/meter-wake

Conversation

@frahlg

@frahlg frahlg commented Dec 4, 2026

Copy link
Copy Markdown
Member

Problem

Nine meter drivers share one template: abb_meter, acrel, carlo_gavazzi, chint, circutor, janitza, schneider_meter, siemens_pac and socomec. Each read every register through probe_read, which leaves a register alone until restart after three misses. A meter that was off, restarting or held by another Modbus client when FTW started used up every try while answering nothing. The driver then sent nothing until FTW restarted it.

A register that did not answer went out as 0: a silent meter reported 0 W, 0 V and 0 Hz (13 fields each in the invented-number baseline). The float meters also sent NaN and infinity as 0, and chint sent L2 and L3 power as a fixed 0 it never read.

Change

  • A miss counts only in a poll where another read answered, so a silent meter uses up no tries and is read again on the first poll it answers. A register that misses three times on a meter that does answer is asked again every five minutes instead of never.
  • A field whose register did not answer, or that holds NaN, is left out. The meter goes out only when its total power answered.
  • complete() checks every word of a reply, not just the first.
  • chint drops its fixed L2/L3 power of 0.
  • All nine leave invented-number-baseline.json.

Versions: abb_meter 1.0.7, acrel 1.0.5, carlo_gavazzi 1.0.6, chint 1.0.6, circutor 1.0.6, janitza 1.0.6, schneider_meter 1.0.6, siemens_pac 1.0.6, socomec 1.0.5.

Test evidence

  • test_meter_wakes.py, 42 cases over the nine drivers; all 42 fail on origin/main and pass here:
  • make test-driver ID=<id>: 47 or 48 passed, 11 skipped for each of the nine.
  • make absent-register-report ID=<id>: every address settles for each of the nine.
  • make invented-number-report ID=<id>: none for each of the nine.
  • make check: 5616 passed, 927 skipped.

Not yet verified

  • No hardware run. The case needs one of these meters to be off or held by another client when FTW starts.
  • chint still sends its total power as L1_W. That is right for the single-phase DDSU666 and wrong for the three-phase DTSU666; the driver cannot tell them apart. Not changed here.
  • acrel still sends L1-L3 power as voltage times current, which has no sign and is apparent power. Not changed here.
  • CHANGELOG.md and invented-number-baseline.json are touched by the other driver PRs in this series; whichever merges later needs a rebase there. The harness file has the same bytes in every PR.
  • After merge, FTW's pin in drivers/BUNDLED_SOURCE.json has to move.

🤖 Generated with Claude Code

abb_meter 1.0.7, acrel 1.0.5, carlo_gavazzi 1.0.6, chint 1.0.6,
circutor 1.0.6, janitza 1.0.6, schneider_meter 1.0.6, siemens_pac 1.0.6
and socomec 1.0.5 share one template. Every read went through a guard
that left a register alone until restart after three misses. A meter
that was off, restarting or held by another Modbus client at start-up
used up every try while answering nothing, and the driver then sent
nothing until FTW restarted it. A register that did not answer went out
as 0, and the float meters sent NaN as 0 too.

A miss now counts only in a poll where another read answered, so a
silent meter uses up no tries and is read again on the first poll it
answers. A register that misses three times on a meter that does answer
is asked again every five minutes. A field whose register did not
answer, or that holds NaN, is left out, and the meter goes out only when
its total power answered. chint no longer sends L2 and L3 power as 0,
since it never reads them. All nine leave the invented-number baseline.

test_meter_wakes.py fails on the old drivers (42 of 42 cases) and passes
on the new ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 4, 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-12-04T20:17:22.774690Z 7e9195b 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.

This branch has not been deployed

No deployments
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