evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Battery forecast: batteries take turns discharging, but they discharge together

Open ghaeprv opened this issue 1 month ago • 2 comments

Is your feature request related to a problem? Please describe. I have two home batteries of 11 kWh each, one per inverter, run by the inverters as a master/slave cascade (M-TEC). evcc cannot control them (controllable: false). The inverters share the house load, so both batteries discharge at the same time and their SoC moves together (screenshot 1, M-TEC portal, a normal day).

The forecast on the Battery tab shows something else: one battery covers the house alone for hours while the other sits idle, then they swap (screenshot 2). In the current plan both batteries are at 100 % at 12:45. From then to the end of the horizon, the plan has one battery discharging alone for 34.75 hours and both together for 15 minutes. Battery 2 covers most of the evening (16:45 to 23:00), battery 1 the night and morning (23:00 to 13:15 the next day, except 03:00 to 03:45), then battery 2 again.

(Battery 2 currently has a hardware fault and reads 0 %, which is why its line starts low. The pattern above starts after both are full in the plan, so it does not depend on that.)

evcc's own history from before the fault shows the real behaviour: on 11 nights (2026-09-27 to 2026-10-07, 01:00 to 06:00 local) the average discharge power of the two batteries was never more than 27 W apart.

Night discharge per battery (evcc InfluxDB, average W, 01:00 to 06:00)
Night Battery 1 Battery 2
09-27 248 241
09-28 273 246
09-29 267 275
09-30 244 238
10-01 231 234
10-02 305 306
10-03 231 231
10-04 234 231
10-05 248 244
10-06 402 407
10-07 273 273

As far as I can tell from the code, the optimizer gets the two batteries as independent storages with identical parameters (same capacity, c_max/d_max 6000 W default, same p_a, c_priority 0). Nothing in the cost or the preference objective ties them together, so every split of the load has the same value and the solver returns one corner of it: one battery at a time. The Battery tab then plots each battery's state_of_charge as returned (forecastToSeries in assets/js/components/Battery/history.ts). The stacked total in the kWh view is right; the per-battery lines in the % view are not. As noted in #34905, evcc has no per-battery setpoint, so the batteries never follow that split.

Describe the solution you'd like When the cost is the same, the forecast should split planned charge and discharge across batteries in proportion to their capacity, so the lines move together as they do in reality. Two possible places:

  • optimizer: a tie-break preference that keeps the batteries' SoC (in %) close to each other.
  • evcc: for batteries it does not control individually, pool them into one optimizer battery and split the result back by capacity share for the Battery tab.

Describe alternatives you've considered

  • The kWh view: its stacked total is correct, but it hides the per-battery view.
  • Configuring both towers as one battery meter in evcc (summed power, averaged SoC, 22 kWh). That fixes the forecast, but loses the per-battery status and history in evcc.

Additional context evcc 0.318.1, optimizer on with automatic mode off (suggestions only), both batteries are custom meters with capacity: 11.

Images

Image Image

🤖 Generated with Claude Code

ghaeprv avatar Oct 27 '26 07:10 ghaeprv

Thanks for the detailed report. The description matches the code: core/site_optimizer.go sends every home battery as an independent storage entry (optimizerBattery) and the forecast per battery is plotted as returned. With identical parameters the split is a tie, so the solver picks a corner. Forecast totals are unaffected, only the per-battery lines.

Pooling uncontrollable batteries into one optimizer storage and splitting the result by capacity share (your second option) would be the evcc-side approach. The tie-break would have to live in the optimizer itself. This needs a design decision (which batteries qualify, how details/suggestions per device are derived), so no quick fix from my side.

Related: #34905 (per-battery priorities, closed).

🤖 Generated with Claude Code

github-actions[bot] avatar Oct 27 '26 07:10 github-actions[bot]

Afaiu this- master/slave setup- is a special situation that the optimizer doesn't know about. With control: false this is a display only artifact. The optimizer's total battery powers would be correct. Nothing we intend to fix now. If you can aggregate the batteries outside evcc or get totals from any of the inverters that would fix it, too.

andig avatar Nov 10 '26 09:11 andig