Permit to run code in async scope in the OCPP stack
[e-mobility-charging-stations-simulator.git] / src / charging-station / AutomaticTransactionGenerator.ts
index fb6e9d28c1f92ee7766104dd4559a79eeb94725e..e32c3c98109f6f520142d1499411b35d12babfcc 100644 (file)
@@ -93,7 +93,10 @@ export default class AutomaticTransactionGenerator extends AsyncResource {
     }
     if (this.connectorsStatus.get(connectorId)?.start === false) {
       this.runInAsyncScope(
-        this.internalStartConnector.bind(this) as (this: this, ...args: any[]) => unknown,
+        this.internalStartConnector.bind(this) as (
+          this: AutomaticTransactionGenerator,
+          ...args: any[]
+        ) => void,
         this,
         connectorId
       );
@@ -152,7 +155,7 @@ export default class AutomaticTransactionGenerator extends AsyncResource {
         this.stopConnector(connectorId);
         break;
       }
-      if (!this.chargingStation.isInAcceptedState()) {
+      if (this.chargingStation.isInAcceptedState() === false) {
         logger.error(
           this.logPrefix(connectorId) +
             ' entered in transaction loop while the charging station is not in accepted state'
@@ -160,7 +163,7 @@ export default class AutomaticTransactionGenerator extends AsyncResource {
         this.stopConnector(connectorId);
         break;
       }
-      if (!this.chargingStation.isChargingStationAvailable()) {
+      if (this.chargingStation.isChargingStationAvailable() === false) {
         logger.info(
           this.logPrefix(connectorId) +
             ' entered in transaction loop while the charging station is unavailable'
@@ -168,7 +171,7 @@ export default class AutomaticTransactionGenerator extends AsyncResource {
         this.stopConnector(connectorId);
         break;
       }
-      if (!this.chargingStation.isConnectorAvailable(connectorId)) {
+      if (this.chargingStation.isConnectorAvailable(connectorId) === false) {
         logger.info(
           `${this.logPrefix(
             connectorId