Skip to content

Commit

Permalink
Vehicles: refactor common properties (evcc-io#17650)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Dec 8, 2024
1 parent c273b1b commit 782f83c
Show file tree
Hide file tree
Showing 54 changed files with 136 additions and 412 deletions.
2 changes: 0 additions & 2 deletions templates/definition/vehicle/aiways.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ products:
- brand: Aiways
params:
- preset: vehicle-base
- preset: vehicle-identify
- name: vin
required: true
render: |
type: aiways
{{ include "vehicle-base" . }}
{{ include "vehicle-identify" . }}
2 changes: 0 additions & 2 deletions templates/definition/vehicle/audi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ products:
- brand: Audi
params:
- preset: vehicle-base
- preset: vehicle-identify
- name: vin
example: WAUZZZ...
render: |
type: etron
{{ include "vehicle-base" . }}
{{ include "vehicle-identify" . }}
21 changes: 3 additions & 18 deletions templates/definition/vehicle/bmw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,23 @@ requirements:
Requires `hcaptcha` token. This must be generated once at https://bimmer-connected.readthedocs.io/en/latest/captcha/rest_of_world.html. The token is only valid for a short time. Please copy it into the configuration and start evcc as soon as possible after generation.
params:
- preset: vehicle-base
- preset: vehicle-identify
- name: vin
example: WBMW...
- name: region
description:
de: Region
en: Region
# values:
# - NA
# - EU
validvalues: ["NA", "EU"]
default: EU
advanced: true
- name: coarsecurrent
advanced: true
- name: welcomecharge
advanced: true
- name: hcaptcha
required: true
- preset: vehicle-features
render: |
type: bmw
{{ include "vehicle-base" . }}
{{ include "vehicle-identify" . }}
{{- if ne .region "EU" }}
region: {{ .region }}
{{- end }}
{{- if or (eq .coarsecurrent "true") (eq .welcomecharge "true") }}
features:
{{- if eq .coarsecurrent "true" }}
- coarsecurrent
{{- end }}
{{- if eq .welcomecharge "true" }}
- welcomecharge
{{- end }}
{{- end }}
{{ include "vehicle-features" . }}
hcaptcha: {{ .hcaptcha }}
2 changes: 0 additions & 2 deletions templates/definition/vehicle/carwings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ products:
generic: Leaf (pre 2019)
params:
- preset: vehicle-base
- preset: vehicle-identify
render: |
type: carwings
{{ include "vehicle-base" . }}
{{ include "vehicle-identify" . }}
13 changes: 4 additions & 9 deletions templates/definition/vehicle/citroen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ requirements:
en: |
Requires `access` and `refresh` tokens. These can be generated with command `evcc token [name]`.
params:
- name: title
- name: icon
default: car
advanced: true
- preset: vehicle-common
- name: user
required: true
- name: password
Expand All @@ -24,10 +21,8 @@ params:
mask: true
- name: vin
example: V...
- name: capacity
- name: phases
advanced: true
- preset: vehicle-identify
- name: cache
default: 15m
render: |
type: citroen
vin: {{ .vin }}
Expand All @@ -36,4 +31,4 @@ render: |
access: {{ .accessToken }}
refresh: {{ .refreshToken }}
{{ include "vehicle-common" . }}
{{ include "vehicle-identify" . }}
cache: {{ .cache }}
9 changes: 2 additions & 7 deletions templates/definition/vehicle/dacia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@ products:
- brand: Dacia
params:
- preset: vehicle-base
- preset: vehicle-identify
- name: welcomecharge
advanced: true
- preset: vehicle-features
render: |
type: dacia
{{ include "vehicle-base" . }}
{{ include "vehicle-identify" . }}
{{- if eq .welcomecharge "true" }}
features: ["welcomecharge"]
{{- end }}
{{ include "vehicle-features" . }}
13 changes: 4 additions & 9 deletions templates/definition/vehicle/ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ requirements:
en: |
Requires `access` and `refresh` tokens. These can be generated with command `evcc token [name]`.
params:
- name: title
- name: icon
default: car
advanced: true
- preset: vehicle-common
- name: user
required: true
- name: password
Expand All @@ -24,10 +21,8 @@ params:
mask: true
- name: vin
example: V...
- name: capacity
- name: phases
advanced: true
- preset: vehicle-identify
- name: cache
default: 15m
render: |
type: ds
vin: {{ .vin }}
Expand All @@ -36,4 +31,4 @@ render: |
access: {{ .accessToken }}
refresh: {{ .refreshToken }}
{{ include "vehicle-common" . }}
{{ include "vehicle-identify" . }}
cache: {{ .cache }}
13 changes: 2 additions & 11 deletions templates/definition/vehicle/evnotify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,15 @@ products:
generic: evNotify
group: generic
params:
- name: title
- name: icon
default: car
advanced: true
- name: akey
required: true
- name: token
required: true
- name: capacity
type: float
- name: phases
advanced: true
- preset: vehicle-identify
- preset: vehicle-common
render: |
type: custom
{{ include "vehicle-common" . }}
soc:
source: http
uri: https://app.evnotify.de/soc?akey={{ urlEncode .akey }}&token={{ urlEncode .token }} # evNotify Server + AKEY
uri: https://app.evnotify.de/soc?akey={{ urlEncode .akey }}&token={{ urlEncode .token }}
jq: .soc_display
{{ include "vehicle-identify" . }}
9 changes: 2 additions & 7 deletions templates/definition/vehicle/fiat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ params:
example: ZFAE...
- name: pin
mask: true
- preset: vehicle-identify
- name: welcomecharge
advanced: true
- preset: vehicle-features
render: |
type: fiat
{{ include "vehicle-base" . }}
{{- if .pin }}
pin: {{ .pin }} # mandatory to deep refresh Soc
{{- end }}
{{ include "vehicle-identify" . }}
{{- if eq .welcomecharge "true" }}
features: ["welcomecharge"]
{{- end }}
{{ include "vehicle-features" . }}
32 changes: 5 additions & 27 deletions templates/definition/vehicle/flobz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,25 @@ requirements:
description:
generic: Remote Control of PSA car https://github.com/flobz/psa_car_controller
params:
- name: title
- name: icon
default: car
advanced: true
- name: url
required: true
example: http://192.0.2.2
required: true
- name: vin
required: true
- preset: vehicle-common
- name: host
deprecated: true
- name: port
deprecated: true
- name: vin
required: true
help:
de: Erforderlich
en: Required
- name: capacity
- name: phases
advanced: true
- name: wakeup_alt
help:
de: alternativer wakeup-Code; könnte zu erhöhter Entladung der 12V-Batterie führen.
en: alternative wakeup-code; could lead to increased discharge of the 12V battery.
default: false
advanced: true
- preset: vehicle-identify
render: |
type: custom
{{- if .title }}
title: {{ .title }}
{{- end }}
{{- if .icon }}
icon: {{ .icon }}
{{- end }}
{{- if .capacity }}
capacity: {{ .capacity }}
{{- end }}
{{- if .phases }}
phases: {{ .phases }}
{{- end }}
{{- include "vehicle-identify" . }}
{{- include "vehicle-common" . }}
soc:
{{- include "source" . | indent 2 }}
jq: .energy[0].level
Expand Down
14 changes: 4 additions & 10 deletions templates/definition/vehicle/ford-connect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ template: ford-connect
products:
- brand: Ford
params:
- name: title
- name: icon
default: car
advanced: true
- preset: vehicle-common
- name: clientid
description:
generic: FordConnect API Client ID
Expand All @@ -28,11 +25,8 @@ params:
mask: true
- name: vin
example: WF0FXX...
- name: capacity
default: 10
- name: phases
advanced: true
- preset: vehicle-identify
- name: cache
default: 15m
render: |
type: ford-connect
vin: {{ .vin }}
Expand All @@ -43,4 +37,4 @@ render: |
access: {{ .accessToken }}
refresh: {{ .refreshToken }}
{{ include "vehicle-common" . }}
{{ include "vehicle-identify" . }}
cache: {{ .cache }}
2 changes: 0 additions & 2 deletions templates/definition/vehicle/ford.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ products:
- brand: Ford
params:
- preset: vehicle-base
- preset: vehicle-identify
- name: vin
example: WF0FXX...
- name: domain
Expand All @@ -13,5 +12,4 @@ params:
render: |
type: ford
{{ include "vehicle-base" . }}
{{ include "vehicle-identify" . }}
domain: {{ .domain }}
2 changes: 0 additions & 2 deletions templates/definition/vehicle/hyundai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ requirements:
params:
- preset: vehicle-base
- preset: vehicle-language
- preset: vehicle-identify
render: |
type: hyundai
{{ include "vehicle-base" . }}
{{ include "vehicle-language" . }}
{{ include "vehicle-identify" . }}
26 changes: 3 additions & 23 deletions templates/definition/vehicle/ioBroker.bmw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,9 @@ requirements:
en: ioBroker BMW Adapter. Requires ioBroker.bmw and ioBroker.simple-api
de: ioBroker BMW Adapter. Benötigt ioBroker.bmw und ioBroker.simple-api
params:
- name: title
- name: icon
default: car
advanced: true
- name: capacity
type: float
- name: phases
advanced: true
- preset: vehicle-common
- name: vin
example: WBMW...
- preset: vehicle-identify
- name: uri
help:
generic: ioBroker URL
Expand All @@ -29,14 +21,10 @@ params:
de: Instanz-ID
en: Instance ID
advanced: true
- name: coarsecurrent
advanced: true
- name: welcomecharge
advanced: true
- preset: vehicle-features
render: |
type: custom
{{ include "vehicle-common" . }}
{{ include "vehicle-identify" . }}
soc:
source: http
uri: {{ .uri }}/getPlainValue/bmw.{{ .id }}.{{ .vin }}.state.electricChargingState.chargingLevelPercent
Expand All @@ -55,12 +43,4 @@ render: |
odometer:
source: http
uri: {{ .uri }}/getPlainValue/bmw.{{ .id }}.{{ .vin }}.state.currentMileage
{{- if or (eq .coarsecurrent "true") (eq .welcomecharge "true") }}
features:
{{- if eq .coarsecurrent "true" }}
- coarsecurrent
{{- end }}
{{- if eq .welcomecharge "true" }}
- welcomecharge
{{- end }}
{{- end }}
{{ include "vehicle-features" . }}
10 changes: 1 addition & 9 deletions templates/definition/vehicle/iso15118.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,11 @@ requirements:
This requires an active location-based charging profile with the lowest minimum charge (25%) and direct charging disabled.
Otherwise the vehicle cannot be put into sleep mode.
params:
- name: title
- name: icon
default: car
advanced: true
- name: capacity
- name: phases
advanced: true
- preset: vehicle-identify
- preset: vehicle-common
render: |
type: custom
{{- include "vehicle-common" . }}
features: ["offline"]
soc:
source: const
value: 0
{{ include "vehicle-identify" . }}
2 changes: 0 additions & 2 deletions templates/definition/vehicle/jaguar-landrover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ products:
- brand: Land Rover
params:
- preset: vehicle-base
- preset: vehicle-identify
render: |
type: jaguar
{{ include "vehicle-base" . }}
{{ include "vehicle-identify" . }}
2 changes: 0 additions & 2 deletions templates/definition/vehicle/kia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ requirements:
params:
- preset: vehicle-base
- preset: vehicle-language
- preset: vehicle-identify
render: |
type: kia
{{ include "vehicle-base" . }}
{{ include "vehicle-language" . }}
{{ include "vehicle-identify" . }}
Loading

0 comments on commit 782f83c

Please sign in to comment.