Skip to content

[Edge] Controller.Evcs: fix awaitLastChanges checking INCREASING twice instead of DECREASING#3668

Open
rishabhvaish wants to merge 2 commits intoOpenEMS:developfrom
rishabhvaish:fix/evcs-controller-await-decreasing-state
Open

[Edge] Controller.Evcs: fix awaitLastChanges checking INCREASING twice instead of DECREASING#3668
rishabhvaish wants to merge 2 commits intoOpenEMS:developfrom
rishabhvaish:fix/evcs-controller-await-decreasing-state

Conversation

@rishabhvaish
Copy link
Copy Markdown
Contributor

The awaitLastChanges() method in ControllerEvcsImpl has a copy-paste bug — it checks for ChargeState.INCREASING twice instead of checking for both INCREASING and DECREASING.

This means the controller never waits for the EVCS response time when the charge state is DECREASING. The ChargeStateHandler correctly sets DECREASING and starts a pause timer, but applyHysteresis skips the wait and immediately calculates a new power target. During PV excess charging, when available solar power drops, the controller sends repeated decreasing commands every cycle without waiting for the car to respond — causing power oscillations instead of smooth ramp-down.

Added a test that verifies both INCREASING and DECREASING states cause the controller to hold the last charge power.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3668      +/-   ##
=============================================
+ Coverage      60.13%   60.19%   +0.06%     
  Complexity       104      104              
=============================================
  Files           3209     3209              
  Lines         141232   141232              
  Branches       10402    10402              
=============================================
+ Hits           84910    84994      +84     
+ Misses         53157    53075      -82     
+ Partials        3165     3163       -2     
🚀 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.

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