From c92d8777fd41be941d86d74fc4a85153e84c7c98 Mon Sep 17 00:00:00 2001 From: Elina Urbanovich <83229929+ElinaUrbanovich@users.noreply.github.com> Date: Thu, 25 Aug 2022 14:12:42 +0300 Subject: [PATCH] Smart: fix status response mapping (#4222) --- vehicle/smart/provider.go | 7 ++++--- vehicle/smart/types.go | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/vehicle/smart/provider.go b/vehicle/smart/provider.go index d24249db55..707055461b 100644 --- a/vehicle/smart/provider.go +++ b/vehicle/smart/provider.go @@ -56,10 +56,11 @@ var _ api.ChargeState = (*Provider)(nil) func (v *Provider) Status() (api.ChargeStatus, error) { res, err := v.statusG() - switch v := res.PreCond.Data.ChargingStatus.Value; v { + switch v := res.PreCond.Data.ChargingStatus.Status; v { case 0: - return api.StatusC, err - case 1, 2: + if res.PreCond.Data.ChargingActive.Value { + return api.StatusC, err + } return api.StatusB, err case 3: return api.StatusA, err diff --git a/vehicle/smart/types.go b/vehicle/smart/types.go index 868f2ce91d..2617d47c6e 100644 --- a/vehicle/smart/types.go +++ b/vehicle/smart/types.go @@ -8,6 +8,7 @@ import ( type StatusResponse struct { PreCond struct { Data struct { + ChargingPower FloatValue ChargingActive BoolValue ChargingStatus IntValue } `json:"data"`