From: Jérôme Benoit Date: Mon, 7 Feb 2022 13:36:16 +0000 (+0100) Subject: Allow incoming ChangeConfiguration requests before the registration on X-Git-Tag: v1.1.45~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c18084e22955bbbe514bb3ecef8818417407608d;p=e-mobility-charging-stations-simulator.git Allow incoming ChangeConfiguration requests before the registration on OCPP server Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 4988a9ef..03a06960 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -52,7 +52,8 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer && (commandName === OCPP16IncomingRequestCommand.REMOTE_START_TRANSACTION || commandName === OCPP16IncomingRequestCommand.REMOTE_STOP_TRANSACTION)) { throw new OCPPError(ErrorType.SECURITY_ERROR, `${commandName} cannot be issued to handle request payload ${JSON.stringify(commandPayload, null, 2)} while charging station is in pending state`, commandName); } - if (this.chargingStation.isRegistered()) { + // FIXME: Add template tunable for accepting incoming ChangeConfiguration request while in unknown state + if (this.chargingStation.isRegistered() || (this.chargingStation.isInUnknownState() && commandName === OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION)) { if (this.incomingRequestHandlers.has(commandName)) { try { // Call the method to build the result diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index af116c4e..7b179c3f 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -32,7 +32,7 @@ export default abstract class OCPPRequestService { }): Promise { if (this.chargingStation.isInRejectedState() || (this.chargingStation.isInPendingState() && !params.triggerMessage)) { throw new OCPPError(ErrorType.SECURITY_ERROR, 'Cannot send command payload if the charging station is not in accepted state', commandName); - } else if ((this.chargingStation.isInUnknownState() && commandName === RequestCommand.BOOT_NOTIFICATION) + } else if ((this.chargingStation.isInUnknownState() && (commandName === RequestCommand.BOOT_NOTIFICATION || commandName === IncomingRequestCommand.CHANGE_CONFIGURATION)) || this.chargingStation.isInAcceptedState() || (this.chargingStation.isInPendingState() && params.triggerMessage)) { // eslint-disable-next-line @typescript-eslint/no-this-alias const self = this;