Code cleanups
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 14 Mar 2022 19:47:23 +0000 (20:47 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 14 Mar 2022 19:47:23 +0000 (20:47 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts

index 48c56e4d31280dfef348a9a7dd77ad54e0d1e6a5..ba6fd61f106a050516d7df9b6960d7f4cdb044f5 100644 (file)
@@ -1129,7 +1129,7 @@ export default class ChargingStation {
     this.saveOcppConfiguration();
   }
 
-  private getConfigurationFromFile(): ChargingStationConfiguration {
+  private getConfigurationFromFile(): ChargingStationConfiguration | null {
     let configuration: ChargingStationConfiguration = null;
     if (this.configurationFile && fs.existsSync(this.configurationFile)) {
       try {
index b4fb12cf138b2bd1cb533b033c3b85b2f21dee96..b67090af8fc6a9e7a5794cda32f6ed152c9e0645 100644 (file)
@@ -265,17 +265,17 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
     const configurationKey: OCPPConfigurationKey[] = [];
     const unknownKey: string[] = [];
     if (Utils.isEmptyArray(commandPayload.key)) {
-      for (const key of this.chargingStation.ocppConfiguration.configurationKey) {
-        if (Utils.isUndefined(key.visible)) {
-          key.visible = true;
+      for (const configuration of this.chargingStation.ocppConfiguration.configurationKey) {
+        if (Utils.isUndefined(configuration.visible)) {
+          configuration.visible = true;
         }
-        if (!key.visible) {
+        if (!configuration.visible) {
           continue;
         }
         configurationKey.push({
-          key: key.key,
-          readonly: key.readonly,
-          value: key.value,
+          key: configuration.key,
+          readonly: configuration.readonly,
+          value: configuration.value,
         });
       }
     } else {