Skip to content

Commit 00e8d4c

Browse files
authored
HomeAssistant: fix deprecated home parameter not rendered (#25849)
1 parent 03e2e0e commit 00e8d4c

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

templates/definition/charger/homeassistant-switch.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ params:
4242
render: |
4343
type: homeassistant-switch
4444
uri: {{ .uri }}
45+
home: {{ .home }} # deprecated
4546
enable: {{ .switch }}
4647
power: {{ .power }}
4748
{{ include "switchsocket" . }}

templates/definition/meter/homeassistant.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ params:
125125
render: |
126126
type: homeassistant
127127
uri: {{ .uri }}
128+
home: {{ .home }} # deprecated
128129
power: {{ .power }}
129130
energy: {{ .energy }}
130131
currents:

templates/definition/vehicle/homeassistant.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ render: |
100100
{{ include "vehicle-common" . }}
101101
{{ include "vehicle-features" . }}
102102
uri: {{ .uri }}
103+
home: {{ .home }} # deprecated
103104
sensors:
104105
soc: {{ .soc }}
105106
range: {{ .range }}

util/templates/template.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ func (t *Template) RenderResult(renderMode int, other map[string]any) ([]byte, m
311311
// The actual key name is taken from the parameter to make it unique.
312312
// Since predefined properties are not matched by actual parameters using
313313
// ParamByName(), the lower case key name is used instead.
314-
// All keys *must* be assigned or rendering will create "<no value>" artifacts.
314+
// All keys *must* be assigned or rendering will create "<no value>" artifacts. For this reason,
315+
// deprecated parameters (that may still be rendered) must be evaluated, too.
315316

316317
for key, val := range values {
317318
out := strings.ToLower(key)
@@ -321,8 +322,6 @@ func (t *Template) RenderResult(renderMode int, other map[string]any) ([]byte, m
321322
if !slices.Contains(predefinedTemplateProperties, out) {
322323
return nil, values, fmt.Errorf("invalid key: %s", key)
323324
}
324-
} else if p.IsDeprecated() {
325-
continue
326325
} else {
327326
out = p.Name
328327
}

0 commit comments

Comments
 (0)