Skip to content

fix(sigenergy): stop reading a SoH register nothing can receive - #38

Merged
frahlg merged 3 commits into
mainfrom
claude/vigorous-booth-f26189
Jul 28, 2026
Merged

frahlg merged 3 commits into
mainfrom
claude/vigorous-booth-f26189

Conversation

@frahlg

@frahlg frahlg commented Jul 28, 2026 •

Copy link
Copy Markdown
Member

Summary

No hardware support changes. drivers/lua/sigenergy.lua read the ESS State of
Health register at 30087 on every poll and threw the result away. The battery
emit right below it carried only W and SoC_nom_fract, so the read cost a
Modbus round trip every 5 seconds and bought nothing. The read is gone.

Deleted rather than emitted, because there is nowhere to emit it:

Source SoH field
spec/host-api.md, Battery no — list ends at available_discharge_Wh
spec/host-api-profile.json, canonical battery keys no — same list
VALID_FIELDS["battery"] in drivers/tests/test_emit_fields.py no
grep for SoH/soh across the repository one hit, this driver

Blixt reads each emit key by exact name and silently drops one it does not
know. Inventing a name would have failed test_battery_fields_valid and still
lost the value at the far end.

sigenergy has no package target under packages/v1, so the catalog driver is
the only copy.

Commits

  1. fix(sigenergy): stop reading a SoH register nothing can receive — three
    lines out of the driver.
  2. fix(sigenergy): regenerate the size and hash the driver edit changed —
    size_bytes 3925 → 3813 and the new sha256, in index.yaml and
    manifests/sigenergy.yaml. Only those two fields move. CI regenerates both
    and then runs git diff --exit-code, so they have to travel with the edit.
    generate_devices.py and generate_support_status.py produce no diff.

No version bump and no CHANGELOG.md entry. signature and bytecode_sha256
stay empty for the release job.

One red check, and it is asking for a central file

pytest fails on test_absent_register_settles.py::[sigenergy]. The
absent-register count drops 6 → 5 and the ratchet fails a fall the baseline does
not record:

sigenergy is down to 5 from 6 — good. Set it to 5 in
absent-register-baseline.json so the debt cannot be re-borrowed.

To merge, set sigenergy to 5 in
drivers/tests/absent-register-baseline.json.
Left untouched here because
that file is maintained centrally.

Worth being precise about: this is a new failure from this branch, not a
pre-existing one. The full suite is green on the parent commit — 1903 passed,
nothing failed. The ratchet is doing its job.

Driver evidence

  • Driver id: sigenergy
  • Device make/model: Sigenergy SigenStor, three-phase hybrid inverter with ESS
  • Firmware tested: none — no hardware run, see below
  • Protocol/register source: Sigenergy Modbus Protocol V2.5, as cited in the
    driver header. Register 30087 removed, no register added or reinterpreted.
  • Hardware test performed: none, and none is called for. This removes a read
    whose result was never used. Every value the driver emits is byte-identical
    before and after; the diff cannot change telemetry, only the poll's register
    traffic.
  • Known limits: SoH stays unreported until the battery contract gains a field
    for it. When one arrives, 30087 is U16 percent at gain 10, so raw / 1000 is
    the 0-1 fraction, the same shape as SoC two lines up.

Safety

  • The driver starts read-only, or this is a separately reviewed control change.
    Control paths are untouched.
  • Vendor signs are converted at the driver boundary. Unchanged.
  • Cached telemetry becomes stale instead of being re-emitted as fresh.
    Unchanged, and one less failing read to survive.
  • No credentials, serial numbers, private addresses or site data are included.

Package or promotion evidence

not applicable — driver-only, read-only, no package target exists for this id.

Checks

  • Commits include Signed-off-by.
  • ./luac55 -p drivers/lua/sigenergy.lua — clean
  • ./lua55 drivers/tests/lua_harness/absent_register_probe.lua . drivers/lua/sigenergy.lua
    — 6 addresses down to 5, 30087 gone, the other five unchanged
  • make test-driver ID=sigenergy — 44 passed, 1 failed, the ratchet above
  • make package-driver ID=<id> TARGET=<target> — not applicable, no package
  • make check — green until pytest, which fails on the ratchet above

Everything else is green: pytest drivers/tests/ -q gives 1902 passed,
2072 skipped, and the single ratchet failure.

🤖 Generated with Claude Code

frahlg and others added 2 commits July 28, 2026 20:22
driver_poll read ESS SoH at 30087 every poll and dropped the result on
the floor. The battery emit below it carried only W and SoC_nom_fract,
so the read bought a Modbus round trip every 5 seconds and nothing else.

