Planner: fix estimator disabled when soc provided by charger (#10698)
Some checks failed
Release / call-build-workflow (push) Has been cancelled
Release / Publish Docker :release (push) Has been cancelled
Release / Github & APT (push) Has been cancelled
Release / Demo (push) Has been cancelled
Release / Hassio Addon (push) Has been cancelled

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.
This commit is contained in:
Andreas Linde 2023-11-09 18:43:28 +01:00 • committed by GitHub
parent 5453820eb6
commit dc650fd4f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {