X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=926915fb016a5497fd519667dff1199052b666e2;hb=1adaf7ac2ae157f7e3bec95f0f2430ea6dc039ef;hp=e41ea5ec79980db46558684cca08f2ff9cab6d38;hpb=5dcb9d4945027c6be39e4342f1627ea2da3813b7;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index e41ea5ec..926915fb 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -286,7 +286,7 @@ export class ChargingStation extends EventEmitter { readFileSync(this.templateFile, 'utf8') ) as ChargingStationTemplate } catch { - stationTemplate = undefined + // Ignore } return logPrefix(` ${getChargingStationId(this.index, stationTemplate)} |`) } @@ -1227,6 +1227,7 @@ export class ChargingStation extends EventEmitter { const stationInfoFromFile = this.getStationInfoFromFile( stationInfoFromTemplate.stationInfoPersistentConfiguration ) + let stationInfo: ChargingStationInfo // Priority: // 1. charging station info from template // 2. charging station info from configuration file @@ -1234,19 +1235,14 @@ export class ChargingStation extends EventEmitter { stationInfoFromFile != null && stationInfoFromFile.templateHash === stationInfoFromTemplate.templateHash ) { - return setChargingStationOptions( - mergeDeepRight(Constants.DEFAULT_STATION_INFO, stationInfoFromFile), - options - ) + stationInfo = stationInfoFromFile + } else { + stationInfo = stationInfoFromTemplate + stationInfoFromFile != null && + propagateSerialNumber(this.getTemplateFromFile(), stationInfoFromFile, stationInfo) } - stationInfoFromFile != null && - propagateSerialNumber( - this.getTemplateFromFile(), - stationInfoFromFile, - stationInfoFromTemplate - ) return setChargingStationOptions( - mergeDeepRight(Constants.DEFAULT_STATION_INFO, stationInfoFromTemplate), + mergeDeepRight(Constants.DEFAULT_STATION_INFO, stationInfo), options ) }