fix: fix electrical specs calculation with evses
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStationConfigurationUtils.ts
index 579e2ab49f2f129f5a7e362768636b39070ed7b0..373cdc6d396dac622dfc9b2514a9dbd250d4b826 100644 (file)
@@ -35,10 +35,15 @@ export class ChargingStationConfigurationUtils {
     },
     params: AddConfigurationKeyParams = { overwrite: false, save: false }
   ): void {
-    options = options ?? ({} as ConfigurationKeyOptions);
-    options.readonly = options?.readonly ?? false;
-    options.visible = options?.visible ?? true;
-    options.reboot = options?.reboot ?? false;
+    options = {
+      ...{
+        readonly: false,
+        visible: true,
+        reboot: false,
+      },
+      ...options,
+    };
+    params = { ...{ overwrite: false, save: false }, ...params };
     let keyFound = ChargingStationConfigurationUtils.getConfigurationKey(chargingStation, key);
     if (keyFound && params?.overwrite) {
       ChargingStationConfigurationUtils.deleteConfigurationKey(chargingStation, keyFound.key, {