Ensure configuration key have default settings values
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 13 Mar 2022 19:31:26 +0000 (20:31 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 13 Mar 2022 19:31:26 +0000 (20:31 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts

index 09cfa74f42e4d13d13245981b55e7a80d31d4921..90b788a68b83235e599c843139ef79406a610bb9 100644 (file)
@@ -632,9 +632,9 @@ export default class ChargingStation {
         reboot: false,
       };
     }
-    const readonly = options.readonly;
-    const visible = options.visible;
-    const reboot = options.reboot;
+    const readonly = options.readonly ?? false;
+    const visible = options.visible ?? true;
+    const reboot = options.reboot ?? false;
     let keyFound = this.getConfigurationKey(key);
     if (keyFound && params?.overwrite) {
       this.deleteConfigurationKey(keyFound.key, { save: false });
index 92fee6609eba8ac431a2ef01d18e48ca935e9a98..08197142faa633d4ab77166547d7d7c77cf57259 100644 (file)
@@ -111,7 +111,7 @@ export default class OCPP16ResponseService extends OCPPResponseService {
       this.chargingStation.addConfigurationKey(
         OCPP16StandardParametersKey.HeartbeatInterval,
         payload.interval.toString(),
-        { visible: false, reboot: false },
+        { visible: false },
         { overwrite: true, save: true }
       );
       this.chargingStation.heartbeatSetInterval