Fix target soc reached ignoring charger soc (#9827)

This commit is contained in:
andig 2023-09-10 21:58:24 +02:00 • committed by GitHub
parent 05213638ae
commit 8351a4471f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}