type HeartbeatResponse,
type IncomingRequest,
type IncomingRequestCommand,
- type JsonType,
MessageType,
MeterValueMeasurand,
type MeterValuesRequest,
type StopTransactionResponse,
SupervisionUrlDistribution,
SupportedFeatureProfiles,
- VendorParametersKey,
Voltage,
type WSError,
WebSocketCloseEventStatusCode,
}
private getStationInfo(): ChargingStationInfo {
- const defaultStationInfo: Partial<ChargingStationInfo> = {
- enableStatistics: false,
- remoteAuthorization: true,
- currentOutType: CurrentType.AC,
- mainVoltageMeterValues: true,
- phaseLineToLineVoltageMeterValues: false,
- customValueLimitationMeterValues: true,
- ocppStrictCompliance: true,
- outOfOrderEndMeterValues: false,
- beginEndMeterValues: false,
- meteringPerTransaction: true,
- transactionDataMeterValues: false,
- supervisionUrlOcppConfiguration: false,
- supervisionUrlOcppKey: VendorParametersKey.ConnectionUrl,
- ocppVersion: OCPPVersion.VERSION_16,
- ocppPersistentConfiguration: true,
- stationInfoPersistentConfiguration: true,
- automaticTransactionGeneratorPersistentConfiguration: true,
- autoReconnectMaxRetries: -1,
- registrationMaxRetries: -1,
- reconnectExponentialDelay: false,
- stopTransactionsOnStopped: true,
- };
+ const defaultStationInfo = Constants.DEFAULT_STATION_INFO;
const stationInfoFromTemplate: ChargingStationInfo = this.getStationInfoFromTemplate();
const stationInfoFromFile: ChargingStationInfo | undefined = this.getStationInfoFromFile(
stationInfoFromTemplate?.stationInfoPersistentConfiguration,
const patternGroup: number | undefined =
this.stationInfo.firmwareUpgrade?.versionUpgrade?.patternGroup ??
this.stationInfo.firmwareVersion?.split('.').length;
- const match = this.stationInfo
- .firmwareVersion!.match(new RegExp(this.stationInfo.firmwareVersionPattern!))!
- .slice(1, patternGroup! + 1);
- const patchLevelIndex = match.length - 1;
- match[patchLevelIndex] = (
- convertToInt(match[patchLevelIndex]) +
- this.stationInfo.firmwareUpgrade!.versionUpgrade!.step!
- ).toString();
- this.stationInfo.firmwareVersion = match?.join('.');
+ const match = new RegExp(this.stationInfo.firmwareVersionPattern!)
+ .exec(this.stationInfo.firmwareVersion!)
+ ?.slice(1, patternGroup! + 1);
+ if (!isNullOrUndefined(match)) {
+ const patchLevelIndex = match!.length - 1;
+ match![patchLevelIndex] = (
+ convertToInt(match![patchLevelIndex]) +
+ this.stationInfo.firmwareUpgrade!.versionUpgrade!.step!
+ ).toString();
+ this.stationInfo.firmwareVersion = match!.join('.');
+ }
}
this.saveStationInfo();
this.configuredSupervisionUrl = this.getConfiguredSupervisionUrl();
messageType,
)} is not an array`,
undefined,
- cachedRequest as JsonType,
+ cachedRequest,
);
}