Skip to content

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
janklostermann:bugfix/kostal
Dec 6, 2025
Merged

fixed Kostal Piko HTML parsing bug: kWh for Total Energy in HTML, instead of expected Wh in ActiveProductionEnergy#3465
sfeilmeier merged 1 commit intoOpenEMS:developfrom
janklostermann:bugfix/kostal

Conversation

@janklostermann
Copy link
Copy Markdown
Contributor

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.

…L written without conversion into ActiveProductionEnergy that expects Wh
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 5, 2025

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Sn0w3y
Copy link
Copy Markdown
Collaborator

Sn0w3y commented Dec 5, 2025

Can confirm! This is Indeed a Bug :)

image

// 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());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-) But not with my depth of Java knowledge...

@sfeilmeier sfeilmeier merged commit 96fa57d into OpenEMS:develop Dec 6, 2025
7 checks passed
@janklostermann
Copy link
Copy Markdown
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
Therefore I am not sure if this is all that needs to be fixed...

@janklostermann janklostermann deleted the bugfix/kostal branch December 6, 2025 14:57
@sjjh
Copy link
Copy Markdown
Contributor

sjjh commented Dec 11, 2025

Can confirm! This is Indeed a Bug :)

image

Sorry for beeing late to the party, yes can confirm as well, that this fixes the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants