From e6a332330734dcd91f2619880d2006392cae67e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 4 Aug 2023 19:51:24 +0200 Subject: [PATCH] refactor: use helper to check charging station at WS opening MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 5a049ec5..f92ea2b6 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -28,6 +28,7 @@ import { } from './ConfigurationKeyUtils'; import { buildConnectorsMap, + checkChargingStation, checkConnectorsConfiguration, checkStationInfoConnectorStatus, checkTemplate, @@ -776,15 +777,11 @@ export class ChargingStation { ): void { options = { handshakeTimeout: secondsToMilliseconds(this.getConnectionTimeout()), - ...(this.stationInfo?.wsOptions ?? {}), + ...this.stationInfo?.wsOptions, ...options, }; params = { ...{ closeOpened: false, terminateOpened: false }, ...params }; - if (this.started === false && this.starting === false) { - logger.warn( - `${this.logPrefix()} Cannot open OCPP connection to URL ${this.wsConnectionUrl.toString()} - on stopped charging station`, - ); + if (!checkChargingStation(this, this.logPrefix())) { return; } if ( -- 2.34.1