Ensure heartbeat interval configuration are initialized by default
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 25 Apr 2022 21:46:24 +0000 (23:46 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 25 Apr 2022 21:46:24 +0000 (23:46 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts
src/types/ocpp/1.6/Configuration.ts

index 8b837bc347964402cb6190fda46914acf7558779..acaaa7dfe4df918ee913d92d58400dfe7254e991 100644 (file)
@@ -1237,6 +1237,12 @@ export default class ChargingStation {
   }
 
   private initializeOcppConfiguration(): void {
+    if (!this.getConfigurationKey(StandardParametersKey.HeartbeatInterval)) {
+      this.addConfigurationKey(StandardParametersKey.HeartbeatInterval, '0');
+    }
+    if (!this.getConfigurationKey(StandardParametersKey.HeartBeatInterval)) {
+      this.addConfigurationKey(StandardParametersKey.HeartBeatInterval, '0', { visible: false });
+    }
     if (
       this.getSupervisionUrlOcppConfiguration() &&
       !this.getConfigurationKey(this.getSupervisionUrlOcppKey())
index f2a08a1656b339f79ba5830b62cb2d96c575ace5..5a60af632a0372460c75cf5f739cfd6ddaa8f0c2 100644 (file)
@@ -105,13 +105,13 @@ export default class OCPP16ResponseService extends OCPPResponseService {
   private handleResponseBootNotification(payload: OCPP16BootNotificationResponse): void {
     if (payload.status === OCPP16RegistrationStatus.ACCEPTED) {
       this.chargingStation.addConfigurationKey(
-        OCPP16StandardParametersKey.HeartBeatInterval,
+        OCPP16StandardParametersKey.HeartbeatInterval,
         payload.interval.toString(),
         {},
         { overwrite: true, save: true }
       );
       this.chargingStation.addConfigurationKey(
-        OCPP16StandardParametersKey.HeartbeatInterval,
+        OCPP16StandardParametersKey.HeartBeatInterval,
         payload.interval.toString(),
         { visible: false },
         { overwrite: true, save: true }
index 8888dd45ddf28fd9d2ac64f4dc048ada9b808ac8..55528099e6496b424f56d1ab6eb097d16321455e 100644 (file)
@@ -15,8 +15,8 @@ export enum OCPP16StandardParametersKey {
   ClockAlignedDataInterval = 'ClockAlignedDataInterval',
   ConnectionTimeOut = 'ConnectionTimeOut',
   GetConfigurationMaxKeys = 'GetConfigurationMaxKeys',
-  HeartBeatInterval = 'HeartBeatInterval',
   HeartbeatInterval = 'HeartbeatInterval',
+  HeartBeatInterval = 'HeartBeatInterval',
   LightIntensity = 'LightIntensity',
   LocalAuthorizeOffline = 'LocalAuthorizeOffline',
   LocalPreAuthorize = 'LocalPreAuthorize',