Initialize connectors status only if not defined
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 3 Oct 2022 19:11:46 +0000 (21:11 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 3 Oct 2022 19:11:46 +0000 (21:11 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index 77a49cbb8fd6d369e82d1783e1ac594c6fccf7a0..85a62c589d2549e96fd86249cf3fa0e72e80aef0 100644 (file)
@@ -1199,10 +1199,17 @@ export default class ChargingStation {
     }
     // Initialize transaction attributes on connectors
     for (const connectorId of this.connectors.keys()) {
+      if (connectorId > 0 && this.getConnectorStatus(connectorId).transactionStarted === true) {
+        logger.warn(
+          `${this.logPrefix()} Connector ${connectorId} at initialization has a transaction started: ${
+            this.getConnectorStatus(connectorId).transactionId
+          }`
+        );
+      }
       if (
         connectorId > 0 &&
         (this.getConnectorStatus(connectorId).transactionStarted === undefined ||
-          this.getConnectorStatus(connectorId).transactionStarted === false)
+          this.getConnectorStatus(connectorId).transactionStarted === null)
       ) {
         this.initializeConnectorStatus(connectorId);
       }