diff --git a/charger/ocpp.go b/charger/ocpp.go index 19fe8b95f..0e965b56e 100644 --- a/charger/ocpp.go +++ b/charger/ocpp.go @@ -24,7 +24,6 @@ const statusTimeout = 30 * time.Second type OCPP struct { log *util.Logger cp *ocpp.CP - id string connector int idtag string phases int @@ -104,7 +103,6 @@ func NewOCPP(id string, connector int, idtag string, meterValues string, meterIn c := &OCPP{ log: util.NewLogger(unit), cp: cp, - id: id, connector: connector, idtag: idtag, } @@ -228,7 +226,7 @@ func (c *OCPP) hasMeasurement(val types.Measurand) bool { func (c *OCPP) configure(key, val string) error { rc := make(chan error, 1) - err := ocpp.Instance().ChangeConfiguration(c.id, func(resp *core.ChangeConfigurationConfirmation, err error) { + err := ocpp.Instance().ChangeConfiguration(c.cp.ID(), func(resp *core.ChangeConfigurationConfirmation, err error) { c.log.TRACE.Printf("ChangeConfiguration: %v", resp) if err == nil && resp != nil && resp.Status != core.ConfigurationStatusAccepted { @@ -270,7 +268,7 @@ func (c *OCPP) Enable(enable bool) error { rc := make(chan error, 1) if enable { - err = ocpp.Instance().RemoteStartTransaction(c.id, func(resp *core.RemoteStartTransactionConfirmation, err error) { + err = ocpp.Instance().RemoteStartTransaction(c.cp.ID(), func(resp *core.RemoteStartTransactionConfirmation, err error) { c.log.TRACE.Printf("RemoteStartTransaction: %+v", resp) if err == nil && resp != nil && resp.Status != types.RemoteStartStopStatusAccepted { @@ -282,7 +280,7 @@ func (c *OCPP) Enable(enable bool) error { request.ConnectorId = &c.connector }) } else { - err = ocpp.Instance().RemoteStopTransaction(c.id, func(resp *core.RemoteStopTransactionConfirmation, err error) { + err = ocpp.Instance().RemoteStopTransaction(c.cp.ID(), func(resp *core.RemoteStopTransactionConfirmation, err error) { c.log.TRACE.Printf("RemoteStopTransaction: %+v", resp) if err == nil && resp != nil && resp.Status != types.RemoteStartStopStatusAccepted { @@ -300,7 +298,7 @@ func (c *OCPP) setChargingProfile(connectorid int, profile *types.ChargingProfil c.log.TRACE.Printf("SetChargingProfileRequest: %+v (%+v)", profile, *profile.ChargingSchedule) rc := make(chan error, 1) - err := ocpp.Instance().SetChargingProfile(c.id, func(resp *smartcharging.SetChargingProfileConfirmation, err error) { + err := ocpp.Instance().SetChargingProfile(c.cp.ID(), func(resp *smartcharging.SetChargingProfileConfirmation, err error) { c.log.TRACE.Printf("SetChargingProfile: %+v", resp) if err == nil && resp != nil && resp.Status != smartcharging.ChargingProfileStatusAccepted { err = errors.New(string(resp.Status))