import crypto from 'crypto';
import fs from 'fs';
import path from 'path';
-import { URL, fileURLToPath } from 'url';
+import { URL } from 'url';
import { parentPort } from 'worker_threads';
import WebSocket, { Data, RawData } from 'ws';
return this.stationInfo.mayAuthorizeAtRemoteStart ?? true;
}
+ public getPayloadSchemaValidation(): boolean | undefined {
+ return this.stationInfo.payloadSchemaValidation ?? true;
+ }
+
public getNumberOfPhases(stationInfo?: ChargingStationInfo): number | undefined {
const localStationInfo: ChargingStationInfo = stationInfo ?? this.stationInfo;
switch (this.getCurrentOutType(stationInfo)) {
this.hashId = ChargingStationUtils.getHashId(this.index, this.getTemplateFromFile());
logger.info(`${this.logPrefix()} Charging station hashId '${this.hashId}'`);
this.configurationFile = path.join(
- path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../'),
- 'assets',
- 'configurations',
+ path.dirname(this.templateFile.replace('station-templates', 'configurations')),
this.hashId + '.json'
);
this.stationInfo = this.getStationInfo();
} catch (error) {
// Log
logger.error(
- '%s Incoming OCPP message %j matching cached request %j processing error %j',
+ "%s Incoming OCPP '%s' message '%j' matching cached request '%j' processing error: %j",
this.logPrefix(),
+ commandName ?? requestCommandName ?? null,
data.toString(),
this.requests.get(messageId),
error
);
+ if (!(error instanceof OCPPError)) {
+ logger.warn(
+ "%s Error thrown at incoming OCPP '%s' message '%j' handling is not an OCPPError: %j",
+ this.logPrefix(),
+ commandName ?? requestCommandName ?? null,
+ data.toString(),
+ error
+ );
+ }
// Send error
messageType === MessageType.CALL_MESSAGE &&
(await this.ocppRequestService.sendError(