Add MG mqtt gateway template (#8069)
needs: * a configured MQTT broker * a SAIC/MQTT Gateway (https://github.com/SAIC-iSmart-API/saic-python-mqtt-gateway or https://github.com/SAIC-iSmart-API/saic-java-client)
This commit is contained in:
parent
c9ed79e383
commit
c398973357
5 changed files with 122 additions and 7 deletions
|
|
@ -63,7 +63,7 @@ func NewConfigurableFromConfig(other map[string]interface{}) (api.Charger, error
|
|||
|
||||
c.embed = &cc.embed
|
||||
|
||||
// decorator phases
|
||||
// decorate phases
|
||||
var phases1p3p func(int) error
|
||||
if cc.Phases1p3p != nil {
|
||||
phases1p3pS, err := provider.NewIntSetterFromConfig("phases", *cc.Phases1p3p)
|
||||
|
|
@ -76,7 +76,7 @@ func NewConfigurableFromConfig(other map[string]interface{}) (api.Charger, error
|
|||
}
|
||||
}
|
||||
|
||||
// decorator identifier
|
||||
// decorate identifier
|
||||
var identify func() (string, error)
|
||||
if cc.Identify != nil {
|
||||
identify, err = provider.NewStringGetterFromConfig(*cc.Identify)
|
||||
|
|
|
|||
84
templates/definition/vehicle/mg2mqtt.yaml
Normal file
84
templates/definition/vehicle/mg2mqtt.yaml
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
template: mg2mqtt
|
||||
products:
|
||||
- brand: MG
|
||||
description:
|
||||
generic: Publish all MG iSmart Car Data to MQTT (mg2mqtt)
|
||||
requirements:
|
||||
description:
|
||||
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:
|
||||
- name: title
|
||||
- name: user
|
||||
required: true
|
||||
- name: vin
|
||||
required: true
|
||||
- name: capacity
|
||||
- name: phases
|
||||
advanced: true
|
||||
- name: icon
|
||||
default: car
|
||||
advanced: true
|
||||
- name: timeout
|
||||
default: 1h
|
||||
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" . }}
|
||||
soc: # battery soc (%)
|
||||
source: mqtt
|
||||
topic: saic/{{ .user }}/vehicles/{{ .vin }}/drivetrain/soc
|
||||
timeout: {{ .timeout }}
|
||||
status:
|
||||
source: combined
|
||||
plugged:
|
||||
source: mqtt
|
||||
topic: saic/{{ .user }}/vehicles/{{ .vin }}/drivetrain/chargerConnected
|
||||
timeout: {{ .timeout }}
|
||||
charging:
|
||||
source: mqtt
|
||||
topic: saic/{{ .user }}/vehicles/{{ .vin }}/drivetrain/charging
|
||||
timeout: {{ .timeout }}
|
||||
range:
|
||||
source: mqtt
|
||||
topic: saic/{{ .user }}/vehicles/{{ .vin }}/drivetrain/range
|
||||
timeout: {{ .timeout }}
|
||||
climater:
|
||||
source: go
|
||||
script: |
|
||||
remoteClimateState != "off"
|
||||
in:
|
||||
- name: remoteClimateState
|
||||
type: string
|
||||
config:
|
||||
source: mqtt
|
||||
topic: saic/{{ .user }}/vehicles/{{ .vin }}/climate/remoteClimateState
|
||||
timeout: {{ .timeout }}
|
||||
odometer:
|
||||
source: mqtt
|
||||
topic: saic/{{ .user }}/vehicles/{{ .vin }}/drivetrain/mileage
|
||||
timeout: {{ .timeout }}
|
||||
wakeup:
|
||||
source: go
|
||||
script: |
|
||||
"force"
|
||||
out:
|
||||
- name: wakeUp
|
||||
type: string
|
||||
config:
|
||||
source: mqtt
|
||||
topic: saic/{{ .user }}/vehicles/{{ .vin }}/refresh/mode/set
|
||||
timeout: {{ .timeout }}
|
||||
30
templates/docs/vehicle/mg2mqtt_0.yaml
Normal file
30
templates/docs/vehicle/mg2mqtt_0.yaml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
product:
|
||||
brand: MG
|
||||
description: Publish all MG iSmart Car Data to MQTT (mg2mqtt)
|
||||
description: |
|
||||
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)
|
||||
render:
|
||||
- default: |
|
||||
type: template
|
||||
template: mg2mqtt
|
||||
title: # Wird in der Benutzeroberfläche angezeigt (Optional)
|
||||
user: # Benutzerkonto (bspw. E-Mail Adresse, User Id, etc.)
|
||||
vin: W... # Erforderlich, wenn mehrere Fahrzeuge des Herstellers vorhanden sind
|
||||
capacity: 50 # Akkukapazität in kWh (Optional)
|
||||
advanced: |
|
||||
type: template
|
||||
template: mg2mqtt
|
||||
title: # Wird in der Benutzeroberfläche angezeigt (Optional)
|
||||
user: # Benutzerkonto (bspw. E-Mail Adresse, User Id, etc.)
|
||||
vin: W... # Erforderlich, wenn mehrere Fahrzeuge des Herstellers vorhanden sind
|
||||
capacity: 50 # Akkukapazität in kWh (Optional)
|
||||
phases: 3 # Die maximale Anzahl der Phasen welche genutzt werden können (Optional)
|
||||
icon: car # Icon in der Benutzeroberfläche (Optional)
|
||||
timeout: 1h # Optional
|
||||
mode: # Möglich sind Off, Now, MinPV und PV, oder leer wenn keiner definiert werden soll (Optional)
|
||||
minSoc: 25 # Ladung mit maximaler Geschwindigkeit bis zu dem angegeben Ladestand unabhängig PV-Erzeugung, wenn der Lademodus nicht auf 'Aus' steht (Optional)
|
||||
targetSoc: 80 # Bis zu welchem Ladestand (Soc) soll das Fahrzeug geladen werden (Optional)
|
||||
minCurrent: 6 # Definiert die minimale Stromstärke pro angeschlossener Phase mit welcher das Fahrzeug geladen werden soll (Optional)
|
||||
maxCurrent: 16 # Definiert die maximale Stromstärke pro angeschlossener Phase mit welcher das Fahrzeug geladen werden soll (Optional)
|
||||
identifiers: # Kann meist erst später eingetragen werden, siehe: https://docs.evcc.io/docs/guides/vehicles/#erkennung-des-fahrzeugs-an-der-wallbox (Optional)
|
||||
priority: # Priorität des Ladepunktes oder Fahrzeugs in Relation zu anderen Ladepunkten oder Fahrzeugen für die Zuweisung von PV-Energie (Optional)
|
||||
|
|
@ -180,6 +180,7 @@
|
|||
"Kia",
|
||||
"Land Rover",
|
||||
"Mazda",
|
||||
"MG",
|
||||
"Mini",
|
||||
"Nissan",
|
||||
"NIU",
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ func NewConfigurableFromConfig(other map[string]interface{}) (api.Vehicle, error
|
|||
socG: socG,
|
||||
}
|
||||
|
||||
// decorate vehicle with Status
|
||||
// decorate status
|
||||
var status func() (api.ChargeStatus, error)
|
||||
if cc.Status != nil {
|
||||
statusG, err := provider.NewStringGetterFromConfig(*cc.Status)
|
||||
|
|
@ -62,7 +62,7 @@ func NewConfigurableFromConfig(other map[string]interface{}) (api.Vehicle, error
|
|||
}
|
||||
}
|
||||
|
||||
// decorate vehicle with range
|
||||
// decorate range
|
||||
var rng func() (int64, error)
|
||||
if cc.Range != nil {
|
||||
rangeG, err := provider.NewIntGetterFromConfig(*cc.Range)
|
||||
|
|
@ -72,7 +72,7 @@ func NewConfigurableFromConfig(other map[string]interface{}) (api.Vehicle, error
|
|||
rng = rangeG
|
||||
}
|
||||
|
||||
// decorate vehicle with odometer
|
||||
// decorate odometer
|
||||
var odo func() (float64, error)
|
||||
if cc.Odometer != nil {
|
||||
odoG, err := provider.NewFloatGetterFromConfig(*cc.Odometer)
|
||||
|
|
@ -82,7 +82,7 @@ func NewConfigurableFromConfig(other map[string]interface{}) (api.Vehicle, error
|
|||
odo = odoG
|
||||
}
|
||||
|
||||
// decorate vehicle with climater
|
||||
// decorate climater
|
||||
var climater func() (bool, error)
|
||||
if cc.Climater != nil {
|
||||
climateG, err := provider.NewBoolGetterFromConfig(*cc.Climater)
|
||||
|
|
@ -92,7 +92,7 @@ func NewConfigurableFromConfig(other map[string]interface{}) (api.Vehicle, error
|
|||
climater = climateG
|
||||
}
|
||||
|
||||
// decorate vehicle with wakeup
|
||||
// decorate wakeup
|
||||
var wakeup func() error
|
||||
if cc.Wakeup != nil {
|
||||
wakeupS, err := provider.NewBoolSetterFromConfig("wakeup", *cc.Wakeup)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue