Support mA current resolution adjustments (#646)

This commit is contained in:
premultiply 2021-02-22 15:07:48 +01:00 • committed by GitHub
parent 171c6f59fd
commit 3e23f50d69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -247,6 +247,21 @@ func (c *Keba) MaxCurrent(current int64) error {
return nil
}
// MaxCurrentMillis implements the ChargerEx interface
func (c *Keba) MaxCurrentMillis(current float64) error {
d := int(1000 * current)
var resp string
if err := c.roundtrip(fmt.Sprintf("curr %d", d), 0, &resp); err != nil {
return err
}
if resp != keba.OK {
return fmt.Errorf("curr %d unexpected response: %s", d, resp)
}
return nil
}
// CurrentPower implements the Meter interface
func (c *Keba) CurrentPower() (float64, error) {
var kr keba.Report3