From 086023f7b8d83d4915225287f8a63087a96cc9f9 Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 31 May 2026 09:07:56 +0200 Subject: [PATCH] Charger (OpenEVSE): scale CurrentPower by loadpoint phases (#30330) --- charger/openevse.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/charger/openevse.go b/charger/openevse.go index c2939e9f6..d5be22c2b 100644 --- a/charger/openevse.go +++ b/charger/openevse.go @@ -11,6 +11,7 @@ import ( "github.com/evcc-io/evcc/api" "github.com/evcc-io/evcc/api/implement" "github.com/evcc-io/evcc/charger/openevse" + "github.com/evcc-io/evcc/core/loadpoint" "github.com/evcc-io/evcc/util" "github.com/evcc-io/evcc/util/request" "github.com/evcc-io/evcc/util/transport" @@ -24,6 +25,7 @@ type OpenEVSE struct { statusG util.Cacheable[openevse.Status] current int enabled bool + lp loadpoint.API } func init() { @@ -233,7 +235,22 @@ func (c *OpenEVSE) CurrentPower() (float64, error) { return 0, err } - return res.Amp * res.Voltage / 1e3, err + // status only reports a single phase current, scale by the loadpoint phases + phases := 1 + if c.lp != nil { + if p := c.lp.GetPhases(); p != 0 { + phases = p + } + } + + return res.Amp * res.Voltage / 1e3 * float64(phases), err +} + +var _ loadpoint.Controller = (*OpenEVSE)(nil) + +// LoadpointControl implements loadpoint.Controller +func (c *OpenEVSE) LoadpointControl(lp loadpoint.API) { + c.lp = lp } // phases1p3p implements the api.PhaseSwitcher interface