fix: ensure event listeners are always removed at simulator stop
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPServiceUtils.ts
index 46603f0bffeb6c34bd70b8b9c3c73a6cc52f4489..d9d712981c816790cb4e2b6f1c09fa6cd10e7dac 100644 (file)
@@ -418,20 +418,20 @@ export class OCPPServiceUtils {
   }
 
   protected static getLimitFromSampledValueTemplateCustomValue(
-    value: string,
+    value: string | undefined,
     maxLimit: number,
     minLimit: number,
     options?: { limitationEnabled?: boolean; fallbackValue?: number; unitMultiplier?: number },
   ): number {
     options = {
       ...{
-        limitationEnabled: true,
+        limitationEnabled: false,
         unitMultiplier: 1,
         fallbackValue: 0,
       },
       ...options,
     };
-    const parsedValue = parseInt(value);
+    const parsedValue = parseInt(value ?? '');
     if (options?.limitationEnabled) {
       return max(
         min((!isNaN(parsedValue) ? parsedValue : Infinity) * options.unitMultiplier!, maxLimit),