Skip to content

fix(growatt): read the inverter again after a silent start (2.2.3) - #328

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

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

Conversation

@frahlg

@frahlg frahlg commented Dec 5, 2026

Copy link
Copy Markdown
Member

Problem

growatt 2.2.2 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 battery registers (1009, 1011, 1013, 1014) went through the same guard. The driver decides on each poll whether a battery is there, from the values that answered. After a silent start those registers were given up, so a hybrid inverter's battery would have looked absent for the session, as on a PV-only inverter.

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.
  • A short reply now counts as a miss in probe_read itself; read_input already refused it.
  • The PV-only check is not a one-shot decision: it runs on each poll from the values that answered, so it needs no change of its own. With the new guard a battery that answers later is picked up.
  • Signs and decoding are unchanged. PV and meter already went out only with their power, and each field only from a read that answered, so growatt is not in invented-number-baseline.json.

Test evidence

  • test_growatt_wakes.py, eight tests; four fail on 2.2.2 and all pass on 2.2.3:
    • 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 meter with the right values on the first poll that answers;
    • after a silent start, the battery is still found and sent on every poll;
    • battery registers refused six times are asked again after five minutes, and the battery goes out once they answer.
    • The four tests that pass on 2.2.2 check that PV, battery or meter is left out when it does not answer, and that fields whose reads do not answer are left out.
  • Existing test_growatt_battery_now.py (5), test_growatt_battery_sign.py (2), test_growatt_never_fabricate.py (13) and test_growatt_pv_only_battery.py (3) pass unchanged.
  • make test-driver ID=growatt: 80 passed, 5 skipped.
  • make absent-register-report ID=growatt: all 21 addresses SETTLED 1.
  • make invented-number-report ID=growatt: none.
  • make check: 5582 passed, 927 skipped.

Not yet verified

  • No hardware run, and the driver is still experimental. The case needs a Growatt SPH or MOD that is asleep or held by another client when FTW starts.
  • Left as it was: the battery still goes out without w when voltage or SoC answered but the charge or discharge power did not. test_growatt_never_fabricate.py pins that on purpose. The rule in this series is that a stream goes out only when its power answered; whether growatt should follow it is for the owner to decide.
  • The meter registers are still the open question in growatt: meter power and energy counters read the wrong registers #271; this PR does not touch them.
  • 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 battery registers were among
them, so a hybrid's battery would have looked absent, as on a PV-only
inverter.

A miss now counts only in a poll where another read answered, and a
register given up is asked again every five minutes. Whether a battery is
there is still decided on each poll from the values that answered.

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

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-05T06:18:06.220032Z ed1f18d 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