Vehicles: collect common properties in includeable template (#14245)

This commit is contained in:
andig 2024-06-08 14:03:38 +02:00 • committed by GitHub
parent 86f2502c19
commit 62a1e223b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 29 additions and 60 deletions

View file

@ -36,13 +36,9 @@ params:
- preset: vehicle-identify
render: |
type: citroen
title: {{ .title }}
icon: {{ .icon }}
{{ include "vehicle-common" . }}
user: {{ .user }}
tokens:
access: {{ .accessToken }}
refresh: {{ .refreshToken }}
capacity: {{ .capacity }}
phases: {{ .phases }}
vin: {{ .vin }}
{{ include "vehicle-identify" . }}

View file

@ -36,13 +36,9 @@ params:
- preset: vehicle-identify
render: |
type: ds
title: {{ .title }}
icon: {{ .icon }}
{{ include "vehicle-common" . }}
user: {{ .user }}
tokens:
access: {{ .accessToken }}
refresh: {{ .refreshToken }}
capacity: {{ .capacity }}
phases: {{ .phases }}
vin: {{ .vin }}
{{ include "vehicle-identify" . }}

View file

@ -41,13 +41,11 @@ params:
- preset: vehicle-identify
render: |
type: ford-connect
{{ include "vehicle-common" . }}
credentials:
id: {{ .clientid }}
secret: {{ .clientsecret }}
tokens:
access: {{ .accessToken }}
refresh: {{ .refreshToken }}
vin: {{ .vin }}
capacity: {{ .capacity }}
phases: {{ .phases }}
{{ include "vehicle-identify" . }}

View file

@ -38,13 +38,9 @@ params:
- preset: vehicle-identify
render: |
type: mercedes
title: {{ .title }}
icon: {{ .icon }}
{{ include "vehicle-common" . }}
user: {{ .user }}
tokens:
access: {{ .accessToken }}
refresh: {{ .refreshToken }}
capacity: {{ .capacity }}
phases: {{ .phases }}
vin: {{ .vin }}
{{ include "vehicle-identify" . }}

View file

@ -36,13 +36,9 @@ params:
- preset: vehicle-identify
render: |
type: opel
title: {{ .title }}
icon: {{ .icon }}
{{ include "vehicle-common" . }}
user: {{ .user }}
tokens:
access: {{ .accessToken }}
refresh: {{ .refreshToken }}
capacity: {{ .capacity }}
phases: {{ .phases }}
vin: {{ .vin }}
{{ include "vehicle-identify" . }}

View file

@ -36,13 +36,9 @@ params:
- preset: vehicle-identify
render: |
type: peugeot
title: {{ .title }}
icon: {{ .icon }}
{{ include "vehicle-common" . }}
user: {{ .user }}
tokens:
access: {{ .accessToken }}
refresh: {{ .refreshToken }}
capacity: {{ .capacity }}
phases: {{ .phases }}
vin: {{ .vin }}
{{ include "vehicle-identify" . }}

View file

@ -40,13 +40,9 @@ params:
- preset: vehicle-identify
render: |
type: tesla
title: {{ .title }}
icon: {{ .icon }}
{{ include "vehicle-common" . }}
tokens:
access: {{ .accessToken }}
refresh: {{ .refreshToken }}
capacity: {{ .capacity }}
phases: {{ .phases }}
vin: {{ .vin }}
{{ include "vehicle-identify" . }}
features: ["coarsecurrent"]

View file

@ -33,16 +33,8 @@ params:
- preset: vehicle-identify
render: |
type: tronity
{{- if .title }}
title: {{ .title }}
{{- end }}
{{- if .icon }}
icon: {{ .icon }}
{{- end }}
{{ include "vehicle-common" . }}
credentials:
id: {{ .clientid }}
secret: {{ .clientsecret }}
vin: {{ .vin }}
capacity: {{ .capacity }}
phases: {{ .phases }}
{{ include "vehicle-identify" . }}

View file

@ -1,22 +1,5 @@
{{ define "vehicle-base" }}
{{- if .title }}
title: {{ .title }}
{{- end }}
{{- if .icon }}
icon: {{ .icon }}
{{- end }}
user: {{ .user }}
password: {{ .password }}
{{- if .capacity }}
capacity: {{ .capacity }}
{{- end }}
{{- if .vin }}
vin: {{ .vin }}
{{- end }}
{{- if .phases }}
phases: {{ .phases }}
{{- end }}
{{- if .cache }}
cache: {{ .cache }}
{{- end }}
{{ template "vehicle-common" . }}
{{- end }}

View file

@ -0,0 +1,20 @@
{{ define "vehicle-common" }}
{{- if .title }}
title: {{ .title }}
{{- end }}
{{- if .icon }}
icon: {{ .icon }}
{{- end }}
{{- if .capacity }}
capacity: {{ .capacity }}
{{- end }}
{{- if .vin }}
vin: {{ .vin }}
{{- end }}
{{- if .phases }}
phases: {{ .phases }}
{{- end }}
{{- if .cache }}
cache: {{ .cache }}
{{- end }}
{{- end }}