Vehicle: add autodetectdisabled feature (#30941)
This commit is contained in:
parent
95868686a0
commit
1056e85af2
6 changed files with 40 additions and 19 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package coordinator
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"sync"
|
||||
|
||||
"github.com/evcc-io/evcc/api"
|
||||
|
|
@ -116,7 +117,7 @@ func (c *Coordinator) availableDetectibleVehicles(owner loadpoint.API) []api.Veh
|
|||
|
||||
for _, vv := range c.vehicles {
|
||||
// status api available
|
||||
if api.HasCap[api.ChargeState](vv) {
|
||||
if api.HasCap[api.ChargeState](vv) && !slices.Contains(vv.Features(), api.AutodetectDisabled) {
|
||||
// available or associated to current loadpoint
|
||||
if o, ok := c.tracked[vv]; o == owner || !ok {
|
||||
res = append(res, vv)
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ func TestVehicleDetectByStatus(t *testing.T) {
|
|||
v2.MockVehicle.EXPECT().GetTitle().Return("v2").AnyTimes()
|
||||
v1.MockVehicle.EXPECT().Identifiers().Return(nil).AnyTimes()
|
||||
v2.MockVehicle.EXPECT().Identifiers().Return([]string{"it's me"}).AnyTimes()
|
||||
v1.MockVehicle.EXPECT().Features().Return(nil).AnyTimes()
|
||||
v2.MockVehicle.EXPECT().Features().Return(nil).AnyTimes()
|
||||
|
||||
var lp loadpoint.API
|
||||
c := New(log, vehicles)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue