From: Jérôme Benoit Date: Thu, 16 Nov 2023 19:43:32 +0000 (+0100) Subject: fix: ensure built sample meterValues value can't be overriden X-Git-Tag: v1.2.25~16 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1b2cddaccac1c179067c7b8ce190c625c37dd5c5;p=e-mobility-charging-stations-simulator.git fix: ensure built sample meterValues value can't be overriden Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index b28d682e..6628fb81 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -1335,7 +1335,6 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { context?: MeterValueContext, phase?: OCPP16MeterValuePhase, ): OCPP16SampledValue { - const sampledValueValue = value ?? sampledValueTemplate?.value; const sampledValueContext = context ?? sampledValueTemplate?.context; const sampledValueLocation = sampledValueTemplate?.location ?? @@ -1350,7 +1349,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { measurand: sampledValueTemplate.measurand, }), ...(!isNullOrUndefined(sampledValueLocation) && { location: sampledValueLocation }), - ...(!isNullOrUndefined(sampledValueValue) && { value: sampledValueValue.toString() }), + ...(!isNullOrUndefined(value) && { value: value.toString() }), ...(!isNullOrUndefined(sampledValuePhase) && { phase: sampledValuePhase }), } as OCPP16SampledValue; }