X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPServiceUtils.ts;h=d9d712981c816790cb4e2b6f1c09fa6cd10e7dac;hb=ee7c1da0e12c70134f31537a1c1e7040d309af5a;hp=46603f0bffeb6c34bd70b8b9c3c73a6cc52f4489;hpb=d71ce3fa734fcefeb3dce31d78968b847c625c92;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index 46603f0b..d9d71298 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -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),