Kathrein: fix RFID (#23608)
This commit is contained in:
parent
c10f035fa1
commit
7bcbebe9c2
2 changed files with 23 additions and 3 deletions
|
|
@ -399,19 +399,39 @@ func (wb *Kathrein) GetPhases() (int, error) {
|
|||
}
|
||||
}
|
||||
|
||||
var _ api.StatusReasoner = (*Kathrein)(nil)
|
||||
|
||||
// StatusReason implements the api.StatusReasoner interface
|
||||
func (wb *Kathrein) StatusReason() (api.Reason, error) {
|
||||
res := api.ReasonUnknown
|
||||
|
||||
b, err := wb.conn.ReadHoldingRegisters(kathreinRegChargingState, 1)
|
||||
if err == nil && binary.BigEndian.Uint16(b) == 2 {
|
||||
res = api.ReasonWaitingForAuthorization
|
||||
}
|
||||
|
||||
return res, err
|
||||
}
|
||||
|
||||
var _ api.Identifier = (*Kathrein)(nil)
|
||||
|
||||
// Identify implements the api.Identifier interface
|
||||
func (wb *Kathrein) Identify() (string, error) {
|
||||
b, err := wb.conn.ReadHoldingRegisters(kathreinRegRfid, 16)
|
||||
s, err := wb.conn.ReadHoldingRegisters(kathreinRegChargingState, 1)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if string(b) == "VOID" {
|
||||
state := binary.BigEndian.Uint16(s)
|
||||
if state < 3 || state > 6 {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
b, err := wb.conn.ReadHoldingRegisters(kathreinRegRfid, 16)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(b), nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
template: Kathrein
|
||||
template: kathrein
|
||||
products:
|
||||
- brand: Kathrein
|
||||
description:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue