From 9a77cc079c7f2f8ac53f95d1f54f41c4a2d833f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 10 Nov 2023 21:35:29 +0100 Subject: [PATCH] fix: fix types in stationInfo properties refactoring 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index ae5f0fd1..282b6aef 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -782,7 +782,7 @@ export class ChargingStation extends EventEmitter { this.wsConnection = new WebSocket( this.wsConnectionUrl, - `ocpp${this.stationInfo.ocppVersion}`, + `ocpp${this.stationInfo?.ocppVersion}`, options, ); @@ -1259,7 +1259,7 @@ export class ChargingStation extends EventEmitter { } private initializeOcppServices(): void { - const ocppVersion = this.stationInfo.ocppVersion; + const ocppVersion = this.stationInfo?.ocppVersion; switch (ocppVersion) { case OCPPVersion.VERSION_16: this.ocppIncomingRequestService = @@ -1756,7 +1756,7 @@ export class ChargingStation extends EventEmitter { } while ( this.isRegistered() === false && (registrationRetryCount <= this.stationInfo.registrationMaxRetries! || - this.stationInfo?.registrationMaxRetries) === -1 + this.stationInfo?.registrationMaxRetries === -1) ); } if (this.isRegistered() === true) { @@ -1823,7 +1823,7 @@ export class ChargingStation extends EventEmitter { private async handleIncomingMessage(request: IncomingRequest): Promise { const [messageType, messageId, commandName, commandPayload] = request; - if (this.stationInfo.enableStatistics === true) { + if (this.stationInfo?.enableStatistics === true) { this.performanceStatistics?.addRequestStatistic(commandName, messageType); } logger.debug( -- 2.34.1