Kathrein: fix RFID (#23608)

This commit is contained in:
premultiply 2025-09-15 19:10:21 +02:00 • committed by GitHub
parent c10f035fa1
commit 7bcbebe9c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 3 deletions

View file

@ -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
}

View file

@ -1,4 +1,4 @@
template: Kathrein
template: kathrein
products:
- brand: Kathrein
description: