Skip to content

fix(victron): read the GX again after a silent start (2.2.3) - #320

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

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

Conversation

@frahlg

@frahlg frahlg commented Dec 5, 2026

Copy link
Copy Markdown
Member

Problem

victron 2.2.2 read every register through probe_read, which leaves a register alone until restart after three misses. A GX booting or restarting when FTW started, or held by another Modbus client, used up every try while answering nothing. The driver then sent nothing until FTW restarted it.

2.2.2 already left out fields and streams whose register did not answer, so it has no line in the invented-number baseline.

Change

  • A miss counts only in a poll where another read answered, so a silent GX uses up no tries and is read again on the first poll it answers. A register that misses three times on a GX that does answer is asked again every five minutes instead of never. A GX without DC-coupled MPPT or a battery service now costs one refused read in sixty polls.
  • probe_read checks every word it asked for, not just the first.
  • driver_poll is now poll_once plus the bookkeeping; driver_cleanup resets the counts.

Left as it was on purpose: PV is still the sum of the parts that answered (808 AC-coupled, 850 DC-coupled), the meter goes out only with 820, the battery only with 840, and the driver still reads no serial (the system service on unit 100 has none, see driver_init). It stays read-only.

Test evidence

  • test_victron_wakes.py, seven tests; four fail on 2.2.2 and all pass on 2.2.3:
    • test_wakes_after_silence.lua (shared with the other PRs in this series): silent from start-up, silent mid-session, each register refused six times;
    • ten silent polls send nothing, then every value on the first poll that answers;
    • the GX read again after going silent mid-session;
    • a PV part refused on an answering GX is asked again and counted once it answers.
      The three that pass on 2.2.2 check that PV, meter or battery is left out when its power does not answer, which 2.2.2 already did.
  • test_victron_battery.py and test_victron_meter_pv.py pass unchanged.
  • make test-driver ID=victron: 140 passed, 9 skipped (the -k victron filter also picks up victron_mqtt).
  • make absent-register-report ID=victron: all 4 addresses print SETTLED 1.
  • make invented-number-report ID=victron: none.
  • make check: 5581 passed, 927 skipped.

Not yet verified

  • No hardware run. The case needs a GX that is booting or held by another client when FTW starts.
  • PV as the sum of the parts that answered means a one-poll miss of 808 or 850 sends PV low for that poll. That was so before and is left for its own change.
  • CHANGELOG.md and the shared harness test_wakes_after_silence.lua are touched by the other driver PRs in this series; whichever merges later needs a rebase there.
  • After merge, FTW's pin in drivers/BUNDLED_SOURCE.json has to move.

🤖 Generated with Claude Code

Every read went through a guard that left a register alone until restart
after three misses. A GX booting or restarting when FTW started, or held
by another Modbus client, used up every try while answering nothing, and
the driver then sent nothing until FTW restarted it.

A miss now counts only in a poll where another read answered, so a
silent GX uses up no tries and is read again on the first poll it
answers. A register that misses three times on a GX that does answer is
asked again every five minutes. PV, meter and battery go out as before:
PV is the sum of the parts that answered, the meter only with 820, the
battery only with 840. The driver still reads no serial.

test_victron_wakes.py fails on 2.2.2 (4 of 7 cases) and passes on 2.2.3.
The three that pass on 2.2.2 check streams left out, which 2.2.2 already
did.

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 5, 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-05T05:02:24.809832Z 2a99fcd 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