From: Jérôme Benoit Date: Mon, 7 Feb 2022 19:44:21 +0000 (+0100) Subject: Relax OCPP commands acceptance while the charging station is in unknown X-Git-Tag: v1.1.46~4 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5328366132d84ad844f92b2b8fc13e4418b10f5c;p=e-mobility-charging-stations-simulator.git Relax OCPP commands acceptance while the charging station is in unknown state 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 03a06960..72e4d316 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -52,8 +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); } - // FIXME: Add template tunable for accepting incoming ChangeConfiguration request while in unknown state - if (this.chargingStation.isRegistered() || (this.chargingStation.isInUnknownState() && commandName === OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION)) { + // FIXME: Add template tunable for accepting incoming configuration requests while in unknown state + if (this.chargingStation.isRegistered() || (this.chargingStation.isInUnknownState() && (commandName === OCPP16IncomingRequestCommand.GET_CONFIGURATION || commandName === OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION || commandName === OCPP16IncomingRequestCommand.CHANGE_AVAILABILITY || commandName === OCPP16IncomingRequestCommand.TRIGGER_MESSAGE))) { 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 2ec7424b..666ee577 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -32,8 +32,8 @@ 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); - // FIXME: Add template tunable for accepting incoming ChangeConfiguration request while in unknown state - } else if ((this.chargingStation.isInUnknownState() && (commandName === RequestCommand.BOOT_NOTIFICATION || commandName === IncomingRequestCommand.CHANGE_CONFIGURATION)) + // FIXME: Add template tunable for accepting incoming configuration requests while in unknown state + } else if ((this.chargingStation.isInUnknownState() && (commandName === RequestCommand.BOOT_NOTIFICATION || commandName === IncomingRequestCommand.GET_CONFIGURATION || commandName === IncomingRequestCommand.CHANGE_CONFIGURATION || commandName === IncomingRequestCommand.CHANGE_AVAILABILITY || commandName === IncomingRequestCommand.TRIGGER_MESSAGE)) || this.chargingStation.isInAcceptedState() || (this.chargingStation.isInPendingState() && params.triggerMessage)) { // eslint-disable-next-line @typescript-eslint/no-this-alias const self = this;