diff --git a/vehicle/config.go b/vehicle/config.go index 15c1cce88..2da2f8afe 100644 --- a/vehicle/config.go +++ b/vehicle/config.go @@ -35,7 +35,11 @@ func NewFromConfig(ctx context.Context, typ string, other map[string]any) (api.V } if cc.Cloud { - cc.Other["brand"] = typ + // keep an explicit brand (e.g. drivesomethinggreater's Audi/Seat/...); + // otherwise the type itself is the brand (legacy per-brand vehicles) + if _, ok := cc.Other["brand"]; !ok { + cc.Other["brand"] = typ + } typ = "cloud" } diff --git a/vehicle/vw/eudataact/eudataact_test.go b/vehicle/vw/eudataact/eudataact_test.go index ba98df148..580364fcf 100644 --- a/vehicle/vw/eudataact/eudataact_test.go +++ b/vehicle/vw/eudataact/eudataact_test.go @@ -97,6 +97,12 @@ func TestResolveBrand(t *testing.T) { _, ok := resolveBrand("nope") assert.False(t, ok) + + // IsBrand drives the cloud server's brand -> drivesomethinggreater routing + for _, name := range []string{"audi", "Volkswagen", "seat", "CUPRA", "skoda"} { + assert.True(t, IsBrand(name), "%q is a VW group brand", name) + } + assert.False(t, IsBrand("tesla")) } func TestPending(t *testing.T) { diff --git a/vehicle/vw/eudataact/types.go b/vehicle/vw/eudataact/types.go index 7920322b7..6d17e73a3 100644 --- a/vehicle/vw/eudataact/types.go +++ b/vehicle/vw/eudataact/types.go @@ -38,6 +38,12 @@ func resolveBrand(name string) (brand, bool) { return brand{}, false } +// IsBrand reports whether name is a known VW group brand (case-insensitive) +func IsBrand(name string) bool { + _, ok := resolveBrand(name) + return ok +} + // Vehicle is a single entry of the portal vehicle list. VIN and name carry // several alternative field names depending on the response variant. type Vehicle struct {