diff --git a/templates/definition/vehicle/iso15118.yaml b/templates/definition/vehicle/iso15118.yaml index fa6a8db96..3e44b5e06 100644 --- a/templates/definition/vehicle/iso15118.yaml +++ b/templates/definition/vehicle/iso15118.yaml @@ -20,6 +20,8 @@ params: - preset: vehicle-common - name: climaterdisabled deprecated: true + - name: autodetectdisabled + deprecated: true render: | type: custom {{ include "vehicle-common" . }} diff --git a/templates/definition/vehicle/offline.yaml b/templates/definition/vehicle/offline.yaml index dba4b88e4..6437c90e2 100644 --- a/templates/definition/vehicle/offline.yaml +++ b/templates/definition/vehicle/offline.yaml @@ -14,6 +14,8 @@ params: - name: welcomecharge - name: climaterdisabled deprecated: true + - name: autodetectdisabled + deprecated: true render: | type: custom {{- include "vehicle-common" . }} diff --git a/vehicle/template_test.go b/vehicle/template_test.go index 76dda1ae9..43451ffbc 100644 --- a/vehicle/template_test.go +++ b/vehicle/template_test.go @@ -1,6 +1,7 @@ package vehicle import ( + "strings" "testing" "github.com/evcc-io/evcc/api" @@ -40,3 +41,25 @@ func TestTemplates(t *testing.T) { } }) } + +// universalVehicleFeatures render via the shared vehicle-features include, so a +// stored config may carry them; dropping the param breaks reload (discussion #31291). +var universalVehicleFeatures = []string{"climaterdisabled", "autodetectdisabled"} + +func TestVehicleFeatureParamsConsistent(t *testing.T) { + for _, tmpl := range templates.ByClass(templates.Vehicle, templates.WithDeprecated()) { + if !strings.Contains(tmpl.Render, "vehicle-features") { + continue + } + + for _, feat := range universalVehicleFeatures { + values := tmpl.Defaults(templates.RenderModeUnitTest) + values["template"] = tmpl.Template + values[feat] = true + + if _, _, err := tmpl.RenderResult(templates.RenderModeInstance, values); err != nil { + t.Errorf("%s: feature %q must stay a declared param: %v", tmpl.Template, feat, err) + } + } + } +}