Use right registration enum at OCPP 1.6 boot notification response
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 9 Feb 2022 17:10:13 +0000 (18:10 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 9 Feb 2022 17:10:13 +0000 (18:10 +0100)
handling

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts

index 23751c33d4365477ec0d1bb0bdf92e8bbf0e5de5..b71227264432d1aaba678b39dacbd10e61cf95f6 100644 (file)
@@ -4,7 +4,6 @@ import { AuthorizeRequest, OCPP16AuthorizationStatus, OCPP16AuthorizeResponse, O
 import { HeartbeatRequest, OCPP16RequestCommand, StatusNotificationRequest } from '../../../types/ocpp/1.6/Requests';
 import { HeartbeatResponse, OCPP16BootNotificationResponse, OCPP16RegistrationStatus, StatusNotificationResponse } from '../../../types/ocpp/1.6/Responses';
 import { MeterValuesRequest, MeterValuesResponse } from '../../../types/ocpp/1.6/MeterValues';
-import { RegistrationStatus, ResponseHandler } from '../../../types/ocpp/Responses';
 
 import ChargingStation from '../../ChargingStation';
 import { ErrorType } from '../../../types/ocpp/ErrorType';
@@ -14,6 +13,7 @@ import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
 import { OCPP16StandardParametersKey } from '../../../types/ocpp/1.6/Configuration';
 import OCPPError from '../../../exception/OCPPError';
 import OCPPResponseService from '../OCPPResponseService';
+import { ResponseHandler } from '../../../types/ocpp/Responses';
 import Utils from '../../../utils/Utils';
 import logger from '../../../utils/Logger';
 
@@ -57,7 +57,7 @@ export default class OCPP16ResponseService extends OCPPResponseService {
       this.chargingStation.addConfigurationKey(OCPP16StandardParametersKey.HeartbeatInterval, payload.interval.toString(), { visible: false });
       this.chargingStation.heartbeatSetInterval ? this.chargingStation.restartHeartbeat() : this.chargingStation.startHeartbeat();
     }
-    if (Object.values(RegistrationStatus).includes(payload.status)) {
+    if (Object.values(OCPP16RegistrationStatus).includes(payload.status)) {
       const logMsg = `${this.chargingStation.logPrefix()} Charging station in '${payload.status}' state on the central server`;
       payload.status === OCPP16RegistrationStatus.REJECTED ? logger.warn(logMsg) : logger.info(logMsg);
     } else {