Repository navigation
Conversation
…s unsupported Signed-off-by: Marcus Murwall <[email protected]>
miravoss26
left a comment
There was a problem hiding this comment.
Read the diff. Clean, well-reasoned fix: it caches mppt_supported, so once a K-series inverter returns exception-2 on the 40123 MPPT block the driver stops re-probing and the Go host's failed-read counter stops flapping. Model 103 metrics are untouched, and a confirmed-unsupported unit emits the same MPPT zeros it did before, so no change on the data side.
- Correctness: the nil-probe / true-keep-reading / false-skip state machine is right, and the default 0,0,0,0 means skipping emits the same values the old pcall-fail path did.
- One edge worth a thought: the lock to
falsefires on the first failed read. A transient first-poll error on a firmware that actually exposes MPPT would disable those metrics until restart, since the Lua side can't tell exception-2 from a one-off timeout. Fine given restart re-probes and the target is genuinely-unsupported K-series, but if first-poll flakiness shows up, 2 or 3 consecutive misses before locking would harden it. - Security: nothing flagged. No secrets, no new deps, existing host.modbus_read / host.log only.
No CI checks attached that I can see, so worth confirming the driver test run is green first. Safe to merge from my read. Not in my auto-merge allowlist, so I'm leaving the merge to a human.
|
Thanks @murwall — carried over verbatim in srcfl/device-drivers#33, with you credited. The 30-minute run on SE17K firmware 0003.2251 is the strongest evidence on either PR. Moving it for the same reason as #703: Your reasoning for fixing it in the driver rather than in the Go host's accounting is worth keeping on the record, so I quoted it in the new PR: distinguishing "this driver called modbus_read but doesn't care if it fails" from a real error is a harder change than not issuing a read you already know will fail. srcfl/device-drivers#33 adds a regression test against the catalog driver and verifies it against the unpatched baseline: three reads of 40123 over three polls before, one after. One thing that came out of it — editing the driver cost it byte-identity with Closing in favour of srcfl/device-drivers#33. |
) Brings the two driver fixes from srcfl/ftw#703 and srcfl/ftw#702 to the repository that owns the drivers. pixii 2.1.0 → 2.1.1, solaredge_legacy 0.3.0 → 0.3.1. Closes srcfl/ftw#703, closes srcfl/ftw#702
What
Cache a
mppt_supportedflag in the module. On the first poll where theMPPT block at 40123 read returns nothing, mark it unsupported and skip
the
host.modbus_readcall on every subsequent poll (until driverrestart, which re-probes). Rest of the poll — Model 103 block, AC power,
frequency, temp, lifetime energy — is unchanged.
Why
On SolarEdge K-series firmware (SE7K/10K/17K/25K, "display" era) the
proprietary MPPT registers at 40123 aren't populated. A direct Modbus
TCP probe against an SE17K running firmware
0003.2251confirms:The driver already
pcalls the MPPT read and treats failure as"MPPT metrics unavailable, keep going with Model 103". Correct at the
Lua level.
But the Go host counts every failed
host.modbus_readtoward thedriver-poll error tally regardless of Lua-side
pcallhandling. Soon K-series hardware the driver flaps
driver_poll: 1 of 2 modbus reads failedevery 5 s indefinitely, gets marked offline via the stale-telemetry watchdog, and PV data never reaches the planner. This is a
regression vs
v0.120.9, where the same K-series firmware polledcleanly on the same driver source.
Rather than change the Go host's accounting (which would need to
distinguish "this driver called modbus_read but doesn't care if it
fails" from a real error), fix at the driver: don't ISSUE the failing
read once we know it isn't going to succeed.
Testing
Verified on SE17K firmware
0003.2251(K-series with display):Before (v1.13.4 shipped driver, no patch):
After (this patch):
Status=0,ConsecutiveErrors=0, AC power / frequency / temperature / lifetime energy all emit correctly.Ran for ~30 min in a live install; battery dispatch runs cleanly.
Related
pixii.lua(meter_energy_sfat 40288) — separate PR: [#PR-pixii-meter-energy-sf]modbus_readcalls regardless of Lua'spcall. Localized "cache unsupported, skip subsequent reads" pattern fixes both.Alternative
If a broader architectural approach is preferred, exposing a
host.modbus_read_optional(addr, n, fc)that doesn't count toward thefailure tally on nil returns would let drivers opt out declaratively.
Bigger surface change; the localized fix here is portable to v0.120.9-
style behaviour without touching the Go host.