From ab5f4b034b43c9e1baaee6c133ac6bbfd6cefd30 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 18 Jan 2021 19:26:57 +0100 Subject: [PATCH] Force ATG stop is the charging station is unavailable. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../AutomaticTransactionGenerator.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 29f571e9..0b1e7e27 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -39,12 +39,12 @@ export default class AutomaticTransactionGenerator { if (this._chargingStation.stationInfo.AutomaticTransactionGenerator.stopAfterHours && this._chargingStation.stationInfo.AutomaticTransactionGenerator.stopAfterHours > 0) { setTimeout(() => { - this.stop(); + void this.stop(); }, this._chargingStation.stationInfo.AutomaticTransactionGenerator.stopAfterHours * 3600 * 1000); } for (const connector in this._chargingStation.connectors) { if (Utils.convertToInt(connector) > 0) { - this.startConnector(Utils.convertToInt(connector)); + void this.startConnector(Utils.convertToInt(connector)); } } logger.info(this._logPrefix() + ' ATG started and will stop in ' + Utils.secondsToHHMMSS(this._chargingStation.stationInfo.AutomaticTransactionGenerator.stopAfterHours * 3600)); @@ -71,8 +71,13 @@ export default class AutomaticTransactionGenerator { logger.error(this._logPrefix(connectorId) + ' Entered in transaction loop while the charging station is not registered'); break; } - if (!this._chargingStation._isChargingStationAvailable() || !this._chargingStation._isConnectorAvailable(connectorId)) { - logger.error(this._logPrefix(connectorId) + ' Entered in transaction loop while the charging station or connector is unavailable'); + if (!this._chargingStation._isChargingStationAvailable()) { + logger.info(this._logPrefix(connectorId) + ' Entered in transaction loop while the charging station is unavailable'); + await this.stop(); + break; + } + if (!this._chargingStation._isConnectorAvailable(connectorId)) { + logger.info(`${this._logPrefix(connectorId)} Entered in transaction loop while the connector ${connectorId} is unavailable, stop it`); break; } const wait = Utils.getRandomInt(this._chargingStation.stationInfo.AutomaticTransactionGenerator.maxDelayBetweenTwoTransactions, -- 2.34.1