fixed Kostal Piko HTML parsing bug: kWh for Total Energy in HTML, instead of expected Wh in ActiveProductionEnergy#3465
Merged
sfeilmeier merged 1 commit intoOpenEMS:developfrom Dec 6, 2025
Conversation
…L written without conversion into ActiveProductionEnergy that expects Wh
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3465 +/- ##
=============================================
+ Coverage 59.49% 59.55% +0.06%
Complexity 112 112
=============================================
Files 2901 2901
Lines 124935 124937 +2
Branches 9357 9358 +1
=============================================
+ Hits 74322 74396 +74
+ Misses 47802 47727 -75
- Partials 2811 2814 +3 🚀 New features to boost your workflow:
|
Collaborator
sfeilmeier
reviewed
Dec 6, 2025
| // Total Energy - second value (HTML provides kWh, need to convert to Wh) | ||
| Long totalYield = null; | ||
| if (index < valueCells.size()) { | ||
| totalYield = this.parseLongValue(valueCells.get(index++).text()); |
Contributor
There was a problem hiding this comment.
Just as a note: you could solve this a lttle bit shorter with
Optional.ofNullable(this.parseLongValue(valueCells.get(index++).text()))
.map(v -> v * 1000) // Convert kWh to Wh
.orElse(null);
Contributor
Author
There was a problem hiding this comment.
:-) But not with my depth of Java knowledge...
sfeilmeier
approved these changes
Dec 6, 2025
Contributor
Author
|
Beyond that: I get really strange effects applying this bugfix, as I described in https://community.openems.io/t/connecting-kostal-piko-pv-inverter-to-openems/10231/47 |
Contributor
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.


As the parsed HTML from the Kostal Piko delivers kWh, the value should be multiplied by 1000 before it is stored into ActiveProductionEnergy, that expects Wh, by
this._setActiveProductionEnergy(totalYield);(line 321)This PR adds exactly this adjustment.