Skip to content

Commit

Permalink
ABL: decode error status
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Sep 7, 2021
1 parent 769f350 commit 509438c
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion charger/abl.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,29 @@ const (
ablModeDisable uint16 = 0xE0E0
)

var ablStatus = map[byte]string{
0xB1: "EV is asking for charging",
0xB2: "EV has the permission to charge",
0xC2: "EV is charged",
0xC3: "C2, reduced current (error F16, F17)",
0xC4: "C2, reduced current (imbalance F15)",
0xE0: "Outlet disabled",
0xE1: "Production test",
0xE2: "EVCC setup mode",
0xE3: "Bus idle",
0xF1: "Unintended closed contact (Welding)",
0xF2: "Internal error",
0xF3: "DC residual current detected",
0xF4: "Upstream communication timeout",
0xF5: "Lock of socket failed",
0xF6: "CS out of range",
0xF7: "State D requested by EV",
0xF8: "CP out of range",
0xF9: "Overcurrent detected",
0xFA: "Temperature outside limits",
0xFB: "Unintended opened contact",
}

func init() {
registry.Add("abl", NewABLeMHFromConfig)
}
Expand Down Expand Up @@ -102,7 +125,11 @@ func (wb *ABLeMH) Status() (api.ChargeStatus, error) {
case 'A', 'B', 'C':
return api.ChargeStatus(r), nil
default:
return api.StatusNone, fmt.Errorf("invalid status: %s", string(r))
status, ok := ablStatus[b[1]]
if !ok {
status = string(r)
}
return api.StatusNone, fmt.Errorf("invalid status: %s", status)
}
}

Expand Down

0 comments on commit 509438c

Please sign in to comment.