Vestel: add current getter (#16492)
This commit is contained in:
parent
84f5c56dca
commit
b8d8758134
1 changed files with 12 additions and 7 deletions
|
|
@ -141,13 +141,6 @@ func (wb *Vestel) Status() (api.ChargeStatus, error) {
|
|||
// Enabled implements the api.Charger interface
|
||||
func (wb *Vestel) Enabled() (bool, error) {
|
||||
return verifyEnabled(wb, wb.enabled)
|
||||
|
||||
// b, err := wb.conn.ReadHoldingRegisters(vestelRegMaxCurrent, 1)
|
||||
// if err != nil {
|
||||
// return false, err
|
||||
// }
|
||||
|
||||
// return binary.BigEndian.Uint16(b) > 0, nil
|
||||
}
|
||||
|
||||
// Enable implements the api.Charger interface
|
||||
|
|
@ -180,6 +173,18 @@ func (wb *Vestel) MaxCurrent(current int64) error {
|
|||
return err
|
||||
}
|
||||
|
||||
var _ api.CurrentGetter = (*Vestel)(nil)
|
||||
|
||||
// GetMaxCurrent implements the api.CurrentGetter interface
|
||||
func (wb *Vestel) GetMaxCurrent() (float64, error) {
|
||||
b, err := wb.conn.ReadHoldingRegisters(vestelRegMaxCurrent, 1)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return float64(binary.BigEndian.Uint16(b)), nil
|
||||
}
|
||||
|
||||
var _ api.ChargeTimer = (*Vestel)(nil)
|
||||
|
||||
// ChargeDuration implements the api.ChargeTimer interface
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue