- const transactionConnectorId: number = commandPayload.connectorId ?? 1;
- await this.chargingStation.ocppRequestService.sendStatusNotification(transactionConnectorId, OCPP16ChargePointStatus.PREPARING);
- this.chargingStation.getConnector(transactionConnectorId).status = OCPP16ChargePointStatus.PREPARING;
- if (this.chargingStation.isChargingStationAvailable() && this.chargingStation.isConnectorAvailable(transactionConnectorId)) {
- if (this.chargingStation.getAuthorizeRemoteTxRequests()) {
- let authorized = false;
- // Check if authorized
- if (this.chargingStation.getLocalAuthListEnabled() && this.chargingStation.hasAuthorizedTags()
- && this.chargingStation.authorizedTags.find((value) => value === commandPayload.idTag)) {
- authorized = true;
- if (commandPayload.chargingProfile && commandPayload.chargingProfile.chargingProfilePurpose === ChargingProfilePurposeType.TX_PROFILE) {
- this.chargingStation.setChargingProfile(transactionConnectorId, commandPayload.chargingProfile);
- logger.debug(`${this.chargingStation.logPrefix()} Charging profile(s) set at remote start transaction, dump their stack: %j`, this.chargingStation.getConnector(transactionConnectorId).chargingProfiles);
- } else if (commandPayload.chargingProfile && commandPayload.chargingProfile.chargingProfilePurpose !== ChargingProfilePurposeType.TX_PROFILE) {
- await this.chargingStation.ocppRequestService.sendStatusNotification(transactionConnectorId, OCPP16ChargePointStatus.AVAILABLE);
- this.chargingStation.getConnector(transactionConnectorId).status = OCPP16ChargePointStatus.AVAILABLE;
- logger.warn(`${this.chargingStation.logPrefix()} Not allowed to set ${commandPayload.chargingProfile.chargingProfilePurpose} charging profile(s) at remote start transaction`);
- return Constants.OCPP_RESPONSE_REJECTED;
- }
- }
- if (!authorized) {
- const authorizeResponse = await this.chargingStation.ocppRequestService.sendAuthorize(transactionConnectorId, commandPayload.idTag);
- if (authorizeResponse?.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
+ const transactionConnectorId: number = commandPayload.connectorId;
+ if (transactionConnectorId) {
+ await this.chargingStation.ocppRequestService.sendStatusNotification(transactionConnectorId, OCPP16ChargePointStatus.PREPARING);
+ this.chargingStation.getConnector(transactionConnectorId).status = OCPP16ChargePointStatus.PREPARING;
+ if (this.chargingStation.isChargingStationAvailable() && this.chargingStation.isConnectorAvailable(transactionConnectorId)) {
+ if (this.chargingStation.getAuthorizeRemoteTxRequests()) {
+ let authorized = false;
+ // Check if authorized
+ if (this.chargingStation.getLocalAuthListEnabled() && this.chargingStation.hasAuthorizedTags()
+ && this.chargingStation.authorizedTags.find((value) => value === commandPayload.idTag)) {