From: Jérôme Benoit Date: Mon, 5 Sep 2022 01:32:22 +0000 (+0200) Subject: Optimize energy active register calculation X-Git-Tag: v1.1.71~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=7acb3f7bb991a6d02a4521c0cbc5f163aa5e8a61;p=e-mobility-charging-stations-simulator.git Optimize energy active register calculation Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index fef9d86d..699a413d 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -243,10 +243,12 @@ export default class OCPP16RequestService extends OCPPRequestService { connectorId = chargingStation.getConnectorIdByTransactionId( commandParams?.transactionId as number ); - energyActiveImportRegister = chargingStation.getEnergyActiveImportRegisterByTransactionId( - commandParams?.transactionId as number, - true - ); + commandParams?.meterStop && + (energyActiveImportRegister = + chargingStation.getEnergyActiveImportRegisterByTransactionId( + commandParams?.transactionId as number, + true + )); return { transactionId: commandParams?.transactionId, idTag: