From 1253d60cd246f968e985f6f067204a130b384b72 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 11 Feb 2024 17:19:04 +0100 Subject: [PATCH] refactor: factor out more charging station options handling code 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 | 5 ----- src/charging-station/Helpers.ts | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 6b83b136..3c511804 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -253,11 +253,6 @@ export class ChargingStation extends EventEmitter { this.add() - if (options?.autoStart != null) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - this.stationInfo!.autoStart = options.autoStart - } - if (this.stationInfo?.autoStart === true) { this.start() } diff --git a/src/charging-station/Helpers.ts b/src/charging-station/Helpers.ts index f69d86f8..258613a3 100644 --- a/src/charging-station/Helpers.ts +++ b/src/charging-station/Helpers.ts @@ -344,6 +344,9 @@ export const setChargingStationOptions = ( stationInfo.automaticTransactionGeneratorPersistentConfiguration = options.persistentConfiguration } + if (options?.autoStart != null) { + stationInfo.autoStart = options.autoStart + } if (options?.autoRegister != null) { stationInfo.autoRegister = options.autoRegister } -- 2.34.1