Skip to content

Commit faf22cb

Browse files
poohnetclaude
andcommitted
Tinkerforge WARP: detect EV features via info/features
Requires WARP4 firmware announcing the ev feature, see Tinkerforge/esp32-firmware#503. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 3925d2d commit faf22cb

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

charger/warp-ws.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,8 @@ func NewWarpWSFromConfig(ctx context.Context, other map[string]any) (api.Charger
102102
implement.Has(w, implement.PhaseVoltages(w.voltages))
103103
}
104104

105-
// Feature: EV (WARP4): vehicle soc and mac read via ISO 15118;
106-
// not announced in info/features, hence probing the api
107-
hasEv := w.hasEvState()
105+
// Feature: EV (WARP4): vehicle soc and mac read via ISO 15118
106+
hasEv := w.hasFeature(warp.FeatureEv)
108107
if hasEv {
109108
implement.Has(w, implement.Battery(w.soc))
110109
}
@@ -455,12 +454,6 @@ func (w *WarpWS) identify() (string, error) {
455454
return w.chargeTracker.AuthorizationInfo.TagId, nil
456455
}
457456

458-
// hasEvState probes the ev/state api provided by WARP4 devices
459-
func (w *WarpWS) hasEvState() bool {
460-
var res warp.EvState
461-
return w.GetJSON(fmt.Sprintf("%s/ev/state", w.URI), &res) == nil
462-
}
463-
464457
// soc implements the api.Battery interface
465458
func (w *WarpWS) soc() (float64, error) {
466459
w.mu.RLock()

charger/warp/types.go

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

33
const (
4+
FeatureEv = "ev"
45
FeatureMeter = "meter"
56
FeatureMeters = "meters"
67
FeatureMeterAllValues = "meter_all_values"

0 commit comments

Comments
 (0)