Skip to content

fix(sigenergy): read the plant again after a silent start (1.2.1) - #319

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

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

Conversation

@frahlg

@frahlg frahlg commented Dec 5, 2026

Copy link
Copy Markdown
Member

Problem

sigenergy 1.2.0 read every register through probe_read, which leaves a register alone until restart after three misses. A plant that was off, restarting or held by another Modbus client when FTW started used up every try while answering nothing. The driver then sent PV and grid as 0 W until FTW restarted it. It never asked the ESS registers again either, so a plant with storage reported no battery for the whole run.

A PV or grid register that did not answer went out as zero (five fields in the invented-number baseline).

Change

  • A miss counts only in a poll where another read answered, so a silent plant uses up no tries and is read again on the first poll it answers. A register that misses three times on a plant that does answer is asked again every five minutes instead of never.
  • PV goes out only when 30035 answered; the meter only when 30005 answered; per-phase grid power (30052) is left out when it did not answer.
  • The battery goes out only when 30037 (ESS power) answered. Before, it went out when SoC (30014) alone answered, as a battery with no power. The limits (30047) and cell temperature (30286) are now read once 30037 answers, instead of once either 30037 or 30014 did. A PV-only plant is still not asked for them.
  • Signs are unchanged: PV is still sent negative from its magnitude; ESS and grid power already match site convention.
  • driver_command and driver_default_mode are unchanged; they write and never read.
  • driver_cleanup resets the guard and the poll state.
  • sigenergy leaves invented-number-baseline.json.

Test evidence

  • drivers/tests/test_sigenergy_wakes.py, 8 tests. 7 fail on 1.2.0 and pass on 1.2.1:

    • test_wakes_after_silence.lua (shared with the rest of the series): silent from start-up, silent mid-session, each register refused six times;
    • ten silent polls, then every field, limits and cell temperature included, on the first poll that answers;
    • PV, battery or meter left out when its power does not answer, three cases;
    • SoC, limits, cell temperature and per-phase power left out when they do not answer;
    • an ESS silent for six polls while the rest answers is read with its limits within five minutes.

    The other one passes on both and guards the discharge command's writes after a silent start.

  • drivers/tests/test_sigenergy_battery_now.py passes unchanged.

  • make test-driver ID=sigenergy: 65 passed, 6 skipped.

  • make absent-register-report ID=sigenergy: every address prints SETTLED 1.

  • make invented-number-report ID=sigenergy: none.

  • make check: 5582 passed, 927 skipped.

Not yet verified

  • No hardware run. The case needs a Sigenergy plant that is off or held by another client when FTW starts.
  • On a PV-only plant, 30037 and 30014 never answer. They used to be dropped for good after three misses; now each costs one refused read every five minutes. Core keeps a poll fresh when one read fails and others answer, so this should be cheap, but it has not been seen on such a plant.
  • CHANGELOG.md, drivers/tests/lua_harness/test_wakes_after_silence.lua and invented-number-baseline.json are shared with 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. A plant that was off, restarting or held by another
Modbus client at start-up used up every try, and the driver then sent PV
and grid as 0 W until FTW restarted it, with no battery at all.

A miss now counts only in a poll where another read answered, and a
register given up is asked again every five minutes. A field whose
register did not answer is left out. PV goes out only when 30035
answered, the battery only when 30037 answered, the meter only when 30005
answered. Battery limits and cell temperature are read once 30037
answers. Control is unchanged.

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:00:03.102465Z 7651235 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