Wallbe: remove broken charge timer (#9694)

This commit is contained in:
andig 2023-09-03 10:48:43 +02:00 • committed by GitHub
parent 216dcba3de
commit 5b994e729e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 65 deletions

View file

@ -3,7 +3,6 @@ package charger
import (
"encoding/binary"
"fmt"
"time"
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/util"
@ -165,20 +164,6 @@ func (wb *Wallbe) maxCurrentMillis(current float64) error {
return err
}
var _ api.ChargeTimer = (*Wallbe)(nil)
// ChargingTime implements the api.ChargeTimer interface
func (wb *Wallbe) ChargingTime() (time.Duration, error) {
b, err := wb.conn.ReadInputRegisters(wbRegChargeTime, 2)
if err != nil {
return 0, err
}
// 2 words, least significant word first
secs := uint64(b[1]) | uint64(b[0])<<8 | uint64(b[3])<<16 | uint64(b[2])<<24
return time.Duration(secs) * time.Second, nil
}
// currentPower implements the api.Meter interface
func (wb *Wallbe) currentPower() (float64, error) {
b, err := wb.conn.ReadInputRegisters(wbRegPower, 2)

View file

@ -1,50 +0,0 @@
package charger
import (
"testing"
"github.com/evcc-io/evcc/api"
)
func TestWallbeLegacy(t *testing.T) {
wbc, err := NewWallbeFromConfig(map[string]interface{}{"legacy": true})
if err != nil {
t.Error(err)
}
wb, ok := wbc.(*Wallbe)
if !ok {
t.Error("unexpected type")
}
if wb.factor != 1 {
t.Errorf("invalid factor: %d", wb.factor)
}
if _, ok = wbc.(api.ChargeTimer); !ok {
t.Error("missing charge timer api")
}
if _, ok = wbc.(api.Diagnosis); !ok {
t.Error("missing diagnosis api")
}
}
func TestWallbeEx(t *testing.T) {
wbc, err := NewWallbeFromConfig(map[string]interface{}{"legacy": false})
if err != nil {
t.Error(err)
}
if _, ok := wbc.(api.ChargerEx); !ok {
t.Error("missing ChargerEx api")
}
if _, ok := wbc.(api.ChargeTimer); !ok {
t.Error("missing ChargeTimer api")
}
if _, ok := wbc.(api.Diagnosis); !ok {
t.Error("missing Diagnosis api")
}
}