Keba: fixes to api.PhaseGetter (#13624)

- Fixes register read length of kebaRegPhaseState to 32 bits.
- This register holds the state of the external contactor ( 2 x normally open),
  which is used to switch between 1 phase and 3 phases. If this register holds
  a zero, only one phase is active. If it holds a one, three phases are active.
This commit is contained in:
Andy4OS 2024-04-28 17:44:41 +02:00 • committed by GitHub
parent 539f453a6c
commit e8dc709f98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -287,12 +287,14 @@ func (wb *Keba) phases1p3p(phases int) error {
// getPhases implements the api.PhaseGetter interface
func (wb *Keba) getPhases() (int, error) {
b, err := wb.conn.ReadHoldingRegisters(kebaRegPhaseState, 1)
b, err := wb.conn.ReadHoldingRegisters(kebaRegPhaseState, 2)
if err != nil {
return 0, err
}
return int(binary.BigEndian.Uint16(b)), nil
if binary.BigEndian.Uint32(b) == 0 {
return 1, nil
}
return 3, nil
}
var _ api.Diagnosis = (*Keba)(nil)