Loadpoint: don't disable at limitsoc 100% (#11348)

This commit is contained in:
andig 2023-12-30 17:17:54 +01:00 • committed by GitHub
parent 8ed21de3df
commit 8758fe0ead
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View file

@ -820,7 +820,7 @@ func (lp *Loadpoint) limitEnergyReached() bool {
// limitSocReached returns true if the effective limit has been reached
func (lp *Loadpoint) limitSocReached() bool {
limit := lp.effectiveLimitSoc()
return limit > 0 && lp.vehicleSoc >= float64(limit)
return limit > 0 && limit < 100 && lp.vehicleSoc >= float64(limit)
}
// minSocNotReached checks if minimum is configured and not reached.

View file

@ -110,6 +110,7 @@ func (lp *Loadpoint) effectiveLimitSoc() int {
}
}
// MUST return 100 here as UI looks at effectiveLimitSoc and not limitSoc (VehicleSoc.vue)
return 100
}

View file

@ -0,0 +1,13 @@
package core
import (
"testing"
"github.com/evcc-io/evcc/util"
"github.com/stretchr/testify/assert"
)
func TestEffectiveLimitSoc(t *testing.T) {
lp := NewLoadpoint(util.NewLogger("foo"), nil)
assert.Equal(t, 100, lp.effectiveLimitSoc())
}