ABL: treat outlet disabled as status A

This commit is contained in:
andig 2021-09-10 11:17:53 +02:00
parent 7f692fa635
commit d471eec155

View file

@ -47,6 +47,8 @@ const (
ablModeDisable uint16 = 0xE0E0
)
const ablStatusOutletDisabled = 0xE0
var ablStatus = map[byte]string{
0xB1: "EV is asking for charging",
0xB2: "EV has the permission to charge",
@ -125,10 +127,16 @@ func (wb *ABLeMH) Status() (api.ChargeStatus, error) {
case 'A', 'B', 'C':
return api.ChargeStatus(r), nil
default:
// treat outlet disabled as vehicle disconnected
if b[1] == ablStatusOutletDisabled {
return api.StatusA, nil
}
status, ok := ablStatus[b[1]]
if !ok {
status = string(r)
}
return api.StatusNone, fmt.Errorf("invalid status: %s", status)
}
}