return this.bootNotificationRequest;
}
- public getRandomTagId(): string {
+ public getRandomIdTag(): string {
const index = Math.floor(Utils.secureRandom() * this.authorizedTags.length);
return this.authorizedTags[index];
}
// Generate all connectors
if ((this.stationInfo.Connectors[0] ? templateMaxConnectors - 1 : templateMaxConnectors) > 0) {
for (let index = 1; index <= maxConnectors; index++) {
- const randConnectorId = this.stationInfo.randomConnectors ? Utils.getRandomInt(Utils.convertToInt(lastConnector), 1) : index;
+ const randConnectorId = this.stationInfo.randomConnectors ? Utils.getRandomInteger(Utils.convertToInt(lastConnector), 1) : index;
this.connectors[index] = Utils.cloneObject<Connector>(this.stationInfo.Connectors[randConnectorId]);
this.connectors[index].availability = AvailabilityType.OPERATIVE;
if (Utils.isUndefined(this.connectors[lastConnector]?.chargingProfiles)) {
delete this.stationInfo.Connectors;
// Initialize transaction attributes on connectors
for (const connector in this.connectors) {
- if (Utils.convertToInt(connector) > 0 && !this.getConnector(Utils.convertToInt(connector)).transactionStarted) {
+ if (Utils.convertToInt(connector) > 0 && !this.getConnector(Utils.convertToInt(connector))?.transactionStarted) {
this.initTransactionAttributesOnConnector(Utils.convertToInt(connector));
}
}
private getNumberOfRunningTransactions(): number {
let trxCount = 0;
for (const connector in this.connectors) {
- if (Utils.convertToInt(connector) > 0 && this.getConnector(Utils.convertToInt(connector)).transactionStarted) {
+ if (Utils.convertToInt(connector) > 0 && this.getConnector(Utils.convertToInt(connector))?.transactionStarted) {
trxCount++;
}
}
this.automaticTransactionGenerator.stop();
} else {
for (const connector in this.connectors) {
- if (Utils.convertToInt(connector) > 0 && this.getConnector(Utils.convertToInt(connector)).transactionStarted) {
+ if (Utils.convertToInt(connector) > 0 && this.getConnector(Utils.convertToInt(connector))?.transactionStarted) {
const transactionId = this.getConnector(Utils.convertToInt(connector)).transactionId;
await this.ocppRequestService.sendStopTransaction(transactionId, this.getEnergyActiveImportRegisterByTransactionId(transactionId),
this.getTransactionIdTag(transactionId), reason);
private startStationTemplateFileMonitoring(): void {
try {
- fs.watch(this.stationTemplateFile, async (event, filename): Promise<void> => {
+ fs.watch(this.stationTemplateFile, (event, filename): void => {
if (filename && event === 'change') {
try {
logger.debug(this.logPrefix() + ' Template file ' + this.stationTemplateFile + ' have changed, reload');