hasReservationExpired,
initializeConnectorsMapStatus,
propagateSerialNumber,
+ setChargingStationOptions,
stationTemplateToStationInfo,
warnTemplateKeysDeprecation
} from './Helpers.js'
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
)
stationInfoFromFile != null &&
stationInfoFromFile.templateHash === stationInfoFromTemplate.templateHash
) {
- return { ...Constants.DEFAULT_STATION_INFO, ...stationInfoFromFile }
+ return setChargingStationOptions(
+ { ...Constants.DEFAULT_STATION_INFO, ...stationInfoFromFile },
+ options
+ )
}
stationInfoFromFile != null &&
propagateSerialNumber(
stationInfoFromFile,
stationInfoFromTemplate
)
- return { ...Constants.DEFAULT_STATION_INFO, ...stationInfoFromTemplate }
+ return setChargingStationOptions(
+ { ...Constants.DEFAULT_STATION_INFO, ...stationInfoFromTemplate },
+ options
+ )
}
private saveStationInfo (): void {
} 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) &&
type ChargingSchedulePeriod,
type ChargingStationConfiguration,
type ChargingStationInfo,
+ type ChargingStationOptions,
type ChargingStationTemplate,
type ChargingStationWorkerMessageEvents,
ConnectorPhaseRotation,
return connectorsMap
}
+export const setChargingStationOptions = (
+ stationInfo: ChargingStationInfo,
+ options?: ChargingStationOptions
+): ChargingStationInfo => {
+ if (options?.persistentConfiguration != null) {
+ stationInfo.ocppPersistentConfiguration = options.persistentConfiguration
+ stationInfo.automaticTransactionGeneratorPersistentConfiguration =
+ options.persistentConfiguration
+ }
+ if (options?.autoRegister != null) {
+ stationInfo.autoRegister = options.autoRegister
+ }
+ if (options?.enableStatistics != null) {
+ stationInfo.enableStatistics = options.enableStatistics
+ }
+ if (options?.ocppStrictCompliance != null) {
+ stationInfo.ocppStrictCompliance = options.ocppStrictCompliance
+ }
+ if (options?.stopTransactionsOnStopped != null) {
+ stationInfo.stopTransactionsOnStopped = options.stopTransactionsOnStopped
+ }
+ return stationInfo
+}
+
export const initializeConnectorsMapStatus = (
connectors: Map<number, ConnectorStatus>,
logPrefix: string