Skip to content

Conversation

j-eissler
Copy link
Contributor

This change ensures that new values for energy channels of the _sum component can only be greater or equal. The function description of setValue() says that, but the function didn't check for it. Having decreasing energy channel values can be problematic because it breaks for example the calculation of the consumption in the history.


Simulation

To verify this I created a simple simulation which can be run in the simulator app.
simulation_request.json

The simulation runs a constant 10kW pv inverter and a meter that switches between 2kW and 10kW
I plotted the results using a simple python script.

Result without fix

simulation_result_error.json
simulation_result_error

We can see that the ConsumptionActiveEnergy channel value does sometimes decrease when we have a higher production than usage.

Result with fix

simulation_result_fixed.json
simulation_result_fixed

With this fix the channel values can never drop but only increase.

Copy link

codecov bot commented Aug 29, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

❌ Your patch check has failed because the patch coverage (50.00%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3298      +/-   ##
=============================================
+ Coverage      59.52%   59.54%   +0.02%     
  Complexity       113      113              
=============================================
  Files           2765     2765              
  Lines         119513   119515       +2     
  Branches        8892     8893       +1     
=============================================
+ Hits           71134    71149      +15     
+ Misses         45705    45688      -17     
- Partials        2674     2678       +4     
🚀 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.

This change ensures that new values for energy channels of the _sum component can only be greater or equal. The function description of setValue() says that, but the function didn't check for it.
@j-eissler j-eissler force-pushed the fix/decreasing-energy-channel branch from b5872f4 to 7dd2a73 Compare August 29, 2025 13:20
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.

1 participant