Skip to content

fix(wallbox): read the charger again after a silent start (1.1.1) - #323

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

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

Conversation

@frahlg

@frahlg frahlg commented Dec 5, 2026

Copy link
Copy Markdown
Member

Problem

wallbox 1.1.0 read every register through probe_read, which leaves a register alone until restart after three misses. A charger off or restarting when FTW started, or held by another Modbus client, used up every try on its power register (4) while answering nothing. The driver then sent nothing until FTW restarted it.

1.1.0 already left out session energy and maximum current when they did not answer, and sent no EV stream without power, 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 charger uses up no tries and is read again on the first poll it answers. A register that misses three times on a charger that does answer is asked again every five minutes instead of never.
  • probe_read checks every word it asked for (it already did, through regs[count]; it now uses the shared complete).
  • driver_poll is now poll_once plus the bookkeeping; its early return when power does not answer still reaches the count. driver_cleanup resets the counts.

Left as it was on purpose: the EV stream goes out only when 4 answered, 7 and 9 are read only after 4 answered, read_only = true and its stated reason, and the unverified register map.

Test evidence

  • test_wallbox_wakes.py, five tests; three fail on 1.1.0 and all pass on 1.1.1:
    • 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;
    • session energy refused on an answering charger is asked again and used once it answers.
      The two that pass on 1.1.0 check that the stream is left out without power and that fields that do not answer are left out, which 1.1.0 already did.
  • No earlier wallbox test existed.
  • make test-driver ID=wallbox: 45 passed, 14 skipped.
  • make absent-register-report ID=wallbox: 7 and 9 print SETTLED 1; 4 prints SETTLED 0, EMITTED 0. When 4 does not answer the driver reads nothing else in that poll, so nothing answered and the miss does not count: a charger that refuses 4 looks the same as one that is off. 1.1.0 stopped asking 4 after three polls and also sent nothing.
  • make invented-number-report ID=wallbox: none.
  • make check: 5579 passed, 927 skipped.

Not yet verified

  • No hardware run. The register map is unverified, as the driver says; the case needs a charger off or held by another client when FTW starts.
  • With the rule above, a charger whose firmware never answers 4 is asked for it on every poll. That costs one failed read per poll on a driver that reports nothing either way. Whether to read 7 or 9 first so such a charger is told apart is an owner's call; I left the read order alone.
  • 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 charger off or restarting when FTW started, or held
by another Modbus client, used up every try on its power register 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 charger uses up no tries and is read again on the first poll it
answers. A register that misses three times on a charger that does
answer is asked again every five minutes. The EV stream still goes out
only when power (4) answered; session energy (7) and maximum current (9)
are left out when they do not answer. The driver stays read-only.

test_wallbox_wakes.py fails on 1.1.0 (3 of 5 cases) and passes on 1.1.1.
The two that pass on 1.1.0 check fields left out, which 1.1.0 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:27:05.336235Z f86c5db 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