From dc650fd4f1a76db0c390976bcf8a67689d01d608 Mon Sep 17 00:00:00 2001 From: Andreas Linde <42185+DerAndereAndi@users.noreply.github.com> Date: Thu, 9 Nov 2023 18:43:28 +0100 Subject: [PATCH] Planner: fix estimator disabled when soc provided by charger (#10698) When the vehicles SoC is provided by the charger, the planner currently assumes that the EV is not charged at all. This can be reproduced by setting a target Soc to be identical to the current, and the planner will show a charge time that would be needed to reach the current Soc. The reason is `s.vehicleSoc` in `estimator.go` not being set as `publichSocAndRange()` exits before setting it. --- core/loadpoint.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/loadpoint.go b/core/loadpoint.go index c7079a7cd..8651113d5 100644 --- a/core/loadpoint.go +++ b/core/loadpoint.go @@ -1384,7 +1384,7 @@ func (lp *Loadpoint) publishSocAndRange() { soc, err := lp.chargerSoc() // guard for socEstimator removed by api - if lp.socEstimator == nil || !lp.vehicleHasSoc() { + if lp.socEstimator == nil || (!lp.vehicleHasSoc() && err != nil) { // This is a workaround for heaters. Without vehicle, the soc estimator is not initialized. // We need to check if the charger can provide soc and use it if available. if err == nil {