Repository navigation
fix(solaredge_pv, solaredge_legacy): keep reading the serial after the inverter wakes (1.2.3, 0.3.4) - #298
Merged
Conversation
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. |
…e inverter wakes (1.2.3, 0.3.4) Both drivers read the SunSpec serial (40052) before the Model 103 block, through a helper that gives up after three misses until restart. An inverter asleep at start-up, or held by another Modbus client, used up those three chances while answering nothing. The device then stayed known only by its address for the life of the process, and Core's forecast identity check, which matches the serial in its saved receipt, stayed pending. In the field this held back a load forecast for 12 hours and the load model for a week. The serial is now read last in a poll, and only in one whose Model 103 block answered, so a sleeping inverter costs it nothing. After three misses on an inverter that does answer, it is asked again every five minutes instead of never: one failed read in sixty polls while it keeps refusing. The first answer reports it and clears the count. Reading it last means a timeout there cannot make the host skip the poll's other reads during its reconnect backoff. No other register's read changed. A new harness test covers both drivers: an inverter that answers nothing for six polls and then wakes, and a serial that fails three times while the inverter answers, fails its first retry and answers its second. Both old drivers fail it; both new ones pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
frahlg
force-pushed
the
solaredge-serial-retry
branch
from
December 4, 2026 17:43
a4dfc33 to
f29d547
Compare
This was referenced Dec 4, 2026
frahlg
added a commit
to srcfl/ftw
that referenced
this pull request
Dec 4, 2026
…2176) Moves the pin to srcfl/device-drivers 5eb7189d, which brings: - ferroamp 2.2.0 (srcfl/device-drivers#299): never sends the EnergyHub a setpoint above the limit the hub reports when it refuses one, or above ehub_max_w; scales by what the ESOs measurably deliver instead of guessing an even split; reports power, SoC and fault code per ESO. - solaredge_pv 1.2.3 and solaredge_legacy 0.3.4 (srcfl/device-drivers#298): read the serial only once the inverter answers, and ask again every five minutes after three misses, so a restart while the inverter sleeps no longer leaves the forecast identity pending until the next restart. Planner PV curtailment accepts only reviewed Ferroamp source hashes. 2.2.0's pplim commands are byte for byte those of 2.1.2, so its hash joins the list. Two Core tests run the new behaviour under Core's Lua 5.1: the cap learned from the refusal, and the measured scale with per-ESO metrics. Both fail on 2.1.2. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
solaredge_pvandsolaredge_legacyread the SunSpec serial (40052, 16 registers) at the top ofdriver_poll, before the Model 103 block, throughprobe_read. That helper gives up on a register after three misses until restart.SolarEdge inverters often refuse Modbus at night or while another client holds the TCP connection. If FTW Core starts then, the serial uses up its three chances while the inverter answers nothing, and it is never asked again, even after the inverter answers.
host.set_snis never called, the device stays known only by its address, and Core's forecast identity check, which matches the serial in its saved receipt, stays pending. In the field this held back a box's load forecast for 12 hours and kept its load model from learning for a week. AGENTS.md says: report stable hardware identity early.Core's reload-on-empty-poll does not rescue this: the Model 103 read is not bounded, so every poll attempts a read and the reload never fires.
Change
probe_readasks again every five minutes instead of never (RETRY_EVERY_MS, keyed by register, askebadoes for its phase currents). Five minutes bounds a serial the inverter keeps refusing to one failed read in sixty polls, and one that answers again still reaches Core within minutes. The first answer reports the serial, clears the count and logs that the register answers again. The MPPT registers keep their give-up until restart.How a failed retry reaches Core: Core keeps a poll when at least one read succeeded and none failed at the transport. A refused retry (a Modbus exception) costs nothing. A timeout would cost that one poll, but the retry only runs straight after the Model 103 read succeeded on the same connection, and at most once in five minutes. In the driver the retry cannot change what the poll emits or what it returns.
solaredge_pv1.2.3 andsolaredge_legacy0.3.4, with manifest changelogs and aCHANGELOG.mdentry.solaredge_legacyhas the same helper and the same unbounded Model 103 read. Its SunSpec probe at 40000 makes the start-up case rarer there, but a serial that misses three times after that probe was still lost until restart.Not changed, though they read identity through a give-up helper:
sungrowandsajhave the same effect with their own counters (sn_tries, three tries until restart, while the main read recovers).sungrowalready starts its registers over when the link comes back (settle_poll) but notsn_tries. Each wants its own small change.huawei: only meter power (37113) is unbounded, so after a start-up outage its PV and battery reads give up as well as the serial. That is larger than identity.ctek,ctek_v2,ctek_hybrid,deye,etrel,fronius,keba,kostal,sma,sma_pv,solaredge,solis: every main read goes through the same give-up helper. After an outage from start-up the whole driver stops asking, and Core reloads a driver with nothing left to read only after an earlier read succeeded. Also larger than identity.foxess_h3_smartandsolis_stringhave open PRs on those files.abb_terraandpixiialready retry on a timer.goereads its serial only after its main block answered.mennekestakes it from its required main block.Evidence
New harness test
drivers/tests/lua_harness/test_solaredge_serial_retry.lua, run for both drivers bydrivers/tests/test_solaredge_serial_retry.py:host.set_snwith the serial in the same process;set_snis called once in all.Against the drivers on
mainthe test fails (solaredge_pvin case 1,solaredge_legacyin case 2). With this change:make test-driver ID=solaredge_pv: 45 passed, 10 skippedmake test-driver ID=solaredge_legacy: 46 passed, 10 skippedmake check: 5573 passed, 927 skippedmake absent-register-report: 40052 settles (1,1,1,0,0,0,0,0,0,0) in both drivers; every other address reads as onmain.Not tested on hardware. No register, scale or write path changed.
🤖 Generated with Claude Code