Repository navigation
fix(deye-svk): skip energy headroom when the SoC read fails - #224
Conversation
…rivers#224, #231) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Status? |
miravoss26
left a comment
There was a problem hiding this comment.
Adds a bat_soc nil guard in deye-svk.lua so a failed SoC read skips the energy headroom for that poll instead of raising a Lua error. Bumps the driver and manifest to 0.2.3 and adds a CHANGELOG entry.
- Diff is 3 lines of logic plus version and changelog. Version in driver, manifest and CHANGELOG all say 0.2.3.
- Behaviour on a nil SoC:
chg_eh_wh/dis_eh_whstay 0 for that poll, which is what the PR says and matches the 50-125k-svk drivers. - Note: no CI checks are reported on this PR, and the PR itself says it was not reproduced on hardware. The reasoning holds from reading the code.
- Security screen: no secrets, no new dependencies, no new network destinations, no authz changes.
Safe to merge from my read.
|
We have not reviewed this yet. The change reads right: a failed SoC read now skips the energy headroom for that poll. The branch conflicts with main; please rebase and set the version above main's. If the Lua error shows in your log, paste the line without IP or serial. |
c3f99e5 to
b20ede0
Compare
|
Rebased onto main (940a913). The only conflict was CHANGELOG.md; I kept both entries. The driver stays at 0.2.3, which is above main's 0.2.2. The manifest checksum and size were stale, so I regenerated the manifest, index, devices and support status. make check passes locally (5091 passed, 951 skipped). It is still a draft because it is not tested on Deye hardware. |
|
Thanks for the rebase and for explaining where the report came from. We will review the diff next. |
miravoss26
left a comment
There was a problem hiding this comment.
Adds the missing and bat_soc guard so a failed SoC read skips the energy headroom for that poll instead of raising on bat_soc * 100. Version bump to 0.2.3 is carried through driver, manifest, devices.yaml, index and support-status.
- I recomputed sha256 and size_bytes for
deye-svk.luaat this head: both match index.yaml and the manifest (0a4ed8af…, 22116). - Behaviour on a nil SoC: headroom stays 0/0 for that poll, which is the safe direction.
- No secrets, new deps or new network destinations.
Safe to merge from my read. Note the PR says it is not reproduced on hardware, so the fix rests on reading the code path.
bat_soc is nil after a failed SoC read, and the headroom calculation then raised a Lua error whenever battery_capacity_wh was set. Guard it the same way as the 50-125k-svk drivers. Version 0.2.2 -> 0.2.3. Reported and fixed in murre87/energywizard#215 by lazgeo. Co-authored-by: lazgeo <gl@glic.se> Signed-off-by: Emil Axfors <17743298+murre87@users.noreply.github.com>
b20ede0 to
e464a53
Compare
|
Thanks, and thanks to lazgeo for the fix. Merged as 4bd5a6e, and deye-svk 0.2.3 is in the signed channel. Main had moved, so we rebased your branch onto it, regenerated Before merging we reproduced the crash in the Lua harness. With a battery capacity set and the SoC read failing, a poll on main raised |
Summary
deye-svk.luacomputes the energy headroom frombat_socwheneverbattery_capacity_wh > 0. When the SoC read fails in a poll,bat_socis nil andmath.floor(bat_soc * 100 + 0.5)raises a Lua error, so the whole poll fails. This adds the same guard the 50-125k-svk drivers already use (and bat_soc), so the headroom stays 0 for that poll. Version 0.2.2 -> 0.2.3 in the driver and manifest, CHANGELOG entry under Unreleased.Seen in the field in EnergyWizard (driver from commit
e07d27038e83): automatic error reportftw_deye-svk.poll: LuaError, murre87/energywizard#215. Fixed there by lazgeo (Co-authored-by in the commit). Context: murre87/energywizard#231.Driver evidence
Safety
Control evidence
not applicable (no control path changes)
Checks
Signed-off-by.make test-driver ID=deye-svk(not run locally)make check(not run locally; the Lua compiles with Lua 5.4)