From: Jérôme Benoit Date: Thu, 3 Aug 2023 18:21:57 +0000 (+0200) Subject: fix: fix charging profile handling at remote start transaction X-Git-Tag: v1.2.20~26 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=8e3437b114ccc1cc68d8fbbc4912e4272cc6618c;p=e-mobility-charging-stations-simulator.git fix: fix charging profile handling at remote start transaction 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 dd40ffaf..61c74a60 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -950,11 +950,13 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { ) { // Authorization successful, start transaction if ( - this.setRemoteStartTransactionChargingProfile( - chargingStation, - transactionConnectorId, - chargingProfile!, - ) === true + (chargingProfile && + this.setRemoteStartTransactionChargingProfile( + chargingStation, + transactionConnectorId, + chargingProfile, + ) === true) ?? + !chargingProfile ) { connectorStatus.transactionRemoteStarted = true; if ( @@ -985,11 +987,14 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { } // No authorization check required, start transaction if ( - this.setRemoteStartTransactionChargingProfile( - chargingStation, - transactionConnectorId, - chargingProfile!, - ) === true + (chargingProfile && + this.setRemoteStartTransactionChargingProfile( + chargingStation, + transactionConnectorId, + chargingProfile, + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + ) === true) || + !chargingProfile ) { connectorStatus.transactionRemoteStarted = true; if (