Repository navigation
Conversation
…, 1.1.3) 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, and the driver then sent nothing until FTW restarted it. sma_pv also settled on its first poll whether a meter is paired and which lifetime register to read, so the same start left it without a meter for the whole run. A register that did not answer was sent as zero. A miss now counts only in a poll where another read answered, and a register that misses three times on an inverter that does answer is asked again every five minutes. sma_pv decides the meter on every poll from 30885, falls back to the lifetime counter at 30529 only while 30513 answers NaN or has been given up, and samples the release ceiling in the first poll where PV power answered. A field whose register did not answer is left out; PV and meter go out only when their power answered, the battery only when its voltage and current did. SMA's NaN still reads as 0. The serial is read last, once the inverter has answered in that poll. test_sma_wakes.py: ten of its twelve tests fail on the old drivers (the other two guard what already worked) and all pass now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d81f2f0ad8
ℹ️ 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".
| if i32_valid(v) then mppt1_a = v * 0.001 end | ||
| local pv_w = read_i32(30775) | ||
|
|
||
| if not release_probed and pv_w ~= nil then probe_release() end |
There was a problem hiding this comment.
Capture the release ceiling before accepting curtailment
If the initial polls cannot read PV power, release_probed now stays false while driver_command("curtail", ...) can still write a setpoint. When PV power subsequently answers, this probe captures the driver's own curtailment as the natural ceiling, so curtail_disable, the watchdog and cleanup all restore the curtailed value instead of releasing it. Using the Lua harness with a 50,000 W initial ceiling, one failed PV-power read and an intervening 10,000 W curtailment, the parent restores 50,000 W but this commit restores only 10,000 W. Capture the original ceiling before accepting a curtailment, or prevent the deferred probe from sampling an active curtailment.
AGENTS.md reference: AGENTS.md:L39-L42
Useful? React with 👍 / 👎.
Problem
sma 2.2.1 and sma_pv 1.1.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; Core reloads a driver with nothing left to read only if an earlier read had succeeded, so it stayed silent until FTW restarted it.sma_pv also ran
probe_capabilities()once, on the first poll, whatever the inverter answered. A silent first poll settled "no meter" and the fallback lifetime register (30529) for the whole run, and a refused 30513 at that moment did the same.A register that did not answer was sent as zero (sma 26, sma_pv 21 counts in the invented-number baseline).
Change
Both drivers, one PR because they share the register map and the meter code:
has_meter,lifetime_regandprobe_capabilitiesare gone.invented-number-baseline.json.Test evidence
test_sma_wakes.py, twelve tests; ten fail on the old drivers and all pass now (the other two guard behaviour that already worked: no meter on an inverter without one, and the NaN fallback to 30529):test_wakes_after_silence.lua(shared with fix(saj): read the serial and battery again after the inverter wakes (1.3.1) #301) for both drivers. Old sma:asleep at start-up: register 30513 not read after the device answered; old sma_pv:asleep at start-up: no meter emitted after the device answered;make test-driver ID=sma(matches both): 235 passed, 26 skipped.make absent-register-reportfor both: every address settles.make invented-number-reportfor both: none.make check: 5586 passed, 927 skipped.Not yet verified
invented-number-baseline.jsonandCHANGELOG.mdare touched by the other driver PRs in this series; whichever merges later needs a rebase there.drivers/BUNDLED_SOURCE.jsonhas to move.🤖 Generated with Claude Code