From 8351a4471f74d8811e4bdb02e75c5a7b6d0ff8bb Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 10 Sep 2023 21:58:24 +0200 Subject: [PATCH] Fix target soc reached ignoring charger soc (#9827) --- core/loadpoint.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/loadpoint.go b/core/loadpoint.go index 40bed322b..62dd8aedb 100644 --- a/core/loadpoint.go +++ b/core/loadpoint.go @@ -798,10 +798,14 @@ func (lp *Loadpoint) targetEnergyReached() bool { } // targetSocReached checks if target is configured and reached. -// If vehicle is not configured this will always return false +// If vehicle is not configured this will always return false unless the +// charger is capable of and has provided an soc value. func (lp *Loadpoint) targetSocReached() bool { - return lp.vehicle != nil && - lp.Soc.target > 0 && + if _, ok := lp.charger.(api.Battery); lp.GetVehicle() == nil && !ok { + return false + } + + return lp.Soc.target > 0 && lp.Soc.target < 100 && lp.vehicleSoc >= float64(lp.Soc.target) }