Ensure start transaction payload is always compliant with OCA specs
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / 1.6 / OCPP16RequestService.ts
index 9979c70aa8101f41facf955a637b5d3fc2bd5b52..15b2f2dd64e8ba130d8a31268d04ff82fa501f19 100644 (file)
@@ -116,15 +116,10 @@ export default class OCPP16RequestService extends OCPPRequestService {
     params?: RequestParams
   ): Promise<ResponseType> {
     if (OCPP16ServiceUtils.isRequestCommandSupported(chargingStation, commandName) === true) {
-      const requestPayload = this.buildRequestPayload<RequestType>(
-        chargingStation,
-        commandName,
-        commandParams
-      );
       return (await this.sendMessage(
         chargingStation,
         Utils.generateUUID(),
-        requestPayload,
+        this.buildRequestPayload<RequestType>(chargingStation, commandName, commandParams),
         commandName,
         params
       )) as unknown as ResponseType;
@@ -165,7 +160,8 @@ export default class OCPP16RequestService extends OCPPRequestService {
         return {
           idTag: Constants.DEFAULT_IDTAG,
           meterStart: chargingStation.getEnergyActiveImportRegisterByConnectorId(
-            commandParams?.connectorId as number
+            commandParams?.connectorId as number,
+            true
           ),
           timestamp: new Date(),
           ...commandParams,