import chalk from 'chalk';
import moment from 'moment';
-import type { ChargingStation } from './internal';
+import type { ChargingStation } from './ChargingStation';
import { BaseError } from '../exception';
import {
AmpereUnits,
RecurrencyKindType,
Voltage,
} from '../types';
-import {
- ACElectricUtils,
- Configuration,
- Constants,
- DCElectricUtils,
- Utils,
- logger,
-} from '../utils';
-import { WorkerProcessType } from '../worker';
+import { ACElectricUtils, Constants, DCElectricUtils, Utils, logger } from '../utils';
const moduleName = 'ChargingStationUtils';
return connectorBootStatus;
}
- public static checkTemplateFile(
+ public static checkTemplate(
stationTemplate: ChargingStationTemplate,
logPrefix: string,
templateFile: string
throw new BaseError(errorMsg);
}
if (Utils.isEmptyObject(stationTemplate.AutomaticTransactionGenerator)) {
- stationTemplate.AutomaticTransactionGenerator = {
- enable: false,
- minDuration: 60,
- maxDuration: 120,
- minDelayBetweenTwoTransactions: 15,
- maxDelayBetweenTwoTransactions: 30,
- probabilityOfStart: 1,
- stopAfterHours: 0.3,
- stopOnConnectionFailure: true,
- };
+ stationTemplate.AutomaticTransactionGenerator = Constants.DEFAULT_ATG_CONFIGURATION;
+ logger.warn(
+ `${logPrefix} Empty automatic transaction generator configuration from template file ${templateFile}, set to default: %j`,
+ Constants.DEFAULT_ATG_CONFIGURATION
+ );
+ }
+ if (
+ Utils.isNullOrUndefined(stationTemplate.idTagsFile) ||
+ Utils.isEmptyString(stationTemplate.idTagsFile)
+ ) {
logger.warn(
- `${logPrefix} Empty automatic transaction generator configuration from template file ${templateFile}, set to default values`
+ `${logPrefix} Missing id tags file in template file ${templateFile}. That can lead to issues with the Automatic Transaction Generator`
);
}
}
}
}
- public static workerPoolInUse(): boolean {
- return [WorkerProcessType.dynamicPool, WorkerProcessType.staticPool].includes(
- Configuration.getWorker().processType
- );
- }
-
- public static workerDynamicPoolInUse(): boolean {
- return Configuration.getWorker().processType === WorkerProcessType.dynamicPool;
- }
-
public static warnTemplateKeysDeprecation(
stationTemplate: ChargingStationTemplate,
logPrefix: string,
return (
stationInfo.idTagsFile &&
path.join(
- path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../'),
+ path.dirname(fileURLToPath(import.meta.url)),
'assets',
path.basename(stationInfo.idTagsFile)
)