X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2F1.6%2FOCPP16RequestService.ts;h=571ac066fc5710159c7bc5f968b9554689eb26de;hb=a95873d8d308a20a7151346ac70d9a551f1a06f5;hp=f184c7ab24bc8c7b21bfc553b9298f39003df7fc;hpb=bad85ee42a1c6a12be50560e535331dadff453b4;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index f184c7ab..571ac066 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -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 }),