evcc icon indicating copy to clipboard operation
evcc copied to clipboard

SOC prediction incorrect with two battery stacks - Solar Edge system

Open frumms opened this issue 2 weeks ago • 11 comments

Describe the bug

Problem Description On the Battery tab, the SOC prediction (State of Charge forecast) does not appear to be accurate. The predicted battery SOC curve differs significantly from the actual battery SOC reached throughout the day. The forecast regularly overestimates or underestimates the real battery charge level, making the prediction unreliable for energy management and planning purposes. See the picture added. While the predictions maintains at 57% for battery one, the real behavior show differently. If you look further into future, battery predicition even shows a 100% level. While only Battery 2 prediction is going down.

Expected Behavior The SOC prediction should closely reflect the expected battery charge level based on the available PV forecast, battery status, and system data, with only minor deviations from the actual SOC.

Actual Behavior The displayed SOC forecast deviates noticeably from the real battery SOC progression. Comparing the predicted SOC curve with the actual battery charge level on the Battery tab clearly shows the discrepancy.

Additional Information My solar setup use two SolarEdge Hybrid Inverters "RWB48", one hooked up to a ~10kWh battery stack, the other connected to a ~5kWh battery stack

704224048-87594886-6f78-45b5-bf27-53e9c5b64260 704204130-d461c99a-d192-4a67-bfed-7098054f41e9 704204128-7c576466-fadd-4376-9396-5fdb362039e4

Steps to reproduce

1.go to Batterie overview and compare SOC prediction of current day and the day ahead 2.check and compare with historic SOC statistics 3.furthermore there could be a possible impact on the Optimizer projections due to incorect SOC estimations

The issue can be observed directly on the Battery tab by comparing the forecasted SOC with the actual SOC during the day.

Configuration details

# open evcc at http://evcc.local:7070
network:
  schema: http
  host: evcc.local # .local suffix announces the hostname on MDNS
  port: 7070
  #listen: 7070
log: debug
levels:
  cache: error
