[solax] Add missing channels for X1 Hybrid G4 inverter#20660
Merged
lsiepel merged 3 commits intoopenhab:mainfrom May 4, 2026
Merged
[solax] Add missing channels for X1 Hybrid G4 inverter#20660lsiepel merged 3 commits intoopenhab:mainfrom
lsiepel merged 3 commits intoopenhab:mainfrom
Conversation
a5618d7 to
7453aaf
Compare
Implements the following previously unmapped local API registers: - getPowerUsage() → Data[38] (house consumption W) - getTodayEnergy() → Data[13] / 10 (today's PV yield kWh) - getTotalPVEnergy() → packU16(12,11) / 10 (lifetime PV energy kWh) - getTotalFeedInEnergy() → packU16(35,34) / 100 (lifetime feed-in kWh) - getTotalConsumption() → packU16(37,36) / 100 (lifetime grid import kWh) - getTodayFeedInEnergy() → Data[39] / 10 (today's feed-in kWh) - getTodayBatteryDischargeEnergy() → Data[23] / 10 (today battery discharge kWh) - getTodayBatteryChargeEnergy() → Data[24] / 10 (today battery charge kWh) Register mapping verified against live inverter data (type=15, fw 3.008.10). Power usage cross-checked: AC output (1516W) - feed-in (7W) = 1509W = Data[38]. Updates X1HybridG4DataParser supported channels set and adds test assertions. Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
…brid G4 Corrected register mapping based on 30-minute live monitoring session correlating Data[] changes against battery SoC (74% → 97%): - getTodayBatteryChargeEnergy(): Data[23] → Data[85] / 10 - getTodayBatteryDischargeEnergy(): Data[24] → Data[87] / 10 Data[23]/Data[24] were wrong — Data[24] was completely static throughout the entire charging session. Data[85] tracked SoC delta 1:1 (confirmed charge energy), Data[87] was stable while charging and only moved during earlier discharge periods (confirmed discharge energy). Updates test assertions accordingly. Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
7453aaf to
d655e90
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the missing channel implementations for the SolaX X1 Hybrid G4 (type=15) local parser/data model so existing binding channels return real values instead of defaults.
Changes:
- Implement 8 previously-missing
LocalDatagetters inX1HybridG4Data(today/total energy, power usage, etc.) using the correct raw register indices and scaling. - Extend
X1HybridG4DataParsersupported-channel set to advertise those channels for this inverter type. - Extend the existing parser test to assert the new channel values.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
bundles/org.openhab.binding.solax/src/main/java/org/openhab/binding/solax/internal/model/local/X1HybridG4Data.java |
Adds the missing channel getters (raw register mapping + scaling) for X1 Hybrid G4. |
bundles/org.openhab.binding.solax/src/main/java/org/openhab/binding/solax/internal/model/local/inverters/X1HybridG4DataParser.java |
Exposes the added channels as supported for the X1 Hybrid G4 parser. |
bundles/org.openhab.binding.solax/src/test/java/org/openhab/binding/solax/internal/local/parsers/TestX1HybridG4Parser.java |
Adds assertions for the new getters/channels. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When the high word (major) is zero, packU16 returned the low word (minor) directly as a signed short. This caused negative results for any 32-bit counter whose value falls in the range 0x8000–0xFFFF of the low word (e.g. total-pv-energy between ~3276–6553 kWh at ÷10 scaling, or total-feed-in-energy between ~327–655 kWh at ÷100). Fix by using Short.toUnsignedLong(minor) in the major==0 branch, consistent with the Integer.toUnsignedLong() already used in the general case. Restore the original Data[11]=59781 test fixture (which exercises this unsigned overflow path) and reinstate the 5978.1 kWh assertion. Signed-off-by: Konstantin Polihronov <polychronov@gmail.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.
Summary
type=15) inX1HybridG4DataCommonLocalDeviceDataand wired up in the binding but returned default/zero values for this inverter typeAdded channels
power-usageData[38]today-energyData[13]total-pv-energypackU16(12,11)total-feed-in-energypackU16(35,34)total-consumptionpackU16(37,36)today-feed-in-energyData[39]today-battery-discharge-energyData[87]today-battery-charge-energyData[85]