Skip to content

Commit

Permalink
Fix target soc reached ignoring charger soc (evcc-io#9827)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Sep 10, 2023
1 parent 0521363 commit 8351a44
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/loadpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 8351a44

Please sign in to comment.