Kathrein: fix RFID (part 2) (#23758)
This commit is contained in:
parent
687a507d81
commit
bc6a7efda2
1 changed files with 10 additions and 2 deletions
|
|
@ -18,10 +18,12 @@ package charger
|
|||
// SOFTWARE.
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/evcc-io/evcc/api"
|
||||
|
|
@ -427,12 +429,18 @@ func (wb *Kathrein) Identify() (string, error) {
|
|||
return "", nil
|
||||
}
|
||||
|
||||
b, err := wb.conn.ReadHoldingRegisters(kathreinRegRfid, 16)
|
||||
b, err := wb.conn.ReadHoldingRegisters(kathreinRegRfid, 24)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(b), nil
|
||||
rfid := string(bytes.TrimRight(b, "\x00"))
|
||||
|
||||
if strings.HasPrefix(rfid, "RFID:") {
|
||||
return rfid[5:], nil
|
||||
}
|
||||
|
||||
return rfid, nil
|
||||
}
|
||||
|
||||
var _ api.Diagnosis = (*Kathrein)(nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue