Repository navigation
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. |
frahlg
force-pushed
the
map-257
branch
4 times, most recently
from
November 22, 2026 12:59
c62b52b to
5f6b587
Compare
Both drivers read addresses that no source supports, so their PV, battery and meter values were probably wrong on real hardware. alphaess follows AlphaESS's parameter address table: grid meter power at 0x0021 (S32, import positive), phase A current at 0x0017, frequency at 0x001A; battery power at 0x0126 (AlphaESS: discharge positive, so negated), voltage at 0x0100, SoC at 0x0102 (0.1 %); PV as the sum of the six string powers at 0x041F-0x0433. The grid phase voltage is no longer sent: the sources disagree on its scale. kstar reads KSTAR's input registers from 3000 (Hybrid Inverter Modbus V2.9.1): PV at 3000-3025, battery voltage, power and SoC at 3063-3066, and the grid meter at 3097-3108. KSTAR gives no signs; following ha-solarman, meter power (export positive) and battery power (discharge positive) are negated. The model at 3045 says whether the S and T phases exist. Each stream goes out only when its read answered, never as zeros, so both drivers leave the invented-number baseline. Not verified on hardware. Refs #257 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Review fixes for the 1.3.0 map change. - Both: battery voltage and SoC both 0 means no pack is connected, so the battery stream and battery metrics are left out instead of an empty pack (docs/WRITING-A-DRIVER.md, "A hybrid inverter may have no battery"). KSTAR's inverter temperature still goes out. - alphaess: the current meter map and PV strings 4 to 6 are used only once 0x074E (Protocol Version, in the System info block that V1.20 added) answers. Its value is not used; it read 0 on a real system. Firmware where it never answers gets PV strings 1 to 3 and no meter. - kstar: only the model codes KSTAR's table 3.1.5 names (0-9, 11, 12, 14, 15, 17, 18 single phase; 32-34 three phase) get a meter; reserved codes get none. - Neither map has a flag that says a grid meter is fitted, so the meter is still sent without one; the code and CHANGELOG say 0 W is then ambiguous. Not verified on hardware. Refs #257 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.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.
What this does
alphaessandkstarread register addresses that no source supports (#257). Their PV, battery and meter values were therefore probably wrong on real hardware. This PR moves both drivers to the register maps in their vendors' own Modbus documents, with site signs, and sends each stream only when its read answered.Both drivers are
read_only. No write, mode or control path changes.Gates, in both drivers
alphaess 1.3.0
Source: AlphaESS Modbus_RTU/TCP Protocol and its Parameter address table (version history to V1.39, 2024-11-29), and the Household Register Map table, all as copies in ramonvanraaij/ha-alphaess-modbus
docs/. AlphaESS publishes no download URL I could find. Cross-checked for addresses, types and signs with evccalpha-ess-smile.yaml, dxoverdy/Alpha2MQTT and senalse/ha-alphaess-modbus. No code copied.meter.Wmeter.L1_Ameter.Hzmeter.L1_Vbattery.Wbattery.Vbattery.SoC_nom_fractpv.Wpv.mppt1_v/mppt1_aThe cell temperature metrics (0x010D, 0x0110) are unchanged; they now come from the same battery block read (0x0100-0x0126).
Left alone, and why
kstar 1.3.0
Source: KSTAR Hybrid Inverter MODBUS RS485 Communication Protocol V2.9.1 (2024-07-21, document SFT-KSE-001), which KSTAR support gave to a ha-solarman user (PDF). Its model table (3.1.5) covers the KSE single-phase models, the BluE-S 3680D/5000D/6000D (and M1) and the E8KT/E10KT/E12KT three-phase models, so both families in the manifest use this map. Cross-checked with davidrapan/ha-solarman and StephanJoubert/home_assistant_solarman
kstar_hybrid.yaml. No code copied.All reads are input registers (function 04H). Before, the driver read holding registers 10-54, which no source has.
pv.Wpv.mppt1_v/mppt1_abattery.Wbattery.V(new)battery.SoC_nom_fractmeter.Wmeter.L1_V,meter.Hz,meter.L1_AThe battery and inverter temperatures (3067, 3055) are unchanged; voltage, power and SoC now come from the same read (3055-3067).
Model detection. KSTAR marks the S and T phase meter registers "only for three phase model". The driver reads the model at 3045 once and uses only the codes KSTAR's table 3.1.5 names (ha-solarman's lookup has the same list): 0-9, 11, 12, 14, 15, 17 and 18 (KSE and BluE-S, single phase) read the R phase; 32-34 (E10KT, E8KT, E12KT) sum R, S and T. The codes the table marks "reserve" (10, 13, 16, 19-31, 35-47) and anything else send no meter, and the driver logs why.
Left alone, and why
available_*field is sent.Also in this PR
invented-number-baseline.json(alphaess 10 → 0, kstar 9 → 0).probe_readin both now treats a short reply as a failed read, so a decode never does arithmetic on nil.lua_harness/test_all_drivers.luasets the KSTAR model register and moves the two SoC fixtures to the new addresses.make bump-driver, vendor documents added toupstream_docs(all answered 200), and a one-linechangelog.Tests
drivers/tests/test_alphaess_map.py(16 cases) anddrivers/tests/test_kstar_map.py(30 cases). They cover each field's address, scale and sign; streams absent on a failed or short read; no battery (voltage and SoC 0) against an empty pack with a voltage; the AlphaESS map gate (0x074E read once; when it never answers, no meter, three PV strings, and only three tries); every listed and reserved KSTAR model code; a failed model read; and that the old addresses are no longer read.maindrivers. The 21 added in review failed against the first version of this PR before the fix.*_battery_now.pytests now fail the block's first register, since the block is one read.make absent-register-reportfor both: every address settles, 0x074E included.make test-driver ID=alphaess: 67 passed.make test-driver ID=kstar: 81 passed.make checkon head 5f6b587 (rebased onto main after fix(growatt): leave a failed read out instead of sending 0 (2.2.2) #273): 5317 passed, 928 skipped.Not verified on hardware. All values in the tests are synthetic. The signs that rest on integrations rather than the vendor (AlphaESS grid, KSTAR grid and battery) are the most likely to be wrong. A field report from an AlphaESS or KSTAR owner would settle it: grid power while importing, battery power while charging, and PV power at midday, compared with the vendor app.
Refs #257
🤖 Generated with Claude Code