Add OCPP params file monitoring
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / 1.6 / OCPP16RequestService.ts
index f184c7ab24bc8c7b21bfc553b9298f39003df7fc..571ac066fc5710159c7bc5f968b9554689eb26de 100644 (file)
@@ -19,7 +19,6 @@ import Constants from '../../../utils/Constants';
 import { ErrorType } from '../../../types/ocpp/ErrorType';
 import { JsonType } from '../../../types/JsonType';
 import { MeterValuesRequest } from '../../../types/ocpp/1.6/MeterValues';
-import { OCPP16DiagnosticsStatus } from '../../../types/ocpp/1.6/DiagnosticsStatus';
 import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
 import OCPPError from '../../../exception/OCPPError';
 import OCPPRequestService from '../OCPPRequestService';
@@ -101,8 +100,8 @@ export default class OCPP16RequestService extends OCPPRequestService {
         return {
           connectorId: commandParams?.connectorId,
           transactionId: commandParams?.transactionId,
-          meterValue: Array.isArray(commandParams?.meterValues)
-            ? commandParams?.meterValues
+          meterValue: Array.isArray(commandParams?.meterValue)
+            ? commandParams?.meterValue
             : [commandParams?.meterValue],
         } as MeterValuesRequest;
       case OCPP16RequestCommand.STATUS_NOTIFICATION:
@@ -123,16 +122,9 @@ export default class OCPP16RequestService extends OCPPRequestService {
           timestamp: new Date().toISOString(),
         } as StartTransactionRequest;
       case OCPP16RequestCommand.STOP_TRANSACTION:
-        for (const id of this.chargingStation.connectors.keys()) {
-          if (
-            id > 0 &&
-            this.chargingStation.getConnectorStatus(id)?.transactionId ===
-              commandParams?.transactionId
-          ) {
-            connectorId = id;
-            break;
-          }
-        }
+        connectorId = this.chargingStation.getConnectorIdByTransactionId(
+          commandParams?.transactionId as number
+        );
         return {
           transactionId: commandParams?.transactionId,
           ...(!Utils.isUndefined(commandParams?.idTag) && { idTag: commandParams.idTag }),