Optimize energy active register calculation
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 5 Sep 2022 01:32:22 +0000 (03:32 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 5 Sep 2022 01:32:22 +0000 (03:32 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/1.6/OCPP16RequestService.ts

index fef9d86daa6cbe3a855b8e9c3d09b27584ae9eee..699a413d242b4aa5cf0748e51d7c65204d57b006 100644 (file)
@@ -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: