refactor: factor out more charging station options handling code
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 11 Feb 2024 16:19:04 +0000 (17:19 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 11 Feb 2024 16:19:04 +0000 (17:19 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts
src/charging-station/Helpers.ts

index 6b83b1364e6e6add5472eaf533e0e97a643c2c96..3c51180449c688eb99d476927aec92c8e4e35908 100644 (file)
@@ -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()
     }
index f69d86f8fe180d9af9652ab70626fd65c872b695..258613a3f1aa29d32e9818d17db366a9bf8bbcba 100644 (file)
@@ -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
   }