Skip to content

Commit

Permalink
TWC3/Bender: remove api.ChargeDuration (#13615)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Apr 28, 2024
1 parent 07e7ded commit 539f453
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
23 changes: 2 additions & 21 deletions charger/bender.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"encoding/binary"
"fmt"
"math"
"time"

"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/util"
Expand Down Expand Up @@ -201,26 +200,8 @@ func (wb *BenderCC) MaxCurrent(current int64) error {
return err
}

var _ api.ChargeTimer = (*BenderCC)(nil)

// ChargeDuration implements the api.ChargeTimer interface
func (wb *BenderCC) ChargeDuration() (time.Duration, error) {
if wb.legacy {
b, err := wb.conn.ReadHoldingRegisters(bendRegChargingDurationLegacy, 1)
if err != nil {
return 0, err
}

return time.Duration(binary.BigEndian.Uint16(b)) * time.Second, nil
}

b, err := wb.conn.ReadHoldingRegisters(bendRegChargingDuration, 2)
if err != nil {
return 0, err
}

return time.Duration(binary.BigEndian.Uint32(b)) * time.Second, nil
}
// removed: https://github.com/evcc-io/evcc/issues/13555
// var _ api.ChargeTimer = (*BenderCC)(nil)

// CurrentPower implements the api.Meter interface
func (wb *BenderCC) currentPower() (float64, error) {
Expand Down
9 changes: 2 additions & 7 deletions charger/twc3.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,8 @@ func (v *Twc3) ChargedEnergy() (float64, error) {
return res.SessionEnergyWh / 1e3, err
}

var _ api.ChargeTimer = (*Twc3)(nil)

// ChargeDuration implements the api.ChargeTimer interface
func (v *Twc3) ChargeDuration() (time.Duration, error) {
res, err := v.vitalsG()
return time.Duration(res.SessionS) * time.Second, err
}
// removed: https://github.com/evcc-io/evcc/issues/13555
// var _ api.ChargeTimer = (*Twc3)(nil)

// Use workaround if voltageC_v is approximately half of grid_v
//
Expand Down

0 comments on commit 539f453

Please sign in to comment.