Skip to content

Commit 8c87582

Browse files
committed
Polestar: fix status detection
1 parent dc22ff5 commit 8c87582

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

vehicle/polestar/provider.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,18 @@ func (v *Provider) Status() (api.ChargeStatus, error) {
3737
status, err := v.telemetryG()
3838

3939
res := api.StatusA
40+
41+
if len(status.Battery) == 0 {
42+
return res, nil
43+
}
44+
4045
if status.Battery[0].ChargingStatus == "CHARGER_CONNECTION_STATUS_CONNECTED" {
4146
res = api.StatusB
4247
}
4348
if status.Battery[0].ChargingStatus == "CHARGING_STATUS_CHARGING" {
44-
res = api.StatusB
49+
res = api.StatusC
4550
}
51+
4652
return res, err
4753
}
4854

0 commit comments

Comments
 (0)