From 8758fe0eadc01b8bc7f8475b0f809dff3ac72c66 Mon Sep 17 00:00:00 2001 From: andig Date: Sat, 30 Dec 2023 17:17:54 +0100 Subject: [PATCH] Loadpoint: don't disable at limitsoc 100% (#11348) --- core/loadpoint.go | 2 +- core/loadpoint_effective.go | 1 + core/loadpoint_effective_test.go | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 core/loadpoint_effective_test.go diff --git a/core/loadpoint.go b/core/loadpoint.go index 7b302e5b9..cff269709 100644 --- a/core/loadpoint.go +++ b/core/loadpoint.go @@ -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. diff --git a/core/loadpoint_effective.go b/core/loadpoint_effective.go index acc0f52d2..276947b64 100644 --- a/core/loadpoint_effective.go +++ b/core/loadpoint_effective.go @@ -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 } diff --git a/core/loadpoint_effective_test.go b/core/loadpoint_effective_test.go new file mode 100644 index 000000000..888ebca28 --- /dev/null +++ b/core/loadpoint_effective_test.go @@ -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()) +}