diff --git a/charger/ocpp.go b/charger/ocpp.go index a8adcfdd7..9abd476f7 100644 --- a/charger/ocpp.go +++ b/charger/ocpp.go @@ -313,6 +313,7 @@ func (c *OCPP) setCurrent(current float64) error { func (c *OCPP) createTxDefaultChargingProfile(current float64) *types.ChargingProfile { phases := c.phases period := types.NewChargingSchedulePeriod(0, current) + if c.cp.ChargingRateUnit == types.ChargingRateUnitWatts { // get (expectedly) active phases from loadpoint if c.lp != nil { @@ -322,11 +323,12 @@ func (c *OCPP) createTxDefaultChargingProfile(current float64) *types.ChargingPr phases = 3 } period = types.NewChargingSchedulePeriod(0, math.Trunc(230.0*current*float64(phases))) - } - - // OCPP assumes phases == 3 if not set - if phases != 0 { - period.NumberPhases = &phases + } else { + // OCPP assumes phases == 3 if not set + if phases != 0 { + // set explicit phase configuration + period.NumberPhases = &phases + } } res := &types.ChargingProfile{ diff --git a/charger/ocpp/cp_setup.go b/charger/ocpp/cp_setup.go index 5f9d7d49d..f9652d237 100644 --- a/charger/ocpp/cp_setup.go +++ b/charger/ocpp/cp_setup.go @@ -52,6 +52,7 @@ func (cp *CP) Setup(ctx context.Context, meterValues string, meterInterval time. case match(KeyChargingScheduleAllowedChargingRateUnit): if *opt.Value == "Power" || *opt.Value == "W" { // "W" is not allowed by spec but used by some CPs cp.ChargingRateUnit = types.ChargingRateUnitWatts + cp.PhaseSwitching = true // assume phase switching is available for power-based charging } case match(KeyConnectorSwitch3to1PhaseSupported) || match(KeyChargeAmpsPhaseSwitchingSupported):