From a59737e33418e805972d57d8f52aa3bc0f28d51e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 12 Mar 2022 10:44:31 +0100 Subject: [PATCH] Add getter for supervisionUrlOcppKey value 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 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 75094ceb..cc0fd47f 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -105,9 +105,7 @@ export default class ChargingStation { get wsConnectionUrl(): URL { return this.getSupervisionUrlOcppConfiguration() ? new URL( - this.getConfigurationKey( - this.stationInfo.supervisionUrlOcppKey ?? VendorDefaultParametersKey.ConnectionUrl - ).value + + this.getConfigurationKey(this.getSupervisionUrlOcppKey()).value + '/' + this.stationInfo.chargingStationId ) @@ -720,6 +718,10 @@ export default class ChargingStation { } } + private getSupervisionUrlOcppKey(): string { + return this.stationInfo.supervisionUrlOcppKey ?? VendorDefaultParametersKey.ConnectionUrl; + } + private getSupervisionUrlOcppConfiguration(): boolean { return this.stationInfo.supervisionUrlOcppConfiguration ?? false; } @@ -951,12 +953,10 @@ export default class ChargingStation { private initOcppParameters(): void { if ( this.getSupervisionUrlOcppConfiguration() && - !this.getConfigurationKey( - this.stationInfo.supervisionUrlOcppKey ?? VendorDefaultParametersKey.ConnectionUrl - ) + !this.getConfigurationKey(this.getSupervisionUrlOcppKey()) ) { this.addConfigurationKey( - this.stationInfo.supervisionUrlOcppKey ?? VendorDefaultParametersKey.ConnectionUrl, + this.getSupervisionUrlOcppKey(), this.getConfiguredSupervisionUrl().href, { reboot: true } ); -- 2.34.1