Skip to content

Commit

Permalink
fix: ensure built sample meterValues value can't be overriden
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <[email protected]>
  • Loading branch information
Jérôme Benoit committed Nov 16, 2023
1 parent 969c488 commit 1b2cdda
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ??
Expand All @@ -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;
}
Expand Down

0 comments on commit 1b2cdda

Please sign in to comment.