There is no field to put it in. spec/host-api.md and the canonical keys
in spec/host-api-profile.json both end the battery list at
available_discharge_Wh, VALID_FIELDS["battery"] in
drivers/tests/test_emit_fields.py has no SoH-like name, and a grep for
SoH across the repository hit this driver alone. Blixt reads each emit
key by exact name and silently drops one it does not know, so inventing
a name would have failed test_battery_fields_valid and still lost the
value at the far end. The read goes instead.

sigenergy has no package target under packages/v1, so the catalog
driver is the only copy.

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
CI runs generate_index.py and then git diff --exit-code on index.yaml,
so the derived size_bytes and sha256 have to travel with the driver
edit that changed them. Same for manifests/sigenergy.yaml, which
sync_manifests.py and make check hold to the same rule.

Only those two fields move, in both files. No version bump, no
CHANGELOG entry, signature and bytecode_sha256 left empty for the
release job. generate_devices.py and generate_support_status.py
produce no diff, since neither reads driver size or content.

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb852cdf00

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread drivers/lua/sigenergy.lua
@@ -53,9 +53,6 @@ function driver_poll()
bat_soc = soc_regs[1] / 1000 -- gain 10 → percent, / 100 → fraction
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bump the Sigenergy version for the changed artifact

When the existing 1.1.0 artifact is present in the beta channel, this source change triggers .github/workflows/ftw-drivers-release.yml, but build_publication rejects a changed SHA-256 whose manifest version is not higher than the prior version. Because manifests/sigenergy.yaml remains at 1.1.0, the signed-channel publication will fail with changed artifact needs a higher version; bump Sigenergy to a new patch version.

Useful? React with 👍 / 👎.

Comment thread drivers/lua/sigenergy.lua
@@ -53,9 +53,6 @@ function driver_poll()
bat_soc = soc_regs[1] / 1000 -- gain 10 → percent, / 100 → fraction
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Synchronize the manifest after changing the Lua bytes

After this deletion the source is 3813 bytes with SHA-256 a5c6c433710b293c359c625bae02ed32f5823424646ef98d321a3de30355fa57, while manifests/sigenergy.yaml still claims 3925 bytes and the previous hash. test_manifest_hash_and_size_match_the_source and the manifest synchronization step therefore fail, and consumers reading the manifest receive integrity metadata for different bytes; regenerate and commit the manifest fields.

AGENTS.md reference: AGENTS.md:L64-L71

Useful? React with 👍 / 👎.

Comment thread drivers/lua/sigenergy.lua
@@ -53,9 +53,6 @@ function driver_poll()
bat_soc = soc_regs[1] / 1000 -- gain 10 → percent, / 100 → fraction
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Lower the Sigenergy absent-register baseline

Removing register 30087 lowers Sigenergy's measured absent-register debt from 6 to 5, but drivers/tests/absent-register-baseline.json remains at 6. The ratchet deliberately requires equality after an improvement, so test_absent_register_debt_does_not_grow[sigenergy] now fails; if that check were bypassed, a future sixth permanently failing read could also be added without detection. Record the new count of 5.

AGENTS.md reference: AGENTS.md:L64-L71

Useful? React with 👍 / 👎.

The SoH read removal in the previous commit left the version, CHANGELOG
and absent-register ratchet untouched. Raise the driver version since
the Lua source changed, record it in the changelog, and drop the
absent-register-baseline.json entry from 6 to 5 to match the register
that no longer gets read.

Signed-off-by: Claude <[email protected]>
@frahlg
frahlg merged commit 473576a into main Jul 28, 2026
5 checks passed
@frahlg
frahlg deleted the claude/vigorous-booth-f26189 branch July 28, 2026 18:28
frahlg added a commit that referenced this pull request Jul 28, 2026
Both sides added an entry at the top of the same Unreleased "Fixed"
block: sungrow 1.5.1 here, sigenergy 1.1.1 from #38. Kept both.

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
frahlg added a commit that referenced this pull request Jul 28, 2026
#37 taught the boundary check to scan the repository rather than the
disk under it, so make check passes locally again with worktrees
present. #38 removed sigenergy's SoH read. #39 stopped sungrow
accepting a battery command on an inverter with no battery.

Two real conflicts, both in drivers this branch had also touched:

  sigenergy  main removed the SoH read at 30087 outright; this branch
             had bounded it. Removing a read whose result is discarded
             is strictly better than bounding it, so main's side stands
             and the bounded probe covers the remaining five reads.

  sungrow    merged cleanly in the Lua: main's control-path guard plus
             this branch's bounded reads through optional_read. Zero
             violations, and the string-inverter refusal is intact.

Both files now differ from main's bytes under main's version, so both
move again -- sigenergy 1.1.1 -> 1.1.2, sungrow 1.5.1 -> 1.5.2. This is
exactly what the signed channel refuses to publish otherwise, and what
the SemVer gate in ftw#709 checks across a pin move.

Swept the whole catalog afterwards: zero absent-register violations
across every driver. make check green, 3008 tests pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
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.

2 participants