Repository navigation
Conversation
…tart (2.1.4) Every read went through a guard that left a register alone until restart after three misses. A Smart Meter that was off, restarting or held by another Modbus client at start-up used up every try while answering nothing, and the driver then sent nothing until FTW restarted it. A float that held NaN or infinity, the SunSpec "not implemented" value, went out as 0. The decoder also built the 32-bit word and compared it with 0x80000000, which decodes every float wrong where Lua integers are 32 bits, as in this repository's test interpreter; FTW was not affected. A miss now counts only in a poll where another read answered, and a register that misses three times on a meter that does answer is asked again every five minutes. A reply counts only when every word asked for came back. NaN and infinity are left out, so the meter goes out only when total power answered with a number. The decoder works on the 16-bit halves. test_fronius_smart_meter_wakes.py fails on 2.1.3 (17 of 18 cases; 16 of 18 with only the decoder fixed) and passes on 2.1.4. 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. |
This branch has not been deployed
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
fronius_smart_meter 2.1.3 read every float through
read_f32andprobe_read, which leaves a register alone until restart after three misses. A Smart Meter that was off, restarting or held by another Modbus client when FTW started used up every try while answering nothing. The driver then sent nothing until FTW restarted it.Two smaller faults sat in the same decoder:
0x80000000, which is negative where Lua integers are 32 bits (docs/WRITING-A-DRIVER.md, "Numbers"). On this repository'slua55every float decoded to -0.0. FTW uses wider numbers and was not affected.Change
ferroamp_modbusdoes.driver_cleanupresets the new poll state. The Smart Meter has no serial block, so there is still noset_sn.Test evidence
test_fronius_smart_meter_wakes.py, eighteen tests. Seventeen fail on 2.1.3 and all pass on 2.1.4. With only the decoder fixed on 2.1.3, sixteen still fail:test_wakes_after_silence.lua(shared with the other PRs in this series): silent from start-up, silent mid-session, each register refused six times;make test-driver ID=fronius_smart_meter: 62 passed, 10 skipped.make absent-register-report ID=fronius_smart_meter: every address settles except total power 40098, which emits nothing.make invented-number-report ID=fronius_smart_meter: none. The driver was not in the baseline.make check: 5592 passed, 927 skipped.Not yet verified
drivers/lua/fronius.lua(the inverter) is not touched; it has its own PR, fix(fronius): read the inverter again after a silent start (2.3.2) #308.CHANGELOG.mdanddrivers/tests/lua_harness/test_wakes_after_silence.luaare shared with the other PRs in this series; whichever merges later needs a rebase there.drivers/BUNDLED_SOURCE.jsonhas to move.🤖 Generated with Claude Code