Cupra: fix connected status (#30046)
This commit is contained in:
parent
d89c1018e8
commit
8ac2f944dd
2 changed files with 24 additions and 18 deletions
|
|
@ -61,19 +61,24 @@ var _ api.ChargeState = (*Provider)(nil)
|
|||
|
||||
// Status implements the api.ChargeState interface
|
||||
func (v *Provider) Status() (api.ChargeStatus, error) {
|
||||
status := api.StatusA // disconnected
|
||||
|
||||
res, err := v.statusG()
|
||||
if err == nil {
|
||||
switch strings.ToLower(res.Services.Charging.Status) {
|
||||
case "connected", "readyforcharging", "error":
|
||||
status = api.StatusB
|
||||
case "charging":
|
||||
status = api.StatusC
|
||||
}
|
||||
if err != nil {
|
||||
return api.StatusNone, err
|
||||
}
|
||||
|
||||
return status, err
|
||||
// https://github.com/evcc-io/evcc/issues/30045
|
||||
if strings.ToLower(res.Services.Charging.BatteryCardStatus) == "notconnected" {
|
||||
return api.StatusA, nil
|
||||
}
|
||||
|
||||
switch strings.ToLower(res.Services.Charging.Status) {
|
||||
case "connected", "readyforcharging", "error":
|
||||
return api.StatusB, nil
|
||||
case "charging":
|
||||
return api.StatusC, nil
|
||||
}
|
||||
|
||||
return api.StatusA, nil
|
||||
}
|
||||
|
||||
var _ api.VehicleFinishTimer = (*Provider)(nil)
|
||||
|
|
|
|||
|
|
@ -22,14 +22,15 @@ type Status struct {
|
|||
}
|
||||
Services struct {
|
||||
Charging struct {
|
||||
Status string
|
||||
TargetPct int
|
||||
ChargeMode string
|
||||
ChargeSettings string
|
||||
Active bool
|
||||
RemainingTime int64
|
||||
CurrentPct float64
|
||||
ProgressBarPct float64
|
||||
Status string
|
||||
BatteryCardStatus string
|
||||
TargetPct int
|
||||
ChargeMode string
|
||||
ChargeSettings string
|
||||
Active bool
|
||||
RemainingTime int64
|
||||
CurrentPct float64
|
||||
ProgressBarPct float64
|
||||
}
|
||||
Climatisation struct {
|
||||
Status string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue