ABL eMH: force re-enable outlet (#17950)
This commit is contained in:
parent
d78d4bda02
commit
a24b8b89f5
1 changed files with 11 additions and 6 deletions
|
|
@ -3,7 +3,7 @@ package charger
|
|||
// LICENSE
|
||||
|
||||
// Copyright (c) 2019-2022 andig
|
||||
// Copyright (c) 2022 premultiply
|
||||
// Copyright (c) 2022-2024 premultiply
|
||||
|
||||
// This module is NOT covered by the MIT license. All rights reserved.
|
||||
|
||||
|
|
@ -157,15 +157,20 @@ func (wb *ABLeMH) Status() (api.ChargeStatus, error) {
|
|||
return api.StatusNone, err
|
||||
}
|
||||
|
||||
r := rune(b[1]>>4-0x0A) + 'A'
|
||||
s := string(rune((b[1]>>4)-0x0A) + 'A')
|
||||
|
||||
switch r {
|
||||
case 'A', 'B', 'C':
|
||||
return api.ChargeStatus(r), nil
|
||||
switch s {
|
||||
case "A", "B", "C":
|
||||
return api.ChargeStatusString(s)
|
||||
default:
|
||||
// ensure Outlet is re-enabled after wake-up
|
||||
if b[1] == 0xE0 { // Outlet is disabled
|
||||
return api.StatusB, wb.set(ablRegModifyState, 0xA1A1)
|
||||
}
|
||||
|
||||
status, ok := ablStatus[b[1]]
|
||||
if !ok {
|
||||
status = string(r)
|
||||
status = s
|
||||
}
|
||||
|
||||
return api.StatusNone, fmt.Errorf("invalid status: %s", status)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue