evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Big deviation SoC Polestar 2 - EVCC. This will cause it to stop charging

Open Bestevaer opened this issue 4 months ago • 3 comments

Describe the bug

EVCC instantly increased the SoC by 20ish procent points. This will cause it to surpass the SoC limit and it will stop charging. After a few seconds it will get a correct reading from the Polestar api, adjust the percentage in EVCC and start charging again.

This has happened 3 times today now.

Steps to reproduce

  1. The jump is around 20 percent. So when I am 20 procent point in the range of my charging limit this will happen.
  2. It is happening during fast charging.

...

Configuration details

EVCC version 3.10.1
In an proxmox lxc

Log details

[lp-1 ] DEBUG 2026/08/02 16:00:34 vehicle soc: 75%
[lp-1 ] DEBUG 2026/08/02 16:00:34 vehicle range: 300km
[lp-1 ] DEBUG 2026/08/02 16:00:34 soc estimated: 94.13% (vehicle: 75.00%)
[lp-1 ] DEBUG 2026/08/02 16:00:34 vehicle soc (estimator): 94%
[lp-1 ] DEBUG 2026/08/02 16:00:34 !! plan: required duration 0
[lp-1 ] DEBUG 2026/08/02 16:00:34 delete db:3 plan
[pushover] DEBUG 2026/08/02 16:00:34 sending to ***
[lp-1 ] DEBUG 2026/08/02 16:00:34 limitSoc reached: 94.1% > 80%
[lp-1 ] DEBUG 2026/08/02 16:00:34 charger disable
[site ] DEBUG 2026/08/02 16:00:34 solar forecast: produced 10.546kWh, forecasted 12.036kWh, scale 0.876
[site ] DEBUG 2026/08/02 16:01:03 ----
[lp-1 ] DEBUG 2026/08/02 16:01:03 charge power: 0W
[lp-1 ] DEBUG 2026/08/02 16:01:03 charge currents: [0.023 0.023 0.026]A
[oprit ] DEBUG 2026/08/02 16:01:03 power: 0W
[oprit ] DEBUG 2026/08/02 16:01:03 current: 0.026A
[hoofd ] DEBUG 2026/08/02 16:01:03 power: -2581W
[hoofd ] DEBUG 2026/08/02 16:01:03 current: 2A
[site ] DEBUG 2026/08/02 16:01:03 pv 1 power: 3082W
[site ] DEBUG 2026/08/02 16:01:03 grid power: -2581W
[site ] DEBUG 2026/08/02 16:01:03 grid powers: [395 111 -3082]W
[site ] DEBUG 2026/08/02 16:01:03 grid currents: [2 0 -12]A
[site ] DEBUG 2026/08/02 16:01:03 site power: -2581W
[lp-1 ] DEBUG 2026/08/02 16:01:03 charge voltages: [240 242 243]V
[lp-1 ] DEBUG 2026/08/02 16:01:03 charge total import: 946.727kWh
[lp-1 ] DEBUG 2026/08/02 16:01:04 charger status: B
[lp-1 ] DEBUG 2026/08/02 16:01:04 charge final energy: 37.868kWh
[lp-1 ] INFO 2026/08/02 16:01:04 stop charging <-
[pushover] DEBUG 2026/08/02 16:01:04 sending to ***
[lp-1 ] DEBUG 2026/08/02 16:01:04 charge total import: 946.727kWh
[lp-1 ] DEBUG 2026/08/02 16:01:04 vehicle soc: 78%
[lp-1 ] DEBUG 2026/08/02 16:01:04 vehicle range: 310km
[lp-1 ] DEBUG 2026/08/02 16:01:04 soc gradient updated: soc: 78.0%, socDiff: 51.0%, energyDiff: 37868Wh, energyPerSocStep: 742.5Wh, virtualCapacity: 78000Wh
[lp-1 ] DEBUG 2026/08/02 16:01:04 vehicle soc (estimator): 78%
[lp-1 ] DEBUG 2026/08/02 16:01:04 !! plan: plan time zero
[lp-1 ] DEBUG 2026/08/02 16:01:04 set charge current limit: 16A
[lp-1 ] DEBUG 2026/08/02 16:01:04 charger enable
[lp-1 ] DEBUG 2026/08/02 16:01:04 wake-up timer: start
[site ] DEBUG 2026/08/02 16:01:04 solar forecast: produced 10.546kWh, forecasted 12.036kWh, scale 0.876
[site ] DEBUG 2026/08/02 16:01:33 ----
[lp-1 ] DEBUG 2026/08/02 16:01:33 charge power: 1350W
[lp-1 ] DEBUG 2026/08/02 16:01:33 charge currents: [0.478 5.57 0.482]A

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

3.10.1

Bestevaer avatar Aug 02 '26 14:08 Bestevaer

Thanks for the detailed log — it shows the mechanism clearly.

What's happening: evcc doesn't just use the raw SoC reported by the vehicle API; it runs it through a linear estimator (core/soc/estimator.go) that extrapolates SoC between real API updates from charged energy, using a learned "Wh per SoC%" gradient (energyPerSocStep). Your log shows exactly this:

vehicle soc: 75%
soc estimated: 94.13% (vehicle: 75.00%)
...
limitSoc reached: 94.1% > 80%   -> charger disable
...
vehicle soc: 78%   (fresh value from Polestar API)
soc gradient updated: ... energyPerSocStep: 742.5Wh, virtualCapacity: 78000Wh
vehicle soc (estimator): 78%

The Polestar vehicle telemetry is cached for Cache (default 15 minutes, see vehicle/polestar.go / vehicle/polestar/provider.go), so while fast‑charging the reported SoC of 75% stays unchanged for up to 15 minutes while charged energy keeps accumulating in the background. The estimator then linearly projects the SoC forward using the previously learned energyPerSocStep, and during fast DC charging this projection can run far ahead of reality (here ~19 percentage points) before the next real API poll corrects it — in your case far enough to falsely trigger limitSoc reached and stop the charger prematurely.

This looks like a genuine defect in the estimator: it has no bound/sanity check against implausible SoC jumps within a short time window, so a stale energy gradient combined with a long vehicle-API poll interval can cause premature charge stops during fast charging. Fixing this properly likely needs some design discussion (e.g. capping the extrapolation, tightening the poll interval while charging fast, or cross-checking against reported range) rather than a one-line fix, so I'm not opening a PR for it.

cc @andig for visibility on the estimator behavior.

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 02 '26 14:08 github-actions[bot]

Required configuration missing.

mfuchs1984 avatar Aug 02 '26 14:08 mfuchs1984

If estimator does not work for your vehicle you can disable it.

andig avatar Aug 02 '26 14:08 andig