Switch sockets: end session when loadpoint disabled (#11170)
This commit is contained in:
parent
9eaf420061
commit
f45ff4ee4d
3 changed files with 20 additions and 1 deletions
|
|
@ -840,6 +840,8 @@ func (c *Easee) updateSmartCharging() {
|
|||
}
|
||||
}
|
||||
|
||||
var _ loadpoint.Controller = (*Easee)(nil)
|
||||
|
||||
// LoadpointControl implements loadpoint.Controller
|
||||
func (c *Easee) LoadpointControl(lp loadpoint.API) {
|
||||
c.lp = lp
|
||||
|
|
|
|||
|
|
@ -493,6 +493,8 @@ func (c *OCPP) phases1p3p(phases int) error {
|
|||
// return "", errors.New("not implemented")
|
||||
// }
|
||||
|
||||
var _ loadpoint.Controller = (*OCPP)(nil)
|
||||
|
||||
// LoadpointControl implements loadpoint.Controller
|
||||
func (c *OCPP) LoadpointControl(lp loadpoint.API) {
|
||||
c.lp = lp
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package charger
|
||||
|
||||
import "github.com/evcc-io/evcc/api"
|
||||
import (
|
||||
"github.com/evcc-io/evcc/api"
|
||||
"github.com/evcc-io/evcc/core/loadpoint"
|
||||
)
|
||||
|
||||
// switchSocket implements the api.Charger Status and CurrentPower methods
|
||||
// using basic generic switch socket functions
|
||||
|
|
@ -9,6 +12,7 @@ type switchSocket struct {
|
|||
enabled func() (bool, error)
|
||||
currentPower func() (float64, error)
|
||||
standbypower float64
|
||||
lp loadpoint.API
|
||||
}
|
||||
|
||||
func NewSwitchSocket(
|
||||
|
|
@ -27,6 +31,10 @@ func NewSwitchSocket(
|
|||
|
||||
// Status calculates a generic switches status
|
||||
func (c *switchSocket) Status() (api.ChargeStatus, error) {
|
||||
if c.lp != nil && c.lp.GetMode() == api.ModeOff {
|
||||
return api.StatusA, nil
|
||||
}
|
||||
|
||||
res := api.StatusB
|
||||
|
||||
// static mode
|
||||
|
|
@ -83,3 +91,10 @@ func (c *switchSocket) CurrentPower() (float64, error) {
|
|||
|
||||
return power, err
|
||||
}
|
||||
|
||||
var _ loadpoint.Controller = (*switchSocket)(nil)
|
||||
|
||||
// LoadpointControl implements loadpoint.Controller
|
||||
func (c *switchSocket) LoadpointControl(lp loadpoint.API) {
|
||||
c.lp = lp
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue