Skip to content

fix(kstar): read the inverter again after a silent start (1.3.1) - #325

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

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

Conversation

@frahlg

@frahlg frahlg commented Dec 5, 2026

Copy link
Copy Markdown
Member

Problem

kstar 1.3.0 read every register through probe_read, which leaves a register alone until restart after three misses. An inverter asleep 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.

The model code at input 3045 says how many meter phases to read. detect_phases() reads it through the same guard, so after a silent start it was given up too: the phase count stayed unknown and the grid meter (3097) was never read for the session.

Change

  • A miss counts only in a poll where another read answered, so a silent inverter uses up no tries and is read again on the first poll it answers. A register that misses three times on an inverter that does answer is asked again every five minutes instead of never.
  • The model is asked only in a poll where PV or the battery block has answered. It already came after them; now a silent poll does not ask it at all. A model read that keeps failing is asked again every five minutes, and the meter appears once it answers.
  • A model code the vendor's table does not name still gets no meter; that decision comes from a value that answered.
  • Signs, decoding and the no-pack check are unchanged. Each stream already went out only when its block answered, so no field was sent as zero, and kstar is not in invented-number-baseline.json.

Test evidence

  • test_kstar_wakes.py, eight tests; four fail on 1.3.0 and all pass on 1.3.1:
    • test_wakes_after_silence.lua (shared harness): silent from start-up, silent mid-session, each register refused six times;
    • ten silent polls, then PV, battery and a three-phase meter with the right values on the first poll that answers;
    • after a silent start, 3045 is not asked while nothing answers, is read once after waking, and the meter goes out with all three phases;
    • a model read refused six times is asked again after five minutes, and the meter goes out once it answers.
    • The four tests that pass on 1.3.0 check that the model is asked after PV and battery, and that PV, battery or meter is left out when its read does not answer.
  • Existing test_kstar_map.py (30) and test_kstar_battery_now.py (3) pass unchanged.
  • make test-driver ID=kstar: 89 passed, 6 skipped.
  • make absent-register-report ID=kstar: 3000, 3055 and 3045 all SETTLED 1.
  • make invented-number-report ID=kstar: none.
  • make check: 5582 passed, 927 skipped.

Not yet verified

  • No hardware run. The case needs a KSTAR inverter that is asleep or held by another client when FTW starts.
  • CHANGELOG.md and the shared harness drivers/tests/lua_harness/test_wakes_after_silence.lua are touched by the other 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. An inverter asleep at start-up, or held by another
Modbus client, used up every try while answering nothing, so the driver
sent nothing until FTW restarted it. The model code at 3045, which sets
how many meter phases to read, was one of those reads: once given up, the
grid meter was never read for the session.

A miss now counts only in a poll where another read answered, and a
register given up is asked again every five minutes. The model is asked
only after PV or the battery block has answered in the same poll.

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:54:13.472136Z 15141ba 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