Skip to content

fix(keba): read the charger again after a silent start (1.1.2) - #306

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

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

Conversation

@frahlg

@frahlg frahlg commented Dec 4, 2026

Copy link
Copy Markdown
Member

Problem

keba 1.1.1 read each register on its own through probe_read, which leaves a register alone until restart after three misses; only the three phase currents were tried again, once a minute. A KeContact that was off when FTW started, or held by another Modbus client, used up every try while answering nothing. The driver then found nothing to read and sent nothing. Its comment counted on Core reloading it, but Core does that only if an earlier read had succeeded, so it stayed silent until FTW restarted it.

Change

  • A miss counts only in a poll where another read answered. A poll in which nothing answered says nothing about any one register, 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. The phase currents keep their one-minute retry.
  • Reads a command makes between polls no longer count towards giving a register up.
  • The product code and serial are read only once the state or cable register has answered in that poll, still before the meter registers it gates.
  • Registers, decoding, the failsafe refresh and the control path are unchanged.

Test evidence

  • test_wakes_after_silence.lua (shared with fix(saj): read the serial and battery again after the inverter wakes (1.3.1) #301), run by test_keba_wakes.py: silent from start-up, silent mid-session, each register refused six times. 1.1.1 fails: asleep at start-up: no ev emitted after the device answered.
  • make test-driver ID=keba: 42 passed, 14 skipped (the control tests included).
  • make absent-register-report ID=keba: every address settles.
  • make invented-number-report ID=keba: none.
  • make check: 5575 passed, 927 skipped.

Not yet verified

  • No hardware run. The case needs a P30 that is off or held by another client when FTW starts.
  • After merge, FTW's pin in drivers/BUNDLED_SOURCE.json has to move.

🤖 Generated with Claude Code

Every register went through a guard that left it alone until restart
after three misses; only the phase currents were tried again, once a
minute. A charger that was off at start-up, or held by another Modbus
client, used up every try while answering nothing. Core reloads a driver
with nothing left to read only if an earlier read had succeeded, so 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 phase currents keep their
one-minute retry. Reads a command makes between polls no longer count.
The product code and serial are read only once the state or cable
register has answered in that poll.

test_wakes_after_silence.lua fails on 1.1.1 ("asleep at start-up: no ev
emitted after the device answered") and passes on 1.1.2.

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-04T18:35:47.799448Z abd2f11 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