Skip to content

Commit

Permalink
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/loadpoint.go
Original file line number Diff line number Diff line change
@@ -426,6 +426,11 @@ func (lp *LoadPoint) Prepare(uiChan chan<- util.Param, pushChan chan<- push.Even
} else {
lp.log.ERROR.Printf("charger error: %v", err)
}

// allow charger to access loadpoint
if ctrl, ok := lp.charger.(LoadpointController); ok {
ctrl.LoadpointControl(lp)
}
}

func (lp *LoadPoint) syncCharger() {
5 changes: 5 additions & 0 deletions core/loadpoint_api.go
Original file line number Diff line number Diff line change
@@ -7,6 +7,11 @@ import (
"github.com/andig/evcc/core/wrapper"
)

// LoadpointController gives access to loadpoint
type LoadpointController interface {
LoadpointControl(LoadPointAPI)
}

// LoadPointAPI is the external loadpoint API
type LoadPointAPI interface {
Name() string
8 changes: 8 additions & 0 deletions internal/charger/easee.go
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ type Easee struct {
status easee.ChargerStatus
updated time.Time
cache time.Duration
lp core.LoadPointAPI
}

func init() {
@@ -257,3 +258,10 @@ func (c *Easee) Currents() (float64, float64, float64, error) {
res.CircuitTotalPhaseConductorCurrentL3,
err
}

var _ core.LoadpointController = (*Easee)(nil)

// LoadpointControl implements core.LoadpointController
func (c *Easee) LoadpointControl(lp core.LoadPointAPI) {
c.lp = lp
}

0 comments on commit fa527df

Please sign in to comment.