Vehicle: add autodetectdisabled feature (#30941)

This commit is contained in:
Markus Kaindl 2026-06-17 21:45:09 +02:00 • committed by GitHub
parent 95868686a0
commit 1056e85af2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 19 deletions

View file

@ -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)

View file

@ -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)