Skip to content

Commit

Permalink
Em2go: add api.CurrentGetter
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jun 16, 2024
1 parent 4d6109d commit 0b52fd2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions charger/em2go-home.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ func (wb *Em2GoHome) MaxCurrentMillis(current float64) error {
return err
}

var _ api.CurrentGetter = (*Em2GoHome)(nil)

// GetMaxCurrent implements the api.CurrentGetter interface
func (wb Em2GoHome) GetMaxCurrent() (float64, error) {
b, err := wb.conn.ReadHoldingRegisters(em2GoHomeRegCurrentLimit, 1)
if err != nil {
return 0, err
}

return float64(binary.BigEndian.Uint16(b)) / 10, err
}

var _ api.Meter = (*Em2GoHome)(nil)

// CurrentPower implements the api.Meter interface
Expand Down

0 comments on commit 0b52fd2

Please sign in to comment.