Tinkerforge WARP: add WARP4 support with vehicle SoC via ISO 15118 (#31446)
This commit is contained in:
parent
9325ed4f9e
commit
d495d3e442
3 changed files with 42 additions and 4 deletions
|
|
@ -55,6 +55,9 @@ type WarpWS struct {
|
|||
// nfc
|
||||
chargeTracker warp.ChargeTrackerCurrentCharge
|
||||
|
||||
// ev (WARP4, ISO 15118)
|
||||
evState *warp.EvState
|
||||
|
||||
// power manager
|
||||
pmState *warp.PmState
|
||||
pmLowLevelState *warp.PmLowLevelState
|
||||
|
|
@ -99,8 +102,14 @@ func NewWarpWSFromConfig(ctx context.Context, other map[string]any) (api.Charger
|
|||
implement.Has(w, implement.PhaseVoltages(w.voltages))
|
||||
}
|
||||
|
||||
// Feature: ISO 15118 (WARP4): vehicle soc and mac exposed via ev/state
|
||||
hasIso15118 := w.hasFeature(warp.FeatureIso15118)
|
||||
if hasIso15118 {
|
||||
implement.Has(w, implement.Battery(w.soc))
|
||||
}
|
||||
|
||||
// Feature: NFC
|
||||
if w.hasFeature(warp.FeatureNfc) {
|
||||
if w.hasFeature(warp.FeatureNfc) || hasIso15118 {
|
||||
implement.Has(w, implement.Identifier(w.identify))
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +150,7 @@ func NewWarpWS(ctx context.Context, uri, user, pass, emURI, emUser, emPass strin
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if typ == "warp3" || (typ == "warp2" && emURI != "") {
|
||||
if typ == "warp3" || typ == "warp4" || (typ == "warp2" && emURI != "") {
|
||||
enabled, err := w.disablePhaseAutoSwitch()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -284,6 +293,8 @@ func (w *WarpWS) handleEvent(topic string, payload json.RawMessage) error {
|
|||
switch topic {
|
||||
case "charge_tracker/current_charge":
|
||||
err = json.Unmarshal(payload, &w.chargeTracker)
|
||||
case "ev/state":
|
||||
err = json.Unmarshal(payload, &w.evState)
|
||||
case "evse/external_current":
|
||||
err = json.Unmarshal(payload, &w.evse.ExternalCurrent)
|
||||
case "evse/user_current":
|
||||
|
|
@ -433,12 +444,26 @@ func (w *WarpWS) voltages() (float64, float64, float64, error) {
|
|||
return w.meter.Voltages[0], w.meter.Voltages[1], w.meter.Voltages[2], nil
|
||||
}
|
||||
|
||||
// identify prefers the vehicle mac read via ISO 15118 over the RFID tag
|
||||
func (w *WarpWS) identify() (string, error) {
|
||||
w.mu.RLock()
|
||||
defer w.mu.RUnlock()
|
||||
if w.evState != nil && w.evState.Mac != "" {
|
||||
return w.evState.Mac, nil
|
||||
}
|
||||
return w.chargeTracker.AuthorizationInfo.TagId, nil
|
||||
}
|
||||
|
||||
// soc implements the api.Battery interface
|
||||
func (w *WarpWS) soc() (float64, error) {
|
||||
w.mu.RLock()
|
||||
defer w.mu.RUnlock()
|
||||
if w.evState != nil && w.evState.Soc != nil {
|
||||
return *w.evState.Soc, nil
|
||||
}
|
||||
return 0, api.ErrNotAvailable
|
||||
}
|
||||
|
||||
func (w *WarpWS) setCurrent(curr int64) error {
|
||||
uri := fmt.Sprintf("%s/evse/external_current", w.URI)
|
||||
req, _ := request.New(http.MethodPost, uri, request.MarshalJSON(map[string]int64{"current": curr}), request.JSONEncoding)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package warp
|
||||
|
||||
const (
|
||||
FeatureIso15118 = "iso15118"
|
||||
FeatureMeter = "meter"
|
||||
FeatureMeters = "meters"
|
||||
FeatureMeterAllValues = "meter_all_values"
|
||||
|
|
@ -67,6 +68,12 @@ var DefaultSchema = MeterSchema{
|
|||
},
|
||||
}
|
||||
|
||||
// WARP4 only: vehicle data read via ISO 15118; soc is null and mac is empty while unknown
|
||||
type EvState struct {
|
||||
Soc *float64 `json:"soc"`
|
||||
Mac string `json:"mac"`
|
||||
}
|
||||
|
||||
type ChargeTrackerCurrentCharge struct {
|
||||
AuthorizationInfo struct {
|
||||
TagType int `json:"tag_type"`
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
template: tinkerforge-warp-ws
|
||||
products:
|
||||
- brand: TinkerForge
|
||||
description: { generic: WARP4 Smart }
|
||||
capabilities: ["iso151182", "rfid", "1p3p"]
|
||||
- brand: TinkerForge
|
||||
description: { generic: WARP4 Pro }
|
||||
capabilities: ["iso151182", "rfid", "1p3p", "meter"]
|
||||
- brand: TinkerForge
|
||||
description: { generic: WARP3 Smart }
|
||||
capabilities: ["rfid", "1p3p"]
|
||||
|
|
@ -20,8 +26,8 @@ products:
|
|||
capabilities: ["mA", "dim"]
|
||||
requirements:
|
||||
description:
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
evcc: ["skiptest"]
|
||||
params:
|
||||
- name: uri
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue