From 8bf88613e4ab93813de6d7a2e42c5397ccb930e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 29 Sep 2021 06:42:24 +0200 Subject: [PATCH] Create connectors also if undefined 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 48d94ca0..cf7a19ef 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -315,13 +315,13 @@ export default class ChargingStation { this.startAuthorizationFileMonitoring(); // Monitor station template file this.startStationTemplateFileMonitoring(); - // Handle WebSocket incoming messages + // Handle WebSocket message this.wsConnection.on('message', this.onMessage.bind(this)); // Handle WebSocket error this.wsConnection.on('error', this.onError.bind(this)); // Handle WebSocket close this.wsConnection.on('close', this.onClose.bind(this)); - // Handle WebSocket opening connection + // Handle WebSocket open this.wsConnection.on('open', this.onOpen.bind(this)); // Handle WebSocket ping this.wsConnection.on('ping', this.onPing.bind(this)); @@ -509,7 +509,7 @@ export default class ChargingStation { } const connectorsConfigHash = crypto.createHash('sha256').update(JSON.stringify(this.stationInfo.Connectors) + maxConnectors.toString()).digest('hex'); const connectorsConfigChanged = !Utils.isEmptyObject(this.connectors) && this.connectorsConfigurationHash !== connectorsConfigHash; - if (Utils.isEmptyObject(this.connectors) || connectorsConfigChanged) { + if (!this.connectors || Utils.isEmptyObject(this.connectors) || connectorsConfigChanged) { connectorsConfigChanged && (this.connectors = {} as Connectors); this.connectorsConfigurationHash = connectorsConfigHash; // Add connector Id 0 -- 2.34.1