From 1b2cddaccac1c179067c7b8ce190c625c37dd5c5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 16 Nov 2023 20:43:32 +0100 Subject: [PATCH] fix: ensure built sample meterValues value can't be overriden MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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; } -- 2.34.1