From 90a49bd0363a0cacdc9c2a59be628c20c7813843 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Wed, 26 Apr 2023 19:22:22 +0200 Subject: [PATCH] Fix EV Connected not working with Elli wallbox --- emobility/public.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/emobility/public.go b/emobility/public.go index 2be9b16..bfded8f 100644 --- a/emobility/public.go +++ b/emobility/public.go @@ -37,12 +37,14 @@ func (e *EMobilityImpl) EVConnected() bool { } // getting currents measurements should work - if _, err := e.EVCurrentsPerPhase(); err != nil { + if _, err := e.EVCurrentsPerPhase(); err != nil && err != features.ErrDataNotAvailable { + // features.ErrDataNotAvailable check in case of measurements not being provided but the feature works return false } // getting limits should work - if _, err := e.EVLoadControlObligationLimits(); err != nil { + if _, err := e.EVLoadControlObligationLimits(); err != nil && err != features.ErrDataNotAvailable { + // features.ErrDataNotAvailable check in case of load control limits not being provided but the feature works return false } @@ -314,11 +316,20 @@ func (e *EMobilityImpl) EVLoadControlObligationLimits() ([]float64, error) { return nil, features.ErrDataNotAvailable } + var limitValue float64 if limitIdData.Value == nil { - return nil, features.ErrDataNotAvailable + // assume maximum possible + _, dataMax, _, err := e.evElectricalConnection.GetLimitsForParameterId(*elParamDesc.ParameterId) + if err != nil { + return nil, features.ErrDataNotAvailable + } + + limitValue = dataMax + } else { + limitValue = limitIdData.Value.GetValue() } - result = append(result, limitIdData.Value.GetValue()) + result = append(result, limitValue) } return result, nil