Fix charging not stopped when energy limit reached (#8768)

This commit is contained in:
andig 2023-07-03 10:26:52 +02:00 • committed by GitHub
parent a249c864bc
commit 4655593b33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -746,7 +746,7 @@ func (lp *Loadpoint) setStatus(status api.ChargeStatus) {
// remainingChargeEnergy returns missing energy amount in kWh if vehicle has a valid energy target
func (lp *Loadpoint) remainingChargeEnergy() (float64, bool) {
return math.Max(0, lp.targetEnergy-lp.getChargedEnergy()/1e3),
lp.vehicleHasSoc() && lp.targetEnergy > 0
!lp.vehicleHasSoc() && lp.targetEnergy > 0
}
func (lp *Loadpoint) vehicleHasSoc() bool {