Loadpoint: detect connection changes using connected duration (attempt 2) (#24957)
This commit is contained in:
parent
0bcca69b8e
commit
3a24dd0948
6 changed files with 251 additions and 41 deletions
|
|
@ -7,7 +7,7 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
//go:generate go tool mockgen -package api -destination mock.go github.com/evcc-io/evcc/api Charger,ChargeState,CurrentLimiter,CurrentGetter,PhaseSwitcher,PhaseGetter,FeatureDescriber,Identifier,Meter,MeterEnergy,PhaseCurrents,Vehicle,ChargeRater,Battery,BatteryController,BatterySocLimiter,Circuit,Tariff
|
||||
//go:generate go tool mockgen -package api -destination mock.go github.com/evcc-io/evcc/api Charger,ChargeState,CurrentLimiter,CurrentGetter,PhaseSwitcher,PhaseGetter,FeatureDescriber,Identifier,Meter,MeterEnergy,PhaseCurrents,Vehicle,ConnectionTimer,ChargeRater,Battery,BatteryController,BatterySocLimiter,Circuit,Tariff
|
||||
|
||||
// Meter provides total active power in W
|
||||
type Meter interface {
|
||||
|
|
@ -115,6 +115,11 @@ type ChargeTimer interface {
|
|||
ChargeDuration() (time.Duration, error)
|
||||
}
|
||||
|
||||
// ConnectionTimer provides current connection duration
|
||||
type ConnectionTimer interface {
|
||||
ConnectionDuration() (time.Duration, error)
|
||||
}
|
||||
|
||||
// ChargeRater provides charged energy amount in kWh
|
||||
type ChargeRater interface {
|
||||
ChargedEnergy() (float64, error)
|
||||
|
|
|
|||
44
api/mock.go
44
api/mock.go
|
|
@ -1,9 +1,9 @@
|
|||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/evcc-io/evcc/api (interfaces: Charger,ChargeState,CurrentLimiter,CurrentGetter,PhaseSwitcher,PhaseGetter,FeatureDescriber,Identifier,Meter,MeterEnergy,PhaseCurrents,Vehicle,ChargeRater,Battery,BatteryController,BatterySocLimiter,Circuit,Tariff)
|
||||
// Source: github.com/evcc-io/evcc/api (interfaces: Charger,ChargeState,CurrentLimiter,CurrentGetter,PhaseSwitcher,PhaseGetter,FeatureDescriber,Identifier,Meter,MeterEnergy,PhaseCurrents,Vehicle,ConnectionTimer,ChargeRater,Battery,BatteryController,BatterySocLimiter,Circuit,Tariff)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -package api -destination mock.go github.com/evcc-io/evcc/api Charger,ChargeState,CurrentLimiter,CurrentGetter,PhaseSwitcher,PhaseGetter,FeatureDescriber,Identifier,Meter,MeterEnergy,PhaseCurrents,Vehicle,ChargeRater,Battery,BatteryController,BatterySocLimiter,Circuit,Tariff
|
||||
// mockgen -package api -destination mock.go github.com/evcc-io/evcc/api Charger,ChargeState,CurrentLimiter,CurrentGetter,PhaseSwitcher,PhaseGetter,FeatureDescriber,Identifier,Meter,MeterEnergy,PhaseCurrents,Vehicle,ConnectionTimer,ChargeRater,Battery,BatteryController,BatterySocLimiter,Circuit,Tariff
|
||||
//
|
||||
|
||||
// Package api is a generated GoMock package.
|
||||
|
|
@ -11,6 +11,7 @@ package api
|
|||
|
||||
import (
|
||||
reflect "reflect"
|
||||
time "time"
|
||||
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
|
@ -637,6 +638,45 @@ func (mr *MockVehicleMockRecorder) Soc() *gomock.Call {
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Soc", reflect.TypeOf((*MockVehicle)(nil).Soc))
|
||||
}
|
||||
|
||||
// MockConnectionTimer is a mock of ConnectionTimer interface.
|
||||
type MockConnectionTimer struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockConnectionTimerMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockConnectionTimerMockRecorder is the mock recorder for MockConnectionTimer.
|
||||
type MockConnectionTimerMockRecorder struct {
|
||||
mock *MockConnectionTimer
|
||||
}
|
||||
|
||||
// NewMockConnectionTimer creates a new mock instance.
|
||||
func NewMockConnectionTimer(ctrl *gomock.Controller) *MockConnectionTimer {
|
||||
mock := &MockConnectionTimer{ctrl: ctrl}
|
||||
mock.recorder = &MockConnectionTimerMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockConnectionTimer) EXPECT() *MockConnectionTimerMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// ConnectionDuration mocks base method.
|
||||
func (m *MockConnectionTimer) ConnectionDuration() (time.Duration, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ConnectionDuration")
|
||||
ret0, _ := ret[0].(time.Duration)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ConnectionDuration indicates an expected call of ConnectionDuration.
|
||||
func (mr *MockConnectionTimerMockRecorder) ConnectionDuration() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConnectionDuration", reflect.TypeOf((*MockConnectionTimer)(nil).ConnectionDuration))
|
||||
}
|
||||
|
||||
// MockChargeRater is a mock of ChargeRater interface.
|
||||
type MockChargeRater struct {
|
||||
ctrl *gomock.Controller
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue