From: Jérôme Benoit Date: Fri, 4 Aug 2023 17:51:24 +0000 (+0200) Subject: refactor: use helper to check charging station at WS opening X-Git-Tag: v1.2.20~16 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e6a332330734dcd91f2619880d2006392cae67e5;p=e-mobility-charging-stations-simulator.git refactor: use helper to check charging station at WS opening Signed-off-by: Jérôme Benoit --- 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 (