evcc-io/templates/definition/vehicle/tesla-ble.yaml

89 lines
3.1 KiB
YAML

template: tesla-ble
products:
- description:
generic: Tesla BLE
group: generic
requirements:
description:
de: Open Source Tesla BLE HTTP Proxy [github.com/wimaha/TeslaBleHttpProxy](https://github.com/wimaha/TeslaBleHttpProxy)
en: Open Source Tesla BLE HTTP Proxy [github.com/wimaha/TeslaBleHttpProxy](https://github.com/wimaha/TeslaBleHttpProxy)
params:
- preset: vehicle-common
- preset: vehicle-online
- name: vin
required: true
help:
de: Erforderlich für BLE-Verbindung
en: Required for BLE connection
- name: url
required: true
example: http://192.168.178.27
help:
de: URL des Tesla BLE HTTP Proxy
en: URL of the Tesla BLE HTTP Proxy
- name: port
example: 8080
default: 8080
help:
de: Port des Tesla BLE HTTP Proxy
en: Port of the Tesla BLE HTTP Proxy
- name: timeout
default: 30s
render: |
type: custom
{{- include "common" . }}
chargeEnable:
source: http
uri: {{ .url }}:{{ .port }}/api/1/vehicles/{{ .vin }}/command/{{`{{ if .chargeenable }}charge_start{{ else }}charge_stop{{ end }}`}}
method: POST
maxcurrent:
source: http
uri: {{ .url }}:{{ .port }}/api/1/vehicles/{{ .vin }}/command/set_charging_amps
method: POST
body: '{"charging_amps": ${maxcurrent}}'
wakeup:
source: http
uri: {{ .url }}:{{ .port }}/api/1/vehicles/{{ .vin }}/command/wake_up
method: POST
soc:
source: http
uri: {{ .url }}:{{ .port }}/api/1/vehicles/{{ .vin }}/vehicle_data?endpoints=charge_state
jq: .response.response.charge_state.battery_level
timeout: {{ .timeout }}
cache: 1s
getmaxcurrent:
source: http
uri: {{ .url }}:{{ .port }}/api/1/vehicles/{{ .vin }}/vehicle_data?endpoints=charge_state
jq: .response.response.charge_state.charge_amps
timeout: {{ .timeout }}
cache: 1s
limitsoc:
source: http
uri: {{ .url }}:{{ .port }}/api/1/vehicles/{{ .vin }}/vehicle_data?endpoints=charge_state
jq: .response.response.charge_state.charge_limit_soc
timeout: {{ .timeout }}
cache: 1s
range:
source: http
uri: {{ .url }}:{{ .port }}/api/1/vehicles/{{ .vin }}/vehicle_data?endpoints=charge_state
jq: .response.response.charge_state.battery_range
scale: 1.60934
timeout: {{ .timeout }}
cache: 1s
finishtime:
source: http
uri: {{ .url }}:{{ .port }}/api/1/vehicles/{{ .vin }}/vehicle_data?endpoints=charge_state
jq: 'if (.response.response.charge_state.minutes_to_full_charge > 0) then (now + (.response.response.charge_state.minutes_to_full_charge * 60) | strftime("%Y-%m-%dT%H:%M:%SZ")) else "" end'
timeout: {{ .timeout }}
cache: 1s
status:
source: http
uri: {{ .url }}:{{ .port }}/api/1/vehicles/{{ .vin }}/vehicle_data?endpoints=charge_state
jq: (if (.response.response.charge_state.charging_state == "Charging") then "C"
elif (.response.response.charge_state.charging_state == "Stopped") then "B"
elif (.response.response.charge_state.charging_state == "NoPower") then "B"
elif (.response.response.charge_state.charging_state == "Complete") then "B"
else "A" end)
timeout: {{ .timeout }}
cache: 1s
{{ include "features" . }}