From: Jérôme Benoit Date: Fri, 13 Jan 2023 10:37:19 +0000 (+0100) Subject: Allow to specify timestamp in OCPP commands payload with the UI Server X-Git-Tag: v1.1.90~17 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b2a0452d368cfc43bbacc4991de59afa64f662a4;p=e-mobility-charging-stations-simulator.git Allow to specify timestamp in OCPP commands payload with the UI Server Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index bf63ba2e..77b5cb58 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -202,7 +202,7 @@ export default class OCPP16RequestService extends OCPPRequestService { meterStart: chargingStation.getEnergyActiveImportRegisterByConnectorId( commandParams?.connectorId as number ), - timestamp: new Date(), + timestamp: commandParams?.timestamp ?? new Date(), } as unknown as Request; case OCPP16RequestCommand.STOP_TRANSACTION: connectorId = chargingStation.getConnectorIdByTransactionId( @@ -220,7 +220,7 @@ export default class OCPP16RequestService extends OCPPRequestService { commandParams?.idTag ?? chargingStation.getTransactionIdTag(commandParams?.transactionId as number), meterStop: commandParams?.meterStop ?? energyActiveImportRegister, - timestamp: new Date(), + timestamp: commandParams?.timestamp ?? new Date(), reason: commandParams?.reason, ...(chargingStation.getTransactionDataMeterValues() && { transactionData: OCPP16ServiceUtils.buildTransactionDataMeterValues( diff --git a/src/charging-station/ocpp/2.0/OCPP20RequestService.ts b/src/charging-station/ocpp/2.0/OCPP20RequestService.ts index 989ca41c..18816f0e 100644 --- a/src/charging-station/ocpp/2.0/OCPP20RequestService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20RequestService.ts @@ -122,7 +122,7 @@ export default class OCPP20RequestService extends OCPPRequestService { return {} as unknown as Request; case OCPP20RequestCommand.STATUS_NOTIFICATION: return { - timestamp: commandParams?.timestamp, + timestamp: commandParams?.timestamp ?? new Date(), connectorStatus: commandParams?.connectorStatus, evseId: commandParams?.evseId, connectorId: commandParams?.connectorId,