Loadpoint priority strategy: charge the lower-SoC vehicle first (configurable, with hysteresis)
Is your feature request related to a problem? Please describe.
When two loadpoints share limited PV surplus, priority is a static integer — you must pre-pick a fixed winner. There's no way to say "among loadpoints of equal priority, charge whichever vehicle currently has the lower SoC (or is furthest from its target) first." So surplus rationing can't dynamically favor the car that needs it most.
Describe the solution you'd like
A per-loadpoint priorityStrategy that sub-orders loadpoints within the same priority tier:
static(default) — rank bypriorityonly (today's behavior).soc— prefer the loadpoint whose vehicle has the lower soc (charge the emptier car first).deficit— prefer the larger gap between vehicle soc and its limit soc (limitSoc − soc), i.e. furthest from target.
Plus a priorityHysteresis (soc-%, default 0 = off): a loadpoint only outranks another of the same priority when ahead by more than the band, so two near-equal-soc loadpoints tie and converge instead of leapfrogging each other as their soc crosses.
Fully backward compatible — static + hysteresis 0 is exactly current behavior.
Additionally, a per-loadpoint priorityBasis controls what quantity the soc/deficit strategies compare:
percent(default) — rank by the soc-% gap, capacity-independent: the emptier car by percentage wins regardless of battery size.energy(aliases:absolute,kwh) — scale the soc-% gap by the vehicle capacity (kWh) so ranking reflects the absolute energy still needed. This stops a small battery from being over-prioritized just because its percentage is lower; a large battery that is further from full in kWh can win even at a higher percentage.
A kWh score and a percentage score live on different scales and must not be compared directly, so the basis is resolved per priority tier: if any energy-basis loadpoint in a tier has no known vehicle capacity, the whole tier is ranked by percent instead. This keeps configured and unconfigured vehicles from being mixed across scales (which would otherwise over-prioritize the unconfigured car).
percent keeps today's percentage-based behavior; energy is the absolute-SoC (kWh) mode.
Describe alternatives you've considered
minSoc— already exists, but it's a hard full-power override until the floor is reached, not a way to sub-order surplus between competing loadpoints.- Static
priority— forces a fixed winner; can't track which car is currently emptier.
Additional context
Implementation: the strategy contributes a fractional score in [0,1) added to the integer priority (so sub-ordering never crosses a priority tier); the prioritizer ranks by that score, and the hysteresis deadband is applied at comparison time. A draft PR (backend + API/MQTT + both UI modals + tests) and a docs PR will be linked.
That’s an interesting idea. I could easily see that working automatically in day-to-day use. To be honest, though, I often check evcc and make manual adjustments if one car could make better use of the power. But for automatic sequential charging, it would be great—charging one car to 60%, then the other.
See https://github.com/evcc-io/evcc/issues/31194. Loadpoints are just round robin atm. Just changing how the priority value gets calculated doesn‘t change that. Not sure if this PR takes actual cross-loadpoint demand into consideration before starting a charge?
Note https://github.com/evcc-io/evcc/issues/31071#issuecomment-4797144238
#31684 brings the prequisites to make let this idea here apply in a useful way. If this get's merged, we should continue here. @Alexxtheonly are you still interested in this? Haven't heard from you in a while.
Cheers
https://github.com/evcc-io/evcc/pull/31684 brings the prequisites to make let this idea here apply in a useful way.
I don't think it does- its an entirely different approach, but both could work in conjunction.
@ScumbagSteve still interested yes, just no time the last weeks
- PR synced with master (incl. #31684)
- strategy is a site level setting now, after andig's comment on the PR
@andig
- no, start decision untouched, this PR only reorders the flexibility reclaim inside a tier
- #31684 covers startup order between tiers, inside a tier the enable race remains
- idea: reservedPVPower compares the score instead of int priority -> emptier car wins the startup too. separate PR after this one if you're ok with it
@andig i think this should stay open, right?
Yes!
Test binaries for the fix in #31072 are ready to test:
- Binaries: download artifacts
- Docker:
docker pull evcc/evcc:pr-31072