Skip to content

Commit d495d3e

Browse files
authored
Tinkerforge WARP: add WARP4 support with vehicle SoC via ISO 15118 (#31446)
1 parent 9325ed4 commit d495d3e

3 files changed

Lines changed: 42 additions & 4 deletions

File tree

charger/warp-ws.go

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ type WarpWS struct {
5555
// nfc
5656
chargeTracker warp.ChargeTrackerCurrentCharge
5757

58+
// ev (WARP4, ISO 15118)
59+
evState *warp.EvState
60+
5861
// power manager
5962
pmState *warp.PmState
6063
pmLowLevelState *warp.PmLowLevelState
@@ -99,8 +102,14 @@ func NewWarpWSFromConfig(ctx context.Context, other map[string]any) (api.Charger
99102
implement.Has(w, implement.PhaseVoltages(w.voltages))
100103
}
101104

105+
// Feature: ISO 15118 (WARP4): vehicle soc and mac exposed via ev/state
106+
hasIso15118 := w.hasFeature(warp.FeatureIso15118)
107+
if hasIso15118 {
108+
implement.Has(w, implement.Battery(w.soc))
109+
}
110+
102111
// Feature: NFC
103-
if w.hasFeature(warp.FeatureNfc) {
112+
if w.hasFeature(warp.FeatureNfc) || hasIso15118 {
104113
implement.Has(w, implement.Identifier(w.identify))
105114
}
106115

@@ -141,7 +150,7 @@ func NewWarpWS(ctx context.Context, uri, user, pass, emURI, emUser, emPass strin
141150
if err != nil {
142151
return nil, err
143152
}
144-
if typ == "warp3" || (typ == "warp2" && emURI != "") {
153+
if typ == "warp3" || typ == "warp4" || (typ == "warp2" && emURI != "") {
145154
enabled, err := w.disablePhaseAutoSwitch()
146155
if err != nil {
147156
return nil, err
@@ -284,6 +293,8 @@ func (w *WarpWS) handleEvent(topic string, payload json.RawMessage) error {
284293
switch topic {
285294
case "charge_tracker/current_charge":
286295
err = json.Unmarshal(payload, &w.chargeTracker)
296+
case "ev/state":
297+
err = json.Unmarshal(payload, &w.evState)
287298
case "evse/external_current":
288299
err = json.Unmarshal(payload, &w.evse.ExternalCurrent)
289300
case "evse/user_current":
@@ -433,12 +444,26 @@ func (w *WarpWS) voltages() (float64, float64, float64, error) {
433444
return w.meter.Voltages[0], w.meter.Voltages[1], w.meter.Voltages[2], nil
434445
}
435446

447+
// identify prefers the vehicle mac read via ISO 15118 over the RFID tag
436448
func (w *WarpWS) identify() (string, error) {
437449
w.mu.RLock()
438450
defer w.mu.RUnlock()
451+
if w.evState != nil && w.evState.Mac != "" {
452+
return w.evState.Mac, nil
453+
}
439454
return w.chargeTracker.AuthorizationInfo.TagId, nil
440455
}
441456

457+
// soc implements the api.Battery interface
458+
func (w *WarpWS) soc() (float64, error) {
459+
w.mu.RLock()
460+
defer w.mu.RUnlock()
461+
if w.evState != nil && w.evState.Soc != nil {
462+
return *w.evState.Soc, nil
463+
}
464+
return 0, api.ErrNotAvailable
465+
}
466+
442467
func (w *WarpWS) setCurrent(curr int64) error {
443468
uri := fmt.Sprintf("%s/evse/external_current", w.URI)
444469
req, _ := request.New(http.MethodPost, uri, request.MarshalJSON(map[string]int64{"current": curr}), request.JSONEncoding)

charger/warp/types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package warp
22

33
const (
4+
FeatureIso15118 = "iso15118"
45
FeatureMeter = "meter"
56
FeatureMeters = "meters"
67
FeatureMeterAllValues = "meter_all_values"
@@ -67,6 +68,12 @@ var DefaultSchema = MeterSchema{
6768
},
6869
}
6970

71+
// WARP4 only: vehicle data read via ISO 15118; soc is null and mac is empty while unknown
72+
type EvState struct {
73+
Soc *float64 `json:"soc"`
74+
Mac string `json:"mac"`
75+
}
76+
7077
type ChargeTrackerCurrentCharge struct {
7178
AuthorizationInfo struct {
7279
TagType int `json:"tag_type"`

templates/definition/charger/tinkerforge-warp-ws.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
template: tinkerforge-warp-ws
22
products:
3+
- brand: TinkerForge
4+
description: { generic: WARP4 Smart }
5+
capabilities: ["iso151182", "rfid", "1p3p"]
6+
- brand: TinkerForge
7+
description: { generic: WARP4 Pro }
8+
capabilities: ["iso151182", "rfid", "1p3p", "meter"]
39
- brand: TinkerForge
410
description: { generic: WARP3 Smart }
511
capabilities: ["rfid", "1p3p"]
@@ -20,8 +26,8 @@ products:
2026
capabilities: ["mA", "dim"]
2127
requirements:
2228
description:
23-
de: Falls notwendig wird die WARP3-eigene automatische Phasenumschaltung von EVCC beim Verbinden mit der Wallbox deaktiviert (siehe [docs.warp-charger.com](https://docs.warp-charger.com/docs/mqtt_http/api_reference/evse#evse_phase_auto_switch_warp3)). Phasenumschaltung (1p/3p) ist beim WARP2 nur mit einem zusätzlichen WARP Energy Manager möglich und beim WARP1 gar nicht, da keine CP-Trennung unterstützt wird. RFID steht beim WARP1 nur zur Verfügung, wenn zusätzlich ein NFC Bricklet nachgerüstet wurde.
24-
en: If necessary, WARP3's own automatic phase switching will be deactivated by EVCC when connecting to the wallbox (see [docs.warp-charger.com](https://docs.warp-charger.com/docs/mqtt_http/api_reference/evse#evse_phase_auto_switch_warp3)). Phase switching (1p/3p) is only possible on the WARP2 with an additional WARP Energy Manager, and not possible at all on the WARP1, since it does not support CP separation. RFID on the WARP1 is only available if an NFC Bricklet has been retrofitted.
29+
de: Falls notwendig wird die WARP3/WARP4-eigene automatische Phasenumschaltung von EVCC beim Verbinden mit der Wallbox deaktiviert (siehe [docs.warp-charger.com](https://docs.warp-charger.com/docs/mqtt_http/api_reference/evse#evse_phase_auto_switch_warp3)). Phasenumschaltung (1p/3p) ist beim WARP2 nur mit einem zusätzlichen WARP Energy Manager möglich und beim WARP1 gar nicht, da keine CP-Trennung unterstützt wird. RFID steht beim WARP1 nur zur Verfügung, wenn zusätzlich ein NFC Bricklet nachgerüstet wurde. Beim WARP4 kann EVCC das Fahrzeug anhand seiner MAC-Adresse identifizieren, wenn "Autocharge" oder "Ladestand auslesen" in den ISO 15118-Einstellungen der Wallbox aktiviert ist. Das Auslesen des Fahrzeug-Ladestands per ISO 15118 erfordert "Ladestand auslesen" und ist nur beim WARP4 Pro verfügbar, da der eingebaute Stromzähler benötigt wird. Die ISO 15118-Funktionen erfordern WARP4-Firmware 2.12.2 oder neuer.
30+
en: If necessary, WARP3's/WARP4's own automatic phase switching will be deactivated by EVCC when connecting to the wallbox (see [docs.warp-charger.com](https://docs.warp-charger.com/docs/mqtt_http/api_reference/evse#evse_phase_auto_switch_warp3)). Phase switching (1p/3p) is only possible on the WARP2 with an additional WARP Energy Manager, and not possible at all on the WARP1, since it does not support CP separation. RFID on the WARP1 is only available if an NFC Bricklet has been retrofitted. On the WARP4, EVCC can identify the vehicle by its MAC address if "Autocharge" or "Read state of charge" is enabled in the wallbox's ISO 15118 settings. Reading the vehicle SoC via ISO 15118 requires "Read state of charge" and is only available on the WARP4 Pro, since it needs the built-in energy meter. The ISO 15118 features require WARP4 firmware 2.12.2 or later.
2531
evcc: ["skiptest"]
2632
params:
2733
- name: uri

0 commit comments

Comments
 (0)