chore: version 1.1.94
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStationWorkerBroadcastChannel.ts
index ea262a4c46bff108c6d204bafdcaf541c2d2f0f1..ef232641b18e3cc1025698d6b70afd377270b834 100644 (file)
@@ -13,7 +13,7 @@ import {
   type HeartbeatRequest,
   type MeterValuesRequest,
   RequestCommand,
-  RequestParams,
+  type RequestParams,
   type StatusNotificationRequest,
 } from '../types/ocpp/Requests';
 import {
@@ -92,12 +92,12 @@ export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadca
       [
         BroadcastChannelProcedureName.START_AUTOMATIC_TRANSACTION_GENERATOR,
         (requestPayload?: BroadcastChannelRequestPayload) =>
-          this.chargingStation.startAutomaticTransactionGenerator(requestPayload.connectorIds),
+          this.chargingStation.startAutomaticTransactionGenerator(requestPayload?.connectorIds),
       ],
       [
         BroadcastChannelProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR,
         (requestPayload?: BroadcastChannelRequestPayload) =>
-          this.chargingStation.stopAutomaticTransactionGenerator(requestPayload.connectorIds),
+          this.chargingStation.stopAutomaticTransactionGenerator(requestPayload?.connectorIds),
       ],
       [
         BroadcastChannelProcedureName.START_TRANSACTION,
@@ -113,14 +113,18 @@ export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadca
           this.chargingStation.ocppRequestService.requestHandler<
             StopTransactionRequest,
             StartTransactionResponse
-          >(this.chargingStation, RequestCommand.STOP_TRANSACTION, {
-            meterStop: this.chargingStation.getEnergyActiveImportRegisterByTransactionId(
-              requestPayload.transactionId,
-              true
-            ),
-            ...requestPayload,
-            requestParams,
-          }),
+          >(
+            this.chargingStation,
+            RequestCommand.STOP_TRANSACTION,
+            {
+              meterStop: this.chargingStation.getEnergyActiveImportRegisterByTransactionId(
+                requestPayload.transactionId,
+                true
+              ),
+              ...requestPayload,
+            },
+            requestParams
+          ),
       ],
       [
         BroadcastChannelProcedureName.AUTHORIZE,
@@ -184,21 +188,26 @@ export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadca
           return this.chargingStation.ocppRequestService.requestHandler<
             MeterValuesRequest,
             MeterValuesResponse
-          >(this.chargingStation, RequestCommand.METER_VALUES, {
-            meterValue: [
-              // FIXME: Implement OCPP version agnostic helpers
-              OCPP16ServiceUtils.buildMeterValue(
-                this.chargingStation,
-                requestPayload.connectorId,
-                this.chargingStation.getConnectorStatus(requestPayload.connectorId)?.transactionId,
-                configuredMeterValueSampleInterval
-                  ? Utils.convertToInt(configuredMeterValueSampleInterval.value) * 1000
-                  : Constants.DEFAULT_METER_VALUES_INTERVAL
-              ),
-            ],
-            ...requestPayload,
-            requestParams,
-          });
+          >(
+            this.chargingStation,
+            RequestCommand.METER_VALUES,
+            {
+              meterValue: [
+                // FIXME: Implement OCPP version agnostic helpers
+                OCPP16ServiceUtils.buildMeterValue(
+                  this.chargingStation,
+                  requestPayload.connectorId,
+                  this.chargingStation.getConnectorStatus(requestPayload.connectorId)
+                    ?.transactionId,
+                  configuredMeterValueSampleInterval
+                    ? Utils.convertToInt(configuredMeterValueSampleInterval.value) * 1000
+                    : Constants.DEFAULT_METER_VALUES_INTERVAL
+                ),
+              ],
+              ...requestPayload,
+            },
+            requestParams
+          );
         },
       ],
       [