Skip to content

Commit

Permalink
Keba: fixes to api.PhaseGetter (#13624)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
Andy4OS authored Apr 28, 2024
1 parent 539f453 commit e8dc709
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions charger/keba-modbus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e8dc709

Please sign in to comment.