Skip to content

Commit

Permalink
Loadpoint: don't disable at limitsoc 100% (#11348)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Dec 30, 2023
1 parent 8ed21de commit 8758fe0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/loadpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions core/loadpoint_effective.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
13 changes: 13 additions & 0 deletions core/loadpoint_effective_test.go
Original file line number Diff line number Diff line change
@@ -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())
}

0 comments on commit 8758fe0

Please sign in to comment.