Repository navigation
Conversation
…2.1) battery.w had the wrong sign: a charging battery showed as discharging and the reverse. Growatt's Modbus RTU Protocol II V1.39 puts discharge power (Pdischarge1) at input 1009-1010 and charge power (Pcharge1) at 1011-1012; Growatt-Local-Modbus maps them the same way. The driver now reads them that way. A harness test sets each register on its own and checks the sign. Not checked on hardware. Refs #263 Signed-off-by: Fredrik Ahlgren <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 was referenced Nov 22, 2026
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.
What was wrong
growatt2.2.0 read input 1009-1010 as charge power and 1011-1012 asdischarge power.
battery.wtherefore had the wrong sign: a chargingbattery showed as discharging and the reverse. The driver is read-only, so
no command went the wrong way, but the site balance, history and planning
input were wrong for every Growatt battery.
Evidence
upstream_docs), storage input registers: 1009-1010Pdischarge1,"Discharge power", 0.1 W; 1011-1012
Pcharge1, "Charge power", 0.1 W.storage_120.py(also inupstream_docs): register1009 is
ATTR_DISCHARGE_POWER, 1011 isATTR_CHARGE_POWER.Change
drivers/lua/growatt.lua: read discharge from 1009 and charge from 1011.battery.w = charge - dischargeas before, so charge is positive.Version 2.2.1.
drivers/tests/test_growatt_battery_sign.py: sets each register on itsown and checks the sign. Both tests fail on
main(+1800 W for adischarging battery, -2500 W for a charging one) and pass here.
drivers/tests/test_growatt_pv_only_battery.py: its battery fixture putthe charge power at 1009, the old wrong address. It now puts it at 1011.
Tests
make test-driver ID=growatt: 59 passed, 5 skipped.make check: 5227 passed, 929 skipped.Not verified on hardware
Nobody has checked this on a real Growatt. An owner can check it by
watching
battery.wwhile the battery charges: it should be positive whilethe SoC rises, and negative while the SoC falls.
Found on the way, not changed here
The same V1.39 table disagrees with the meter part of this driver:
Pactouser R, AC power to user on phase R only, not thetotal meter power.
PactouserTotal) and 1029-1030 (Pactogrid total) are powersin 0.1 W. The driver reads them as import and export energy in 0.1 kWh.
V1.39 puts the energy totals at 1046-1047 (
Etouser_total) and 1050-1051(
Etogrid_total).That needs its own issue and fix.
Refs #263
🤖 Generated with Claude Code