fix: ensure the incremented firmware version is saved in configuration
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 22 Mar 2023 19:25:14 +0000 (20:25 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 22 Mar 2023 19:25:14 +0000 (20:25 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index 6050a73efee3b0402212f1d4d5da34174d4a238b..81170bad83c4b2744711b7bef10809517c64b4b7 100644 (file)
@@ -1015,17 +1015,6 @@ export class ChargingStation {
       `${ChargingStationUtils.getHashId(this.index, this.getTemplateFromFile())}.json`
     );
     this.stationInfo = this.getStationInfo();
-    this.saveStationInfo();
-    // Avoid duplication of connectors related information in RAM
-    delete this.stationInfo?.Connectors;
-    this.configuredSupervisionUrl = this.getConfiguredSupervisionUrl();
-    if (this.getEnableStatistics() === true) {
-      this.performanceStatistics = PerformanceStatistics.getInstance(
-        this.stationInfo.hashId,
-        this.stationInfo.chargingStationId,
-        this.configuredSupervisionUrl
-      );
-    }
     if (
       this.stationInfo.firmwareStatus === FirmwareStatus.Installing &&
       Utils.isNotEmptyString(this.stationInfo.firmwareVersion) &&
@@ -1044,6 +1033,17 @@ export class ChargingStation {
       ).toString();
       this.stationInfo.firmwareVersion = match?.join('.');
     }
+    this.saveStationInfo();
+    // Avoid duplication of connectors related information in RAM
+    delete this.stationInfo?.Connectors;
+    this.configuredSupervisionUrl = this.getConfiguredSupervisionUrl();
+    if (this.getEnableStatistics() === true) {
+      this.performanceStatistics = PerformanceStatistics.getInstance(
+        this.stationInfo.hashId,
+        this.stationInfo.chargingStationId,
+        this.configuredSupervisionUrl
+      );
+    }
     this.bootNotificationRequest = ChargingStationUtils.createBootNotificationRequest(
       this.stationInfo
     );