const enginesNodeVersion = require('./package.json').engines.node;
/**
- *
+ * Check if the current node version match the required engines version.
*/
function checkNodeVersion() {
if (SemVer.satisfies(process.version, enginesNodeVersion) === false) {
networks:
- ev_network
ports:
- - "3030:3030"
+ - '3030:3030'
if (!Utils.isEmptyArray(chargingProfiles)) {
const result = ChargingStationUtils.getLimitFromChargingProfiles(
chargingProfiles,
- Utils.logPrefix()
+ this.logPrefix()
);
if (!Utils.isNullOrUndefined(result)) {
limit = result.limit;
ChargingStationUtils.checkConfiguredMaxConnectors(
configuredMaxConnectors,
this.templateFile,
- Utils.logPrefix()
+ this.logPrefix()
);
const templateMaxConnectors =
ChargingStationUtils.getTemplateMaxNumberOfConnectors(stationTemplate);
ChargingStationUtils.checkTemplateMaxConnectors(
templateMaxConnectors,
this.templateFile,
- Utils.logPrefix()
+ this.logPrefix()
);
if (
configuredMaxConnectors >
}
private handleUnsupportedVersion(version: OCPPVersion) {
- const errMsg = `${this.logPrefix()} Unsupported protocol version '${version}' configured in template file ${
- this.templateFile
- }`;
- logger.error(errMsg);
+ const errMsg = `Unsupported protocol version '${version}' configured in template file ${this.templateFile}`;
+ logger.error(`${this.logPrefix()} ${errMsg}`);
throw new BaseError(errMsg);
}
templateMaxConnectors: number
): void {
if (!stationInfo?.Connectors && this.connectors.size === 0) {
- const logMsg = `${this.logPrefix()} No already defined connectors and charging station information from template ${
- this.templateFile
- } with no connectors configuration defined`;
- logger.error(logMsg);
+ const logMsg = `No already defined connectors and charging station information from template ${this.templateFile} with no connectors configuration defined`;
+ logger.error(`${this.logPrefix()} ${logMsg}`);
throw new BaseError(logMsg);
}
if (!stationInfo?.Connectors[0]) {
// Error
default:
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
- errMsg = `${this.logPrefix()} Wrong message type ${messageType}`;
- logger.error(errMsg);
+ errMsg = `Wrong message type ${messageType}`;
+ logger.error(`${this.logPrefix()} ${errMsg}`);
throw new OCPPError(ErrorType.PROTOCOL_ERROR, errMsg);
}
parentPort.postMessage(MessageChannelUtils.buildUpdatedMessage(this));
} catch (error) {
// Log
logger.error(
- "%s Incoming OCPP '%s' message '%j' matching cached request '%j' processing error:",
- this.logPrefix(),
- commandName ?? requestCommandName ?? null,
- data.toString(),
- this.requests.get(messageId),
+ `${this.logPrefix()} Incoming OCPP '${
+ commandName ?? requestCommandName ?? null
+ }' message '${data.toString()}' matching cached request '${JSON.stringify(
+ this.requests.get(messageId)
+ )}' processing error:`,
error
);
if (!(error instanceof OCPPError)) {
logger.warn(
- "%s Error thrown at incoming OCPP '%s' message '%j' handling is not an OCPPError:",
- this.logPrefix(),
- commandName ?? requestCommandName ?? null,
- data.toString(),
+ `${this.logPrefix()} Error thrown at incoming OCPP '${
+ commandName ?? requestCommandName ?? null
+ }' message '${data.toString()}' handling is not an OCPPError:`,
error
);
}
templateFile: string,
logPrefix: string
): Voltage {
- const errMsg = `${logPrefix} Unknown ${currentType} currentOutType in template file ${templateFile}, cannot define default voltage out`;
+ const errMsg = `Unknown ${currentType} currentOutType in template file ${templateFile}, cannot define default voltage out`;
let defaultVoltageOut: number;
switch (currentType) {
case CurrentType.AC:
defaultVoltageOut = Voltage.VOLTAGE_400;
break;
default:
- logger.error(errMsg);
+ logger.error(`${logPrefix} ${errMsg}`);
throw new BaseError(errMsg);
}
return defaultVoltageOut;
}
}
if (measurand === MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER) {
- const errorMsg = `${chargingStation.logPrefix()} Missing MeterValues for default measurand '${measurand}' in template on connectorId ${connectorId}`;
- logger.error(errorMsg);
+ const errorMsg = `Missing MeterValues for default measurand '${measurand}' in template on connectorId ${connectorId}`;
+ logger.error(`${chargingStation.logPrefix()} ${errorMsg}`);
throw new BaseError(errorMsg);
}
logger.debug(
stationInfo: chargingStation.stationInfo,
stopped: chargingStation.stopped,
bootNotificationResponse: chargingStation.bootNotificationResponse,
- connectors: Array.from(chargingStation.connectors.values()),
+ connectors: Array.from(chargingStation.connectors.values()).map(
+ ({ transactionSetInterval, ...connectorStatusRest }) => connectorStatusRest
+ ),
};
}
}
);
return;
}
- if (!Number.isInteger(payload.transactionId)) {
- logger.warn(
- `${chargingStation.logPrefix()} Trying to start a transaction on connector ${connectorId.toString()} with a non integer transaction Id ${
- payload.transactionId
- }, converting to integer`
- );
- payload.transactionId = Utils.convertToInt(payload.transactionId);
- }
+ // if (!Number.isInteger(payload.transactionId)) {
+ // logger.warn(
+ // `${chargingStation.logPrefix()} Trying to start a transaction on connector ${connectorId.toString()} with a non integer transaction Id ${
+ // payload.transactionId
+ // }, converting to integer`
+ // );
+ // payload.transactionId = Utils.convertToInt(payload.transactionId);
+ // }
if (payload.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
chargingStation.getConnectorStatus(connectorId).transactionStarted = true;
payload.transactionId.toString() +
" REJECTED with status '" +
payload?.idTagInfo?.status +
- "', idTag " +
- requestPayload.idTag
+ "', idTag '" +
+ requestPayload.idTag +
+ "'"
);
await this.resetConnectorOnStartTransactionError(chargingStation, connectorId);
}
chargingStation,
powerSampledValueTemplate.measurand
);
- const errMsg = `${chargingStation.logPrefix()} MeterValues measurand ${
+ const errMsg = `MeterValues measurand ${
powerSampledValueTemplate.measurand ??
OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
}: Unknown ${chargingStation.getCurrentOutType()} currentOutType in template file ${
: Utils.getRandomFloatRounded(connectorMaximumPower / unitDivider);
break;
default:
- logger.error(errMsg);
+ logger.error(`${chargingStation.logPrefix()} ${errMsg}`);
throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, OCPP16RequestCommand.METER_VALUES);
}
meterValue.sampledValue.push(
chargingStation,
currentSampledValueTemplate.measurand
);
- const errMsg = `${chargingStation.logPrefix()} MeterValues measurand ${
+ const errMsg = `MeterValues measurand ${
currentSampledValueTemplate.measurand ??
OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
}: Unknown ${chargingStation.getCurrentOutType()} currentOutType in template file ${
: Utils.getRandomFloatRounded(connectorMaximumAmperage);
break;
default:
- logger.error(errMsg);
+ logger.error(`${chargingStation.logPrefix()} ${errMsg}`);
throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, OCPP16RequestCommand.METER_VALUES);
}
meterValue.sampledValue.push(
measurandType: OCPP16MeterValueMeasurand
): void {
if (Utils.isUndefined(chargingStation.powerDivider)) {
- const errMsg = `${chargingStation.logPrefix()} MeterValues measurand ${
+ const errMsg = `MeterValues measurand ${
measurandType ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
}: powerDivider is undefined`;
- logger.error(errMsg);
+ logger.error(`${chargingStation.logPrefix()} ${errMsg}`);
throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, OCPP16RequestCommand.METER_VALUES);
} else if (chargingStation?.powerDivider <= 0) {
- const errMsg = `${chargingStation.logPrefix()} MeterValues measurand ${
+ const errMsg = `MeterValues measurand ${
measurandType ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
}: powerDivider have zero or below value ${chargingStation.powerDivider}`;
- logger.error(errMsg);
+ logger.error(`${chargingStation.logPrefix()} ${errMsg}`);
throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, OCPP16RequestCommand.METER_VALUES);
}
}
params: HandleErrorParams<T> = { throwError: true }
): T {
logger.error(
- `${chargingStation.logPrefix()} ${moduleName}.handleIncomingRequestError: Incoming request command %s error:`,
- commandName,
+ `${chargingStation.logPrefix()} ${moduleName}.handleIncomingRequestError: Incoming request command ${commandName} error:`,
error
);
if (!params?.throwError && params?.errorResponse) {
);
}
logger.error(
- `${chargingStation.logPrefix()} Error %j occurred when calling command %s with message data %j`,
- error,
- commandName,
- messagePayload
+ `${chargingStation.logPrefix()} Error occurred when calling command ${commandName} with message data ${JSON.stringify(
+ messagePayload
+ )}:`,
+ error
);
chargingStation.requests.delete(messageId);
reject(error);
error: Error,
params: HandleErrorParams<EmptyObject> = { throwError: true }
): void {
- logger.error(chargingStation.logPrefix() + ' Request command %s error:', commandName, error);
+ logger.error(`${chargingStation.logPrefix()} Request command ${commandName} error:`, error);
if (params?.throwError) {
throw error;
}
"name": "webui",
"version": "0.1.0",
"scripts": {
+ "start": "npm run build && node start.js",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"lint:fix": "vue-cli-service lint --fix",
- "start": "npm run build && node start.js",
"test": "vue-cli-service test:unit"
},
"dependencies": {
#cs-table__head,
#cs-table__body {
width: 100%;
- display: block;
min-width: 930px;
+ display: block;
}
#cs-table__body {
export interface ResponsePayload extends JsonObject {
status: ResponseStatus;
+ hashIds?: string[];
}