X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=8a5c5c6fba84ed66b0fb33a32de578bcc3f4ee62;hb=36b73d95deccfb6538929c48e0f989fb1c696e8a;hp=2b5b5f8376fca34c915965ab1b0d46df590ef6ad;hpb=09e5a7a8ed45886b6bf1434c4e49c945ded4c7d8;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 2b5b5f83..8a5c5c6f 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -42,6 +42,7 @@ import { hasReservationExpired, initializeConnectorsMapStatus, propagateSerialNumber, + setChargingStationOptions, stationTemplateToStationInfo, warnTemplateKeysDeprecation } from './Helpers.js' @@ -1229,11 +1230,10 @@ export class ChargingStation extends EventEmitter { return stationInfo } - private getStationInfo (stationInfoPersistentConfiguration?: boolean): ChargingStationInfo { + private getStationInfo (options?: ChargingStationOptions): ChargingStationInfo { const stationInfoFromTemplate = this.getStationInfoFromTemplate() - stationInfoPersistentConfiguration != null && - (stationInfoFromTemplate.stationInfoPersistentConfiguration = - stationInfoPersistentConfiguration) + options?.persistentConfiguration != null && + (stationInfoFromTemplate.stationInfoPersistentConfiguration = options.persistentConfiguration) const stationInfoFromFile = this.getStationInfoFromFile( stationInfoFromTemplate.stationInfoPersistentConfiguration ) @@ -1244,7 +1244,10 @@ export class ChargingStation extends EventEmitter { stationInfoFromFile != null && stationInfoFromFile.templateHash === stationInfoFromTemplate.templateHash ) { - return { ...Constants.DEFAULT_STATION_INFO, ...stationInfoFromFile } + return setChargingStationOptions( + { ...Constants.DEFAULT_STATION_INFO, ...stationInfoFromFile }, + options + ) } stationInfoFromFile != null && propagateSerialNumber( @@ -1252,7 +1255,10 @@ export class ChargingStation extends EventEmitter { stationInfoFromFile, stationInfoFromTemplate ) - return { ...Constants.DEFAULT_STATION_INFO, ...stationInfoFromTemplate } + return setChargingStationOptions( + { ...Constants.DEFAULT_STATION_INFO, ...stationInfoFromTemplate }, + options + ) } private saveStationInfo (): void { @@ -1285,24 +1291,7 @@ export class ChargingStation extends EventEmitter { } else { this.initializeConnectorsOrEvsesFromTemplate(stationTemplate) } - this.stationInfo = this.getStationInfo(options?.persistentConfiguration) - if (options?.persistentConfiguration != null) { - this.stationInfo.ocppPersistentConfiguration = options.persistentConfiguration - this.stationInfo.automaticTransactionGeneratorPersistentConfiguration = - options.persistentConfiguration - } - if (options?.autoRegister != null) { - this.stationInfo.autoRegister = options.autoRegister - } - if (options?.enableStatistics != null) { - this.stationInfo.enableStatistics = options.enableStatistics - } - if (options?.ocppStrictCompliance != null) { - this.stationInfo.ocppStrictCompliance = options.ocppStrictCompliance - } - if (options?.stopTransactionsOnStopped != null) { - this.stationInfo.stopTransactionsOnStopped = options.stopTransactionsOnStopped - } + this.stationInfo = this.getStationInfo(options) if ( this.stationInfo.firmwareStatus === FirmwareStatus.Installing && isNotEmptyString(this.stationInfo.firmwareVersionPattern) &&