Repository: evcc-io/evcc
Pull request #4105 (2022-08-13 12:02:43)

chore: rename ChargePhases api to PhaseSwitcher


Patch:
diff --git a/api/api.go b/api/api.go
index fedc6403..0b47130c 100644
--- a/api/api.go
+++ b/api/api.go
@@ -10,7 +10,7 @@ import (
 	"github.com/fatih/structs"
 )
 
-//go:generate mockgen -package mock -destination ../mock/mock_api.go github.com/evcc-io/evcc/api Charger,ChargeState,ChargePhases,Identifier,Meter,MeterEnergy,Vehicle,ChargeRater,Battery
+//go:generate mockgen -package mock -destination ../mock/mock_api.go github.com/evcc-io/evcc/api Charger,ChargeState,PhaseSwitcher,Identifier,Meter,MeterEnergy,Vehicle,ChargeRater,Battery
 
 // ChargeMode are charge modes modeled after OpenWB
 type ChargeMode string
@@ -107,8 +107,8 @@ type ChargerEx interface {
 	MaxCurrentMillis(current float64) error
 }
 
-// ChargePhases provides 1p3p switching
-type ChargePhases interface {
+// PhaseSwitcher provides 1p3p switching
+type PhaseSwitcher interface {
 	Phases1p3p(phases int) error
 }
 
diff --git a/charger/_blueprint.go b/charger/_blueprint.go
index d06ca3be..1aaa1c90 100644
--- a/charger/_blueprint.go
+++ b/charger/_blueprint.go
@@ -116,9 +116,9 @@ func (wb *Blueprint) Identify() (string, error) {
 	return "", api.ErrNotAvailable
 }
 
-var _ api.ChargePhases = (*Blueprint)(nil)
+var _ api.PhaseSwitcher = (*Blueprint)(nil)
 
-// Phases1p3p implements the api.ChargePhases interface
+// Phases1p3p implements the api.PhaseSwitcher interface
 func (wb *Blueprint) Phases1p3p(phases int) error {
 	return api.ErrNotAvailable
 }
diff --git a/charger/abb.go b/charger/abb.go
index 09f447bb..c7f47015 100644
--- a/charger/abb.go
+++ b/charger/abb.go
@@ -249,9 +249,9 @@ func (wb *ABB) Currents() (float64, float64, float64, error) {
 	return curr[0], curr[1], curr[2], nil
 }
 
-// var _ api.ChargePhases = (*ABB)(nil)
+// var _ api.PhaseSwitcher = (*ABB)(nil)
 
-// // Phases1p3p implements the api.ChargePhases interface
+// // Phases1p3p implements the api.PhaseSwitcher interface
 // func (wb *ABB) Phases1p3p(phases int) error {
 // 	var b uint16 = 1
 // 	if phases != 1 {
diff --git a/charger/alfen.go b/charger/alfen.go
index 3e3cd398..b5405a73 100644
--- a/charger/alfen.go
+++ b/charger/alfen.go
@@ -228,9 +228,9 @@ func (wb *Alfen) Currents() (float64, float64, float64, error) {
 	return currents[0], currents[1], currents[2], nil
 }
 
-var _ api.ChargePhases = (*Alfen)(nil)
+var _ api.PhaseSwitcher = (*Alfen)(nil)
 
-// Phases1p3p implements the api.ChargePhases interface
+// Phases1p3p implements the api.PhaseSwitcher interface
 func (c *Alfen) Phases1p3p(phases int) error {
 	_, err := c.conn.WriteSingleRegister(alfenRegPhases, uint16(phases))
 	return err
diff --git a/charger/dadapower.go b/charger/dadapower.go
index 25cbcd91..ad334545 100644
--- a/charger/dadapower.go
+++ b/charger/dadapower.go
@@ -205,9 +205,9 @@ func (wb *Dadapower) Currents() (float64, float64, float64, error) {
 	return currents[0], currents[1], currents[2], nil
 }
 
-var _ api.ChargePhases = (*Dadapower)(nil)
+var _ api.PhaseSwitcher = (*Dadapower)(nil)
 
-// Phases1p3p implements the api.ChargePhases interface
+// Phases1p3p implements the api.PhaseSwitcher interface
 func (wb *Dadapower) Phases1p3p(phases int) error {
 	_, err := wb.conn.WriteSingleRegister(dadapowerRegActivePhases+wb.regOffset, uint16(phases))
 	return err
diff --git a/charger/easee.go b/charger/easee.go
index 468838ba..44dd43e3 100644
--- a/charger/easee.go
+++ b/charger/easee.go
@@ -406,9 +406,9 @@ func (c *Easee) MaxCurrent(current int64) error {
 	return err
 }
 
-var _ api.ChargePhases = (*Easee)(nil)
+var _ api.PhaseSwitcher = (*Easee)(nil)
 
-// Phases1p3p implements the api.ChargePhases interface
+// Phases1p3p implements the api.PhaseSwitcher interface
 func (c *Easee) Phases1p3p(phases int) error {
 	var err error
 	if c.circuit != 0 {
diff --git a/charger/go-e.go b/charger/go-e.go
index 73921221..3ddb5e9d 100644
--- a/charger/go-e.go
+++ b/charger/go-e.go
@@ -41,7 +41,7 @@ func init() {
 	registry.Add("go-e", NewGoEFromConfig)
 }
 
-// go:generate go run ../cmd/tools/decorate.go -f decorateGoE -b *GoE -r api.Charger -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.ChargePhases,Phases1p3p,func(int) (error)"
+// go:generate go run ../cmd/tools/decorate.go -f decorateGoE -b *GoE -r api.Charger -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseSwitcher,Phases1p3p,func(int) (error)"
 
 // NewGoEFromConfig creates a go-e charger from generic config
 func NewGoEFromConfig(other map[string]interface{}) (api.Charger, error) {
@@ -205,7 +205,7 @@ func (c *GoE) totalEnergy() (float64, error) {
 	return val, err
 }
 
-// phases1p3p implements the api.ChargePhases interface - v2 only
+// phases1p3p implements the api.PhaseSwitcher interface - v2 only
 func (c *GoE) phases1p3p(phases int) error {
 	if phases == 3 {
 		phases = 2
diff --git a/charger/go-e_decorators.go b/charger/go-e_decorators.go
index 0d3f2746..1789bdf1 100644
--- a/charger/go-e_decorators.go
+++ b/charger/go-e_decorators.go
@@ -6,12 +6,12 @@ import (
 	"github.com/evcc-io/evcc/api"
 )
 
-func decorateGoE(base *GoE, meterEnergy func() (float64, error), chargePhases func(phases int) error) api.Charger {
+func decorateGoE(base *GoE, meterEnergy func() (float64, error), phaseSwitcher func(phases int) error) api.Charger {
 	switch {
-	case chargePhases == nil && meterEnergy == nil:
+	case phaseSwitcher == nil && meterEnergy == nil:
 		return base
 
-	case chargePhases == nil && meterEnergy != nil:
+	case phaseSwitcher == nil && meterEnergy != nil:
 		return &struct {
 			*GoE
 			api.MeterEnergy
@@ -22,26 +22,26 @@ func decorateGoE(base *GoE, meterEnergy func() (float64, error), chargePhases fu
 			},
 		}
 
-	case chargePhases != nil && meterEnergy == nil:
+	case phaseSwitcher != nil && meterEnergy == nil:
 		return &struct {
 			*GoE
-			api.ChargePhases
+			api.PhaseSwitcher
 		}{
 			GoE: base,
-			ChargePhases: &decorateGoEChargePhasesImpl{
-				chargePhases: chargePhases,
+			PhaseSwitcher: &decorateGoEPhaseSwitcherImpl{
+				phaseSwitcher: phaseSwitcher,
 			},
 		}
 
-	case chargePhases != nil && meterEnergy != nil:
+	case phaseSwitcher != nil && meterEnergy != nil:
 		return &struct {
 			*GoE
-			api.ChargePhases
+			api.PhaseSwitcher
 			api.MeterEnergy
 		}{
 			GoE: base,
-			ChargePhases: &decorateGoEChargePhasesImpl{
-				chargePhases: chargePhases,
+			PhaseSwitcher: &decorateGoEPhaseSwitcherImpl{
+				phaseSwitcher: phaseSwitcher,
 			},
 			MeterEnergy: &decorateGoEMeterEnergyImpl{
 				meterEnergy: meterEnergy,
@@ -52,12 +52,12 @@ func decorateGoE(base *GoE, meterEnergy func() (float64, error), chargePhases fu
 	return nil
 }
 
-type decorateGoEChargePhasesImpl struct {
-	chargePhases func(int) error
+type decorateGoEPhaseSwitcherImpl struct {
+	phaseSwitcher func(int) error
 }
 
-func (impl *decorateGoEChargePhasesImpl) Phases1p3p(phases int) error {
-	return impl.chargePhases(phases)
+func (impl *decorateGoEPhaseSwitcherImpl) Phases1p3p(phases int) error {
+	return impl.phaseSwitcher(phases)
 }
 
 type decorateGoEMeterEnergyImpl struct {
diff --git a/charger/kse.go b/charger/kse.go
index 88d432d4..4cb46de6 100644
--- a/charger/kse.go
+++ b/charger/kse.go
@@ -203,9 +203,9 @@ func (wb *KSE) Currents() (float64, float64, float64, error) {
 	return curr[0], curr[1], curr[2], nil
 }
 
-// var _ api.ChargePhases = (*KSE)(nil)
+// var _ api.PhaseSwitcher = (*KSE)(nil)
 
-// // Phases1p3p implements the api.ChargePhases interface
+// // Phases1p3p implements the api.PhaseSwitcher interface
 // func (wb *KSE) Phases1p3p(phases int) error {
 // 	var b uint16 = 0
 // 	if phases == 1 {
diff --git a/charger/ocpp.go b/charger/ocpp.go
index e6d54439..e2c80b47 100644
--- a/charger/ocpp.go
+++ b/charger/ocpp.go
@@ -332,7 +332,7 @@ func (c *OCPP) Status() (api.ChargeStatus, error) {
 	return c.cp.Status()
 }
 
-// TODO: Phases1p3p implements the api.ChargePhases interface
+// TODO: Phases1p3p implements the api.PhaseSwitcher interface
 // func (c *OCPP) Phases1p3p(phases int) error {
 // 	if !c.phaseSwitchingSupported {
 // 		return fmt.Errorf("phase switching is not supported by the charger")
diff --git a/charger/openwb-pro.go b/charger/openwb-pro.go
index 9db7323b..03a781fe 100644
--- a/charger/openwb-pro.go
+++ b/charger/openwb-pro.go
@@ -180,9 +180,9 @@ func (wb *OpenWBPro) Currents() (float64, float64, float64, error) {
 	return res.Currents[0], res.Currents[1], res.Currents[2], err
 }
 
-var _ api.ChargePhases = (*OpenWBPro)(nil)
+var _ api.PhaseSwitcher = (*OpenWBPro)(nil)
 
-// Phases1p3p implements the api.ChargePhases interface
+// Phases1p3p implements the api.PhaseSwitcher interface
 func (wb *OpenWBPro) Phases1p3p(phases int) error {
 	return wb.set(fmt.Sprintf("phasetarget=%d", phases))
 }
diff --git a/charger/openwb.go b/charger/openwb.go
index b5c423ad..d0c1a064 100644
--- a/charger/openwb.go
+++ b/charger/openwb.go
@@ -29,7 +29,7 @@ type OpenWB struct {
 	authS         func(string) error
 }
 
-// go:generate go run ../cmd/tools/decorate.go -f decorateOpenWB -b *OpenWB -r api.Charger -t "api.ChargePhases,Phases1p3p,func(int) (error)" -t "api.Battery,SoC,func() (float64, error)"
+// go:generate go run ../cmd/tools/decorate.go -f decorateOpenWB -b *OpenWB -r api.Charger -t "api.PhaseSwitcher,Phases1p3p,func(int) (error)" -t "api.Battery,SoC,func() (float64, error)"
 
 // NewOpenWBFromConfig creates a new configurable charger
 func NewOpenWBFromConfig(other map[string]interface{}) (api.Charger, error) {
diff --git a/charger/openwb_decorators.go b/charger/openwb_decorators.go
index 64a37978..0460ec6d 100644
--- a/charger/openwb_decorators.go
+++ b/charger/openwb_decorators.go
@@ -6,23 +6,23 @@ import (
 	"github.com/evcc-io/evcc/api"
 )
 
-func decorateOpenWB(base *OpenWB, chargePhases func(int) error, battery func() (float64, error)) api.Charger {
+func decorateOpenWB(base *OpenWB, phaseSwitcher func(int) error, battery func() (float64, error)) api.Charger {
 	switch {
-	case battery == nil && chargePhases == nil:
+	case battery == nil && phaseSwitcher == nil:
 		return base
 
-	case battery == nil && chargePhases != nil:
+	case battery == nil && phaseSwitcher != nil:
 		return &struct {
 			*OpenWB
-			api.ChargePhases
+			api.PhaseSwitcher
 		}{
 			OpenWB: base,
-			ChargePhases: &decorateOpenWBChargePhasesImpl{
-				chargePhases: chargePhases,
+			PhaseSwitcher: &decorateOpenWBPhaseSwitcherImpl{
+				phaseSwitcher: phaseSwitcher,
 			},
 		}
 
-	case battery != nil && chargePhases == nil:
+	case battery != nil && phaseSwitcher == nil:
 		return &struct {
 			*OpenWB
 			api.Battery
@@ -33,18 +33,18 @@ func decorateOpenWB(base *OpenWB, chargePhases func(int) error, battery func() (
 			},
 		}
 
-	case battery != nil && chargePhases != nil:
+	case battery != nil && phaseSwitcher != nil:
 		return &struct {
 			*OpenWB
 			api.Battery
-			api.ChargePhases
+			api.PhaseSwitcher
 		}{
 			OpenWB: base,
 			Battery: &decorateOpenWBBatteryImpl{
 				battery: battery,
 			},
-			ChargePhases: &decorateOpenWBChargePhasesImpl{
-				chargePhases: chargePhases,
+			PhaseSwitcher: &decorateOpenWBPhaseSwitcherImpl{
+				phaseSwitcher: phaseSwitcher,
 			},
 		}
 	}
@@ -60,10 +60,10 @@ func (impl *decorateOpenWBBatteryImpl) SoC() (float64, error) {
 	return impl.battery()
 }
 
-type decorateOpenWBChargePhasesImpl struct {
-	chargePhases func(int) error
+type decorateOpenWBPhaseSwitcherImpl struct {
+	phaseSwitcher func(int) error
 }
 
-func (impl *decorateOpenWBChargePhasesImpl) Phases1p3p(phases int) error {
-	return impl.chargePhases(phases)
+func (impl *decorateOpenWBPhaseSwitcherImpl) Phases1p3p(phases int) error {
+	return impl.phaseSwitcher(phases)
 }
diff --git a/core/loadpoint.go b/core/loadpoint.go
index f72f844e..64179d4e 100644
--- a/core/loadpoint.go
+++ b/core/loadpoint.go
@@ -219,7 +219,7 @@ func NewLoadPointFromConfig(log *util.Logger, cp configProvider, other map[strin
 	// setup fixed phases:
 	// - simple charger starts with phases config if specified or 3p
 	// - switchable charger starts at 0p since we don't know the current setting
-	if _, ok := lp.charger.(api.ChargePhases); !ok {
+	if _, ok := lp.charger.(api.PhaseSwitcher); !ok {
 		if lp.DefaultPhases == 0 {
 			lp.DefaultPhases = 3
 			lp.log.WARN.Println("phases not configured, assuming 3p")
@@ -1014,13 +1014,13 @@ func (lp *LoadPoint) resetPVTimerIfRunning(typ ...string) {
 	lp.publishTimer(pvTimer, 0, timerInactive)
 }
 
-// scalePhasesIfAvailable scales if api.ChargePhases is available
+// scalePhasesIfAvailable scales if api.PhaseSwitcher is available
 func (lp *LoadPoint) scalePhasesIfAvailable(phases int) error {
 	if lp.DefaultPhases != 0 {
 		phases = lp.DefaultPhases
 	}
 
-	if _, ok := lp.charger.(api.ChargePhases); ok {
+	if _, ok := lp.charger.(api.PhaseSwitcher); ok {
 		return lp.scalePhases(phases)
 	}
 
@@ -1036,7 +1036,7 @@ func (lp *LoadPoint) setDefaultPhases(phases int) {
 	lp.phaseTimer = time.Time{}
 
 	// publish 1p3p capability and phase configuration
-	if _, ok := lp.charger.(api.ChargePhases); ok {
+	if _, ok := lp.charger.(api.PhaseSwitcher); ok {
 		lp.publish("phases1p3p", lp.DefaultPhases)
 	} else {
 		lp.publish("phases1p3p", nil)
@@ -1059,11 +1059,11 @@ func (lp *LoadPoint) setPhases(phases int) {
 }
 
 // scalePhases adjusts the number of active phases and returns the appropriate charging current.
-// Returns api.ErrNotAvailable if api.ChargePhases is not available.
+// Returns api.ErrNotAvailable if api.PhaseSwitcher is not available.
 func (lp *LoadPoint) scalePhases(phases int) error {
-	cp, ok := lp.charger.(api.ChargePhases)
+	cp, ok := lp.charger.(api.PhaseSwitcher)
 	if !ok {
-		panic("charger does not implement api.ChargePhases")
+		panic("charger does not implement api.PhaseSwitcher")
 	}
 
 	if lp.GetPhases() != phases {
@@ -1210,7 +1210,7 @@ func (lp *LoadPoint) pvMaxCurrent(mode api.ChargeMode, sitePower float64, batter
 	maxCurrent := lp.GetMaxCurrent()
 
 	// switch phases up/down
-	if _, ok := lp.charger.(api.ChargePhases); ok {
+	if _, ok := lp.charger.(api.PhaseSwitcher); ok {
 		availablePower := -sitePower + lp.chargePower
 
 		// in case of scaling, keep charger disabled for this cycle
diff --git a/core/loadpoint_api.go b/core/loadpoint_api.go
index dae5fbd2..886bf909 100644
--- a/core/loadpoint_api.go
+++ b/core/loadpoint_api.go
@@ -108,7 +108,7 @@ func (lp *LoadPoint) GetPhases() int {
 // SetPhases sets loadpoint enabled phases
 func (lp *LoadPoint) SetPhases(phases int) error {
 	// limit auto mode (phases=0) to scalable charger
-	if _, ok := lp.charger.(api.ChargePhases); !ok && phases == 0 {
+	if _, ok := lp.charger.(api.PhaseSwitcher); !ok && phases == 0 {
 		return fmt.Errorf("invalid number of phases: %d", phases)
 	}
 
@@ -120,7 +120,7 @@ func (lp *LoadPoint) SetPhases(phases int) error {
 	lp.setDefaultPhases(phases)
 
 	// apply immediately if not 1p3p
-	if _, ok := lp.charger.(api.ChargePhases); !ok {
+	if _, ok := lp.charger.(api.PhaseSwitcher); !ok {
 		lp.setPhases(phases)
 	}
 
diff --git a/core/loadpoint_phases.go b/core/loadpoint_phases.go
index dacdf329..714b1b5c 100644
--- a/core/loadpoint_phases.go
+++ b/core/loadpoint_phases.go
@@ -64,7 +64,7 @@ func (lp *LoadPoint) maxActivePhases() int {
 	}
 
 	// if 1p3p supported then assume configured limit or 3p
-	if _, ok := lp.charger.(api.ChargePhases); ok {
+	if _, ok := lp.charger.(api.PhaseSwitcher); ok {
 		physical = lp.DefaultPhases
 		if physical == 0 {
 			physical = 3
diff --git a/core/site.go b/core/site.go
index b665993b..0bf5dd90 100644
--- a/core/site.go
+++ b/core/site.go
@@ -227,7 +227,7 @@ func (site *Site) DumpConfig() {
 		_, power := lp.charger.(api.Meter)
 		_, energy := lp.charger.(api.MeterEnergy)
 		_, currents := lp.charger.(api.MeterCurrent)
-		_, phases := lp.charger.(api.ChargePhases)
+		_, phases := lp.charger.(api.PhaseSwitcher)
 		_, wakeup := lp.charger.(api.Resurrector)
 
 		lp.log.INFO.Printf("  charger:     power %s energy %s currents %s phases %s wakeup %s",
diff --git a/mock/mock_api.go b/mock/mock_api.go
index 0e8405bc..ac54f4e3 100644
--- a/mock/mock_api.go
+++ b/mock/mock_api.go
@@ -1,5 +1,5 @@
 // Code generated by MockGen. DO NOT EDIT.
-// Source: github.com/evcc-io/evcc/api (interfaces: Charger,ChargeState,ChargePhases,Identifier,Meter,MeterEnergy,Vehicle,ChargeRater,Battery)
+// Source: github.com/evcc-io/evcc/api (interfaces: Charger,ChargeState,PhaseSwitcher,Identifier,Meter,MeterEnergy,Vehicle,ChargeRater,Battery)
 
 // Package mock is a generated GoMock package.
 package mock
@@ -130,31 +130,31 @@ func (mr *MockChargeStateMockRecorder) Status() *gomock.Call {
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Status", reflect.TypeOf((*MockChargeState)(nil).Status))
 }
 
-// MockChargePhases is a mock of ChargePhases interface.
-type MockChargePhases struct {
+// MockPhaseSwitcher is a mock of PhaseSwitcher interface.
+type MockPhaseSwitcher struct {
 	ctrl     *gomock.Controller
-	recorder *MockChargePhasesMockRecorder
+	recorder *MockPhaseSwitcherMockRecorder
 }
 
-// MockChargePhasesMockRecorder is the mock recorder for MockChargePhases.
-type MockChargePhasesMockRecorder struct {
-	mock *MockChargePhases
+// MockPhaseSwitcherMockRecorder is the mock recorder for MockPhaseSwitcher.
+type MockPhaseSwitcherMockRecorder struct {
+	mock *MockPhaseSwitcher
 }
 
-// NewMockChargePhases creates a new mock instance.
-func NewMockChargePhases(ctrl *gomock.Controller) *MockChargePhases {
-	mock := &MockChargePhases{ctrl: ctrl}
-	mock.recorder = &MockChargePhasesMockRecorder{mock}
+// NewMockPhaseSwitcher creates a new mock instance.
+func NewMockPhaseSwitcher(ctrl *gomock.Controller) *MockPhaseSwitcher {
+	mock := &MockPhaseSwitcher{ctrl: ctrl}
+	mock.recorder = &MockPhaseSwitcherMockRecorder{mock}
 	return mock
 }
 
 // EXPECT returns an object that allows the caller to indicate expected use.
-func (m *MockChargePhases) EXPECT() *MockChargePhasesMockRecorder {
+func (m *MockPhaseSwitcher) EXPECT() *MockPhaseSwitcherMockRecorder {
 	return m.recorder
 }
 
 // Phases1p3p mocks base method.
-func (m *MockChargePhases) Phases1p3p(arg0 int) error {
+func (m *MockPhaseSwitcher) Phases1p3p(arg0 int) error {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "Phases1p3p", arg0)
 	ret0, _ := ret[0].(error)
@@ -162,9 +162,9 @@ func (m *MockChargePhases) Phases1p3p(arg0 int) error {
 }
 
 // Phases1p3p indicates an expected call of Phases1p3p.
-func (mr *MockChargePhasesMockRecorder) Phases1p3p(arg0 interface{}) *gomock.Call {
+func (mr *MockPhaseSwitcherMockRecorder) Phases1p3p(arg0 interface{}) *gomock.Call {
 	mr.mock.ctrl.T.Helper()
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Phases1p3p", reflect.TypeOf((*MockChargePhases)(nil).Phases1p3p), arg0)
+	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Phases1p3p", reflect.TypeOf((*MockPhaseSwitcher)(nil).Phases1p3p), arg0)
 }
 
 // MockIdentifier is a mock of Identifier interface.


Test patch:
diff --git a/charger/go-e_test.go b/charger/go-e_test.go
index c56ce2a4..4c8a7e6f 100644
--- a/charger/go-e_test.go
+++ b/charger/go-e_test.go
@@ -82,7 +82,7 @@ func TestGoEV2(t *testing.T) {
 		t.Error("missing MeterEnergy api")
 	}
 
-	if _, ok := wb.(api.ChargePhases); !ok {
-		t.Error("missing ChargePhases api")
+	if _, ok := wb.(api.PhaseSwitcher); !ok {
+		t.Error("missing PhaseSwitcher api")
 	}
 }
diff --git a/core/loadpoint_phases_test.go b/core/loadpoint_phases_test.go
index 5979b638..00e53dc4 100644
--- a/core/loadpoint_phases_test.go
+++ b/core/loadpoint_phases_test.go
@@ -81,9 +81,9 @@ func TestMaxActivePhases(t *testing.T) {
 			plainCharger := mock.NewMockCharger(ctrl)
 
 			// 1p3p
-			var phaseCharger *mock.MockChargePhases
+			var phaseCharger *mock.MockPhaseSwitcher
 			if tc.capable == 0 {
-				phaseCharger = mock.NewMockChargePhases(ctrl)
+				phaseCharger = mock.NewMockPhaseSwitcher(ctrl)
 			}
 
 			vehicle := mock.NewMockVehicle(ctrl)
@@ -99,7 +99,7 @@ func TestMaxActivePhases(t *testing.T) {
 			if phaseCharger != nil {
 				lp.charger = struct {
 					*mock.MockCharger
-					*mock.MockChargePhases
+					*mock.MockPhaseSwitcher
 				}{
 					plainCharger, phaseCharger,
 				}
@@ -169,9 +169,9 @@ func TestPvScalePhases(t *testing.T) {
 		plainCharger.EXPECT().MaxCurrent(int64(minA)).Return(nil) // MaxCurrentEx not implemented
 
 		// 1p3p
-		var phaseCharger *mock.MockChargePhases
+		var phaseCharger *mock.MockPhaseSwitcher
 		if tc.capable == 0 {
-			phaseCharger = mock.NewMockChargePhases(ctrl)
+			phaseCharger = mock.NewMockPhaseSwitcher(ctrl)
 		}
 
 		vehicle := mock.NewMockVehicle(ctrl)
@@ -197,7 +197,7 @@ func TestPvScalePhases(t *testing.T) {
 		if phaseCharger != nil {
 			lp.charger = struct {
 				*mock.MockCharger
-				*mock.MockChargePhases
+				*mock.MockPhaseSwitcher
 			}{
 				plainCharger, phaseCharger,
 			}
@@ -261,10 +261,10 @@ func TestPvScalePhasesTimer(t *testing.T) {
 	ctrl := gomock.NewController(t)
 	charger := &struct {
 		*mock.MockCharger
-		*mock.MockChargePhases
+		*mock.MockPhaseSwitcher
 	}{
 		mock.NewMockCharger(ctrl),
-		mock.NewMockChargePhases(ctrl),
+		mock.NewMockPhaseSwitcher(ctrl),
 	}
 
 	dt := time.Minute
@@ -365,7 +365,7 @@ func TestPvScalePhasesTimer(t *testing.T) {
 		}
 
 		if tc.res {
-			charger.MockChargePhases.EXPECT().Phases1p3p(tc.toPhases).Return(nil)
+			charger.MockPhaseSwitcher.EXPECT().Phases1p3p(tc.toPhases).Return(nil)
 		}
 
 		res := lp.pvScalePhases(tc.availablePower, minA, maxA)
@@ -400,14 +400,14 @@ func TestScalePhasesIfAvailable(t *testing.T) {
 		t.Log(tc)
 
 		plainCharger := mock.NewMockCharger(ctrl)
-		phaseCharger := mock.NewMockChargePhases(ctrl)
+		phaseCharger := mock.NewMockPhaseSwitcher(ctrl)
 
 		lp := &LoadPoint{
 			log:   util.NewLogger("foo"),
 			clock: clock.NewMock(),
 			charger: struct {
 				*mock.MockCharger
-				*mock.MockChargePhases
+				*mock.MockPhaseSwitcher
 			}{
 				plainCharger,
 				phaseCharger,