# trial token, valid until 2025-11-04
sponsortoken: *****
# unique installation id
plant: *****
interval: 30s # control cycle interval
eebus:
  certificate:
      private: |
          -----BEGIN EC PRIVATE KEY-----
          MHcCAQEEIGYyDOUyL76ESNogIgg9ESELh8aGYXHfIO54+UJVkpGCoAoGCCqGSM49
          AwEHoUQDQgAEzACTvlBgSlMsdEhsF7tq5zxMhy1TCd8dR1IL8m2SB5JcCltnu+nl
          /8aZxijtKipdQw1a7Mrkn4MdfutZpbh0wA==
          -----END EC PRIVATE KEY-----
      public: |
          -----BEGIN CERTIFICATE-----
          MIIBvDCCAWOgAwIBAgIRAL3jw2GtjN4e2HulI6sg+iQwCgYIKoZIzj0EAwIwPjEL
          MAkGA1UEBhMCREUxDTALBgNVBAoTBEVWQ0MxCTAHBgNVBAsTADEVMBMGA1UEAwwM
          RVZDQ19IRU1TXzAxMB4XDTI1MDIyODA5NTM0MFoXDTM1MDIyNjA5NTM0MFowPjEL
          MAkGA1UEBhMCREUxDTALBgNVBAoTBEVWQ0MxCTAHBgNVBAsTADEVMBMGA1UEAwwM
          RVZDQ19IRU1TXzAxMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEzACTvlBgSlMs
          dEhsF7tq5zxMhy1TCd8dR1IL8m2SB5JcCltnu+nl/8aZxijtKipdQw1a7Mrkn4Md
          futZpbh0wKNCMEAwDgYDVR0PAQH/BAQDAgeAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
          VR0OBBYEFKEIPEx3fnKRuiT29GZmkGOQQh4wMAoGCCqGSM49BAMCA0cAMEQCIGKF
          W6pEI7zto4pcRvPhfblucvbXxEC656udOEBV8AJMAiAL/+hYPlefdazPSmj91tQT
          DSj37FLjTb/AlTuaTwyNwg==
          -----END CERTIFICATE-----
{
  "charger": [
    {"id":31,"name":"db:31","type":"sgready-relay","config":{"yaml":"## required attributes [type: sgready-relay]

boost: # relay that switches the boost contact of the heat pump
  type: template
  template: shelly # example shelly one
  host: 192.168.178.200 #

## optional attributes

#dim: # relay that switches the dim contact of the heat pump
#  type: template
#  template: shelly # example shelly two
#  host: 192.168.0.102 #

power: # meter reading in W
  source: const
#  value: 1234
energy: # meter reading in kWh
#  source: const
#  value: 42.5
#temp: # current temperature (°C)
#  source: const
#  value: 42
#limittemp: # temperature limit (°C) configured in device
#  source: const
#  value: 84
"}},
    {"id":4,"name":"db:4","type":"template","config":{"template":"ellipro","ip":"192.168.178.69","ski":"***"},"deviceProduct":"Volkswagen ID. Charger Pro"}
  ],
  "country": "DE",
  "currency": "EUR",
  "eebus": {"config":{"certificate":{"private":"***","public":"***"},"port":4712,"shipid":"***"},"status":{"qr":"***","ski":"***1e30"}},
  "experimental": true,
  "gridExportLimit": 0,
  "influx": {"database":"evcc","insecure":true,"org":"frumms","password":"","token":"***","url":"http://localhost:8086/","user":""},
  "interval": 20,
  "loadpoints": [
    {"id":5,"name":"db:5","alwaysCharge":"off","batteryBoostLimit":100,"charger":"db:4","defaultMode":"smart","limitEnergy":0,"limitSoc":0,"maxCurrent":16,"minCurrent":6,"minSoc":0,"phasesConfigured":3,"planEnergy":0,"planPrecondition":0,"planStrategy":{"continuous":false,"precondition":0},"planTime":"0001-01-01T00:00:00Z","priority":0,"smartCostLimit":null,"smartFeedInPriorityLimit":null,"soc":{"estimate":true,"poll":{"interval":3600000000000,"mode":"charging"}},"solarShare":1,"thresholds":{"disable":{"delay":180000000000,"threshold":100},"enable":{"delay":60000000000,"threshold":-4200}},"title":"WB One","ui":{"maxTemp":0,"minTemp":0},"vehicle":"db:23"},
    {"id":32,"name":"db:32","alwaysCharge":"off","batteryBoostLimit":100,"charger":"db:31","defaultMode":"smart","limitEnergy":0,"limitSoc":0,"maxCurrent":7,"meter":"db:33","minCurrent":7,"minSoc":0,"phasesConfigured":1,"planEnergy":0,"planPrecondition":0,"planStrategy":{"continuous":false,"precondition":0},"planTime":"0001-01-01T00:00:00Z","priority":0,"smartCostLimit":null,"smartFeedInPriorityLimit":null,"soc":{"estimate":true,"poll":{"interval":3600000000000,"mode":"charging"}},"solarShare":1,"thresholds":{"disable":{"delay":180000000000,"threshold":500},"enable":{"delay":60000000000,"threshold":-2000}},"title":"WW WäPu","ui":{"maxTemp":75,"minTemp":55}}
  ],
  "meter": [
    {"id":20,"name":"db:20","type":"template","config":{"template":"shelly-1pm","host":"192.168.178.82","password":"***","usage":"charge","user":"***"},"deviceIcon":"dishwasher","deviceProduct":"Shelly Plug S","deviceTitle":"HWR"},
    {"id":33,"name":"db:33","type":"template","config":{"template":"shelly-1pm","channel":"1","host":"192.168.178.200","password":"***","usage":"charge","user":"***"},"deviceProduct":"Shelly Pro EM"},
    {"id":1,"name":"db:1","type":"template","config":{"id":1,"template":"solaredge-hybrid","baudrate":9600,"comset":"8N1","host":"192.168.178.35","maxacpower":"0","maxdischargepower":"5000","maxsoc":"100","minsoc":"0","modbus":"tcpip","port":1502,"timeout":10000000000,"usage":"grid","watchdog":"60s"},"deviceProduct":"SolarEdge Hybrid Inverter"},
    {"id":6,"name":"db:6","type":"template","config":{"id":1,"template":"solaredge-inverter","baudrate":9600,"comset":"8N1","host":"192.168.178.34","modbus":"tcpip","port":"502","usage":"pv"},"deviceProduct":"SolarEdge Wechselrichter","deviceTitle":"PV 3 - Dach"},
    {"id":7,"name":"db:7","type":"template","config":{"id":"2","template":"solaredge-hybrid","baudrate":9600,"comset":"8N1","host":"192.168.178.35","maxacpower":5000,"maxdischargepower":"5000","maxsoc":"100","minsoc":"0","modbus":"tcpip","port":1502,"usage":"pv","watchdog":"60s"},"deviceProduct":"SolarEdge Hybrid Inverter","deviceTitle":"PV 2 - Zaun"},
    {"id":2,"name":"db:2","type":"template","config":{"id":1,"template":"solaredge-hybrid","baudrate":9600,"comset":"8N1","host":"192.168.178.35","maxacpower":10000,"maxdischargepower":"5000","maxsoc":"100","minsoc":"0","modbus":"tcpip","port":1502,"timeout":10000000000,"usage":"pv","watchdog":"60s"},"deviceProduct":"SolarEdge Hybrid Inverter","deviceTitle":"PV 1 - Garage"},
    {"id":3,"name":"db:3","type":"template","config":{"id":1,"template":"solaredge-hybrid","baudrate":9600,"capacity":9.7,"comset":"8N1","host":"192.168.178.35","maxacpower":"0","maxchargepower":5000,"maxdischargepower":"5000","maxsoc":100,"minsoc":"0","modbus":"tcpip","port":1502,"timeout":10000000000,"usage":"battery","watchdog":"60s"},"deviceProduct":"SolarEdge Hybrid Inverter","deviceTitle":"Batterie 1 - Garage"},
    {"id":8,"name":"db:8","type":"template","config":{"id":"2","template":"solaredge-hybrid","baudrate":9600,"capacity":4.85,"comset":"8N1","host":"192.168.178.35","maxacpower":"0","maxchargepower":4600,"maxdischargepower":4600,"maxsoc":100,"minsoc":"0","modbus":"tcpip","port":1502,"usage":"battery","watchdog":"60s"},"deviceProduct":"SolarEdge Hybrid Inverter","deviceTitle":"Batterie 2 - Zaun"}
  ],
  "mqtt": {"broker":"","caCert":"","clientCert":"","clientID":"","clientKey":"","insecure":false,"password":"","topic":"evcc","user":""},
  "ocpp": {"config":{"port":8887},"status":{"stations":[]}},
  "ocppforwarder": {"config":[],"status":[]},
  "optimizer": true,
  "optimizerChargingStrategy": "charge_before_export",
  "remote": {"enabled":true},
  "residualPower": 0,
  "shm": {"deviceId":"","deviceSerial":"","vendorId":""},
  "site": {"aux":null,"battery":["db:3","db:8"],"consumer":["db:20"],"curtail":null,"ext":null,"grid":"db:1","pv":["db:2","db:6","db:7"],"title":"KVB"},
  "tariff": [
    {"id":10,"name":"db:10","type":"template","config":{"template":"fixed","price":0.08},"deviceProduct":"Fester Preis"},
    {"id":9,"name":"db:9","type":"template","config":{"template":"fixed","price":0.2793},"deviceProduct":"Fester Preis"},
    {"id":26,"name":"db:26","type":"template","config":{"template":"energypriceforecast-co2","horizon":"120","region":"DE"},"deviceProduct":"Energy Price Forecast EU CO₂"},
    {"id":13,"name":"db:13","type":"template","config":{"template":"open-meteo","ac":5,"alphatemp":-0.004,"az":23,"de":20,"dec":90,"dm":30,"efficiency":"100","interval":"1h","kwp":6.72,"lat":"***","lon":"***","model":"best_match","rossmodel":0.0342},"deviceProduct":"Open-Meteo","deviceTitle":"Zaun"},
    {"id":21,"name":"db:21","type":"template","config":{"template":"open-meteo-temperature","interval":"1h","lat":"***","lon":"***","model":"best_match"},"deviceProduct":"Open-Meteo Temperature"},
    {"id":12,"name":"db:12","type":"template","config":{"template":"open-meteo","ac":10,"alphatemp":"-0.004","az":23,"de":10,"dec":10,"dm":10,"efficiency":"100","interval":"1h","kwp":17.82,"lat":"***","lon":"***","model":"best_match","rossmodel":0.0563},"deviceProduct":"Open-Meteo","deviceTitle":"Garage"},
    {"id":11,"name":"db:11","type":"template","config":{"template":"open-meteo","ac":5000,"alphatemp":"-0.004","az":25,"de":25,"dec":42,"dm":25,"efficiency":"100","interval":"1h","kwp":5.4,"lat":"***","lon":"***","model":"best_match","rossmodel":0.0563},"deviceProduct":"Open-Meteo","deviceTitle":"Dach"}
  ],
  "tariffRefs": {"co2":"db:26","feedIn":"db:10","grid":"db:9","planner":"","solar":["db:11","db:12","db:13"],"temperature":"db:21"},
  "vehicle": [
    {"id":23,"name":"db:23","type":"template","config":{"template":"vw","autodetectdisabled":false,"cache":"5m","capacity":86,"climaterdisabled":false,"coarsecurrent":false,"icon":"bus","identifiers":["7078421052930374799"],"maxCurrent":16,"maxPower":11000,"minCurrent":6,"password":"***","phases":"3","priority":"","title":"ID.Buzz in weiß","user":"***","vin":"***","wakeupdisabled":false,"welcomecharge":false},"deviceProduct":"Volkswagen EU Data Act"}
  ]
}

Log details

[lp-2  ] DEBUG 2026/11/12 22:18:44 charge power: 0W
[lp-2  ] DEBUG 2026/11/12 22:18:44 charge currents: [0 0 0]A
[site  ] DEBUG 2026/11/12 22:18:44 pv 2 power: 0W
[site  ] DEBUG 2026/11/12 22:18:44 consumer 1 power: 0W
[site  ] DEBUG 2026/11/12 22:18:44 grid power: 30W
[site  ] DEBUG 2026/11/12 22:18:44 grid powers: [-4 -26 -6]W
[site  ] DEBUG 2026/11/12 22:18:44 grid currents: [-0.781 -0.812 -0.752]A
[site  ] DEBUG 2026/11/12 22:18:44 battery 2 power: 181W
[site  ] DEBUG 2026/11/12 22:18:45 battery 1 power: 220W
[site  ] DEBUG 2026/11/12 22:18:46 pv 3 power: -71W
[site  ] DEBUG 2026/11/12 22:18:47 pv 1 power: -73W
[site  ] DEBUG 2026/11/12 22:18:47 pv power: 0W
[site  ] DEBUG 2026/11/12 22:18:47 battery 1 soc: 57%
[site  ] DEBUG 2026/11/12 22:18:47 battery 2 soc: 49%
[site  ] DEBUG 2026/11/12 22:18:47 battery power: 401W
[site  ] DEBUG 2026/11/12 22:18:47 battery soc: 55%
[site  ] DEBUG 2026/11/12 22:18:47 site power: 531W
[lp-2  ] DEBUG 2026/11/12 22:18:47 charge voltages: [222 0 0]V
[lp-2  ] DEBUG 2026/11/12 22:18:47 detected connected phases: 1p
[lp-2  ] DEBUG 2026/11/12 22:18:47 charge total import: 0.000kWh
[lp-2  ] DEBUG 2026/11/12 22:18:47 charger status: B
[lp-2  ] DEBUG 2026/11/12 22:18:47 charge final energy: 0.000kWh
[lp-2  ] DEBUG 2026/11/12 22:18:47 charge total import: 0.000kWh
[lp-2  ] DEBUG 2026/11/12 22:18:47 !! plan: plan time zero
[lp-2  ] DEBUG 2026/11/12 22:18:47 pv charge current: 0A = 0A + -2.31A (531W @ 1p)

What type of operating system or environment does evcc run on?

Linux

External automation

  • [x] I have made sure that no external automation like HomeAssistant or Node-RED is active or accessing any of the mentioned devices when this issue occurs.

Nightly build

  • [x] I have verified that the issue is reproducible with the latest nightly build

Version

v0.319.0

frumms avatar Nov 15 '26 13:11 frumms

Thanks for the report. This is the re-filed version of #36157, which was closed automatically before the details were added.

The battery SoC forecast on the Battery tab comes from the optimizer plan (core/site_optimizer_result.go, addBatteryForecastTotals). It is a model result per battery, built from the PV forecast, the household load prediction and the tariffs, not a measurement. I can't tell yet whether the gap comes from the inputs (PV or load forecast), the battery configuration (capacity, charge/discharge limits, min/max SoC) or the optimizer itself. The flat 57% for battery 1 and the 100% further out could be a legitimate plan, for example holding the battery during a tariff window, or a real defect with two batteries.

To narrow it down, could you provide:

  • the forecast data for both batteries (e.g. from /api/state, the battery and forecast parts) at a time when the deviation is visible
  • the battery config (capacity, min/max SoC, charge/discharge limits, mode control) for both batteries
  • whether grid and feed-in tariffs are configured, and the current battery mode/strategy
  • a debug log covering an optimizer run (the pasted log only has a control loop cycle). You reported v0.319.0 but ticked the nightly checkbox, so please say which build you ran
  • one concrete example: forecast SoC at a given time versus the SoC actually reached

Related: #34323 (battery forecast reliability and missing AC charge/discharge limits).

🤖 Generated with Claude Code

github-actions[bot] avatar Nov 15 '26 13:11 github-actions[bot]

To narrow further down:

Regarding: the battery config (capacity, min/max SoC, charge/discharge limits, mode control) for both batteries:

     {"id":3,"name":"db:3","type":"template","config":{"id":1,"template":"solaredge-hybrid","baudrate":9600,"capacity":9.7,"comset":"8N1","host":"192.168.178.35","maxacpower":"0","maxchargepower":5000,"maxdischargepower":"5000","maxsoc":100,"minsoc":"0","modbus":"tcpip","port":1502,"timeout":10000000000,"usage":"battery","watchdog":"60s"},"deviceProduct":"SolarEdge Hybrid Inverter","deviceTitle":"Batterie 1 - Garage"},
    {"id":8,"name":"db:8","type":"template","config":{"id":"2","template":"solaredge-hybrid","baudrate":9600,"capacity":4.85,"comset":"8N1","host":"192.168.178.35","maxacpower":"0","maxchargepower":4600,"maxdischargepower":4600,"maxsoc":100,"minsoc":"0","modbus":"tcpip","port":1502,"usage":"battery","watchdog":"60s"},"deviceProduct":"SolarEdge Hybrid Inverter","deviceTitle":"Batterie 2 - Zaun"}

additionally some pictures:

Battery1 Battery2

frumms avatar Nov 15 '26 13:11 frumms

Thanks for the battery config (capacity, power limits and min/max SoC look unremarkable). Both batteries use the same Modbus host/port 192.168.178.35:1502 with different unit ids, which is fine in itself. The forecast is still the missing piece, so I can't name a cause yet. Please add:

  • the forecast data for both batteries from /api/state (the battery and forecast parts) captured while the deviation is visible
  • a debug log covering an optimizer run (the pasted log only shows a control loop cycle)
  • whether grid and feed-in tariffs are configured (the config references grid, feedIn and three solar forecasts) and the current battery mode
  • which build you ran: v0.319.0 or a nightly (both are ticked)
  • one concrete example: forecast SoC at a given time versus the SoC actually reached

Related: #34323 (battery forecast reliability).

🤖 Generated with Claude Code

github-actions[bot] avatar Nov 15 '26 13:11 github-actions[bot]

whether grid and feed-in tariffs are configured, and the current battery mode/strategy:

Yes, grid and feed-in tariffas are configured. Both with a fixed value. Current battery Mode and Strategy is "maximum self-consumption"

Tarrffs

frumms avatar Nov 15 '26 13:11 frumms

Thanks for the tariff and mode details. The forecast data is still missing, so I can't name a cause yet. Screenshots don't let us reproduce the plan. Please add:

  • the battery and forecast parts of /api/state (open http://<evcc>:7070/api/state and paste the JSON), captured while the deviation is visible
  • a debug log that covers an optimizer run (the one posted only shows a control loop cycle)
  • the build you ran: v0.319.0 or a nightly (the report ticks both)
  • one concrete example: forecast SoC at a given time versus the SoC actually reached

Observations from the config, not yet confirmed as causes:

  • The optimizer is enabled with charge_before_export. The forecast is a plan, so a flat SoC for battery 1 can be intended, for example when the plan holds it.
  • The Open-Meteo forecast Dach has ac: 5000. The template documents this value in kW, so it should probably be 5. Please check whether it affects the PV forecast.

🤖 Generated with Claude Code

github-actions[bot] avatar Nov 15 '26 13:11 github-actions[bot]

All right. I have adjusted the Open-Meteo forecast Dach from ac: 5000 to ac: 5. Will check forecast.

frumms avatar Nov 15 '26 13:11 frumms

Thanks, the ac: 5 correction for the Open-Meteo forecast Dach is a plausible fix for the PV input, since 5000 kW would not cap anything. Please let the optimizer run through a day with the corrected value and compare the forecast SoC again.

If the deviation persists, please add:

  • the battery and forecast parts of /api/state, captured while the deviation is visible
  • a debug log covering an optimizer run
  • one concrete example: forecast SoC at a given time versus the SoC actually reached

🤖 Generated with Claude Code

github-actions[bot] avatar Nov 15 '26 14:11 github-actions[bot]

Optimizer doesn't know how 2 physical batteries interact. It's projection can only be correct in terms of total values. We'll need to document this.

andig avatar Nov 15 '26 14:11 andig

Here comes the *.json for /api/state info.

evcc_state_2026-11-15_15-08.json

frumms avatar Nov 15 '26 14:11 frumms

Optimizer doesn't know how 2 physical batteries interact. It's projection can only be correct in terms of total values. We'll need to document this.

Hi @andig,

Ja vestehe ich, bei dem SolarEdge-system werden aber beide Batterien stets gleichzeitig entladen, sodass sich in der Vorhersage ein spezifischen Verhalten ableiten lassen würde. Die Entladeleistung erfolgt meiner Beobachtung zufolge anteilig zur spezifischen Kapazität. Entladeleistung gesamt: 300W Battery-Stack 1 (10kWh): 200W Battery-Stack 2 (5kWh): 100W

Aber ich verstehe, wenn das zu tief in die Abbildung / Projektion eines einzigen Herstellers mit einem bestimmten Hardware-Setup geht :-).

frumms avatar Nov 15 '26 14:11 frumms

Yep, so isses, zumindest für den Moment...

andig avatar Nov 15 '26 14:11 andig