From 62e252d2df11bee3a7adea43bde42fee2e5aa7e5 Mon Sep 17 00:00:00 2001 From: andig Date: Sat, 14 Sep 2024 14:38:22 +0200 Subject: [PATCH] Smart Hello: add charge state (#15939) --- vehicle/smart/hello/provider.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/vehicle/smart/hello/provider.go b/vehicle/smart/hello/provider.go index 7935fd530..115aad4fa 100644 --- a/vehicle/smart/hello/provider.go +++ b/vehicle/smart/hello/provider.go @@ -30,6 +30,21 @@ func (v *Provider) Soc() (float64, error) { return float64(res.AdditionalVehicleStatus.ElectricVehicleStatus.ChargeLevel), err } +var _ api.ChargeState = (*Provider)(nil) + +// Status implements the api.ChargeState interface +func (v *Provider) Status() (api.ChargeStatus, error) { + res, err := v.statusG() + switch res.AdditionalVehicleStatus.ElectricVehicleStatus.ChargerState { + case 1, 3: + return api.StatusB, err + case 2: + return api.StatusC, err + default: + return api.StatusA, err + } +} + var _ api.VehicleRange = (*Provider)(nil) // Range implements the api.VehicleRange interface