fix: properly fallback to template OCPP configuration
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 22 May 2023 18:38:27 +0000 (20:38 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 22 May 2023 18:38:27 +0000 (20:38 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index 6a27d1d6d374ca428cbdfc4e96e42caace464ea1..2fed2cc45e99a635e9cccc5771f9f4939bddb891 100644 (file)
@@ -1647,9 +1647,11 @@ export class ChargingStation {
   }
 
   private getOcppConfigurationFromFile(): ChargingStationOcppConfiguration | undefined {
-    if (this.getOcppPersistentConfiguration() === true) {
-      return { configurationKey: this.getConfigurationFromFile()?.configurationKey };
+    const configurationKey = this.getConfigurationFromFile()?.configurationKey;
+    if (this.getOcppPersistentConfiguration() === true && configurationKey) {
+      return { configurationKey };
     }
+    return undefined;
   }
 
   private getOcppConfiguration(): ChargingStationOcppConfiguration | undefined {