Fix local badge authorisation
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 17 Nov 2021 17:21:03 +0000 (18:21 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 17 Nov 2021 17:21:03 +0000 (18:21 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts

index eb0bdb8036a67f2063a8ef19ac09d385831aea28..c8c6b969550aa2689fb66f9426690e18a5d7e23d 100644 (file)
@@ -296,12 +296,13 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
             this.chargingStation.getConnectorStatus(transactionConnectorId).localAuthorizeIdTag = commandPayload.idTag;
             this.chargingStation.getConnectorStatus(transactionConnectorId).idTagLocalAuthorized = true;
             authorized = true;
-          }
-          if (!authorized && this.chargingStation.getMayAuthorizeAtRemoteStart()) {
+          } else if (this.chargingStation.getMayAuthorizeAtRemoteStart()) {
             const authorizeResponse = await this.chargingStation.ocppRequestService.sendAuthorize(transactionConnectorId, commandPayload.idTag);
             if (authorizeResponse?.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
               authorized = true;
             }
+          } else {
+            logger.warn(`${this.chargingStation.logPrefix()} The charging station configuration expects authorize at remote start transaction but local authorization or authorize is enabled`);
           }
           if (authorized) {
             // Authorization successful, start transaction