From 7d7268cad68f359f91ae1d1393e18cb8dfcab411 Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 25 Jan 2026 20:21:59 +0100 Subject: [PATCH] chore: align implementations (#26999) --- .../definition/charger/tinkerforge-warp.yaml | 2 +- .../charger/tinkerforge-warp3-smart.yaml | 2 +- .../definition/charger/tinkerforge-warp3.yaml | 2 +- templates/definition/vehicle/mg2mqtt.yaml | 15 ++++++++------- templates/definition/vehicle/teslamate.yaml | 15 +++++++++------ vehicle/template_test.go | 1 + 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/templates/definition/charger/tinkerforge-warp.yaml b/templates/definition/charger/tinkerforge-warp.yaml index 4bfb4310a..61d74a1f9 100644 --- a/templates/definition/charger/tinkerforge-warp.yaml +++ b/templates/definition/charger/tinkerforge-warp.yaml @@ -27,7 +27,7 @@ params: en: WEM Firmware v2 required. render: | type: warp2 - {{ include "mqtt" . }} + {{- include "mqtt" . }} topic: {{ .topic }} {{- if .energymanager }} energymanager: {{ .energymanager }} diff --git a/templates/definition/charger/tinkerforge-warp3-smart.yaml b/templates/definition/charger/tinkerforge-warp3-smart.yaml index 2f114c0f0..e28f2387f 100644 --- a/templates/definition/charger/tinkerforge-warp3-smart.yaml +++ b/templates/definition/charger/tinkerforge-warp3-smart.yaml @@ -12,6 +12,6 @@ params: default: warp render: | type: warp2 - {{ include "mqtt" . }} + {{- include "mqtt" . }} topic: {{ .topic }} energymanager: {{ .topic }} diff --git a/templates/definition/charger/tinkerforge-warp3.yaml b/templates/definition/charger/tinkerforge-warp3.yaml index b1abe3fe2..656dd292f 100644 --- a/templates/definition/charger/tinkerforge-warp3.yaml +++ b/templates/definition/charger/tinkerforge-warp3.yaml @@ -15,6 +15,6 @@ params: default: warp render: | type: warp2 - {{ include "mqtt" . }} + {{- include "mqtt" . }} topic: {{ .topic }} energymanager: {{ .topic }} diff --git a/templates/definition/vehicle/mg2mqtt.yaml b/templates/definition/vehicle/mg2mqtt.yaml index 0acacc80d..90373afbb 100644 --- a/templates/definition/vehicle/mg2mqtt.yaml +++ b/templates/definition/vehicle/mg2mqtt.yaml @@ -8,6 +8,7 @@ requirements: en: Required MQTT broker configuration and a SAIC/MQTT Gateway (https://github.com/SAIC-iSmart-API/saic-python-mqtt-gateway or https://github.com/SAIC-iSmart-API/saic-java-client) de: Voraussetzung ist ein konfigurierter MQTT Broker und ein SAIC/MQTT Gateway (https://github.com/SAIC-iSmart-API/saic-python-mqtt-gateway oder https://github.com/SAIC-iSmart-API/saic-java-client) params: + - preset: mqtt - name: user required: true - name: vin @@ -20,22 +21,22 @@ render: | {{- include "vehicle-common" . }} soc: # battery soc (%) source: mqtt + {{- include "mqtt" . | indent 2 }} topic: saic/{{ .user }}/vehicles/{{ .vin }}/drivetrain/soc - timeout: {{ .timeout }} status: source: combined plugged: source: mqtt + {{- include "mqtt" . | indent 4 }} topic: saic/{{ .user }}/vehicles/{{ .vin }}/drivetrain/chargerConnected - timeout: {{ .timeout }} charging: source: mqtt + {{- include "mqtt" . | indent 4 }} topic: saic/{{ .user }}/vehicles/{{ .vin }}/drivetrain/charging - timeout: {{ .timeout }} range: source: mqtt + {{- include "mqtt" . | indent 2 }} topic: saic/{{ .user }}/vehicles/{{ .vin }}/drivetrain/range - timeout: {{ .timeout }} climater: source: go script: | @@ -45,12 +46,12 @@ render: | type: string config: source: mqtt + {{- include "mqtt" . | indent 8 }} topic: saic/{{ .user }}/vehicles/{{ .vin }}/climate/remoteClimateState - timeout: {{ .timeout }} odometer: source: mqtt + {{- include "mqtt" . | indent 2 }} topic: saic/{{ .user }}/vehicles/{{ .vin }}/drivetrain/mileage - timeout: {{ .timeout }} wakeup: source: go script: | @@ -60,5 +61,5 @@ render: | type: string config: source: mqtt + {{- include "mqtt" . | indent 8 }} topic: saic/{{ .user }}/vehicles/{{ .vin }}/refresh/mode/set - timeout: {{ .timeout }} diff --git a/templates/definition/vehicle/teslamate.yaml b/templates/definition/vehicle/teslamate.yaml index f0225b144..c9d9f570b 100644 --- a/templates/definition/vehicle/teslamate.yaml +++ b/templates/definition/vehicle/teslamate.yaml @@ -8,40 +8,43 @@ requirements: en: Open source Tesla data logger [github.com/adriankumpf/teslamate](https://github.com/adriankumpf/teslamate). MQTT broker required. de: Open Source Tesla Datenlogger [github.com/adriankumpf/teslamate](https://github.com/adriankumpf/teslamate). Voraussetzung ist konfigurierter MQTT Broker. params: + - preset: mqtt - preset: vehicle-common - name: id description: de: Fahrzeug-ID en: Vehicle ID default: 1 + - name: timeout + default: 720h # 30d render: | type: custom {{- include "vehicle-common" . }} soc: source: mqtt + {{- include "mqtt" . | indent 2 }} topic: teslamate/cars/{{ .id }}/battery_level - timeout: 720h # 30d status: source: combined plugged: source: mqtt + {{- include "mqtt" . | indent 4 }} topic: teslamate/cars/{{ .id }}/plugged_in - timeout: 720h # 30d charging: source: mqtt + {{- include "mqtt" . | indent 4 }} topic: teslamate/cars/{{ .id }}/charger_actual_current - timeout: 720h # 30d jq: . > 0 range: source: mqtt + {{- include "mqtt" . | indent 2 }} topic: teslamate/cars/{{ .id }}/rated_battery_range_km - timeout: 720h # 30d odometer: source: mqtt + {{- include "mqtt" . | indent 2 }} topic: teslamate/cars/{{ .id }}/odometer - timeout: 720h # 30d limitsoc: source: mqtt + {{- include "mqtt" . | indent 2 }} topic: teslamate/cars/{{ .id }}/charge_limit_soc - timeout: 720h features: ["coarsecurrent"] diff --git a/vehicle/template_test.go b/vehicle/template_test.go index 1364ecfb8..9f49f3627 100644 --- a/vehicle/template_test.go +++ b/vehicle/template_test.go @@ -26,6 +26,7 @@ var acceptable = []string{ "discussions/17501", // Tesla "login failed: code not found", // Polestar "empty instance type- check for missing usage", // Mercedes + "connect: connection refused", // MQTT } func TestTemplates(t *testing.T) {