Allow to specify timestamp in OCPP commands payload with the UI Server
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / 2.0 / OCPP20RequestService.ts
index d550e4d1bd3c2339397a03d4b42a8b98f9e06b6d..18816f0ede247d613e4ce18079f5c1ffe0ee6394 100644 (file)
@@ -6,6 +6,7 @@ import { fileURLToPath } from 'url';
 
 import type { JSONSchemaType } from 'ajv';
 
+import { OCPP20ServiceUtils } from './OCPP20ServiceUtils';
 import OCPPError from '../../../exception/OCPPError';
 import type { JsonObject, JsonType } from '../../../types/JsonType';
 import {
@@ -21,7 +22,6 @@ import Utils from '../../../utils/Utils';
 import type ChargingStation from '../../ChargingStation';
 import OCPPRequestService from '../OCPPRequestService';
 import type OCPPResponseService from '../OCPPResponseService';
-import { OCPP20ServiceUtils } from './OCPP20ServiceUtils';
 
 const moduleName = 'OCPP20RequestService';
 
@@ -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,