Adding additional IDs for logs in OCPPStorage and related files
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -1463,6 +1463,9 @@ export default class OCPPService {
// Create the normalized meter value
const normalizedMeterValues: OCPPNormalizedMeterValues = {
chargeBoxID: chargingStation.id,
+ siteID: chargingStation.siteID,
+ siteAreaID: chargingStation.siteAreaID,
+ companyID: chargingStation.companyID,
values: []
};
// OCPP 1.5: transfer to OCPP 1.6 structure

MODIFY
src/server/ocpp/utils/OCPPUtils.ts
src/server/ocpp/utils/OCPPUtils.ts
@@ -238,6 +238,9 @@ export default class OCPPUtils {
{
id: Utils.getRandomIntSafe().toString(),
chargeBoxID: transaction.chargeBoxID,
+ siteID: transaction.siteID,
+ siteAreaID: transaction.siteAreaID,
+ companyID: transaction.companyID,
connectorId: transaction.connectorId,
transactionId: transaction.id,
timestamp: transaction.timestamp,
@@ -711,6 +714,9 @@ export default class OCPPUtils {
const stopMeterValues: OCPPNormalizedMeterValue[] = [];
const meterValueBasedProps = {
chargeBoxID: transaction.chargeBoxID,
+ siteID: transaction.siteID,
+ siteAreaID: transaction.siteAreaID,
+ companyID: transaction.companyID,
connectorId: transaction.connectorId,
transactionId: transaction.id,
timestamp: Utils.convertToDate(stopTransaction.timestamp),

MODIFY
src/storage/mongodb/OCPPStorage.ts
src/storage/mongodb/OCPPStorage.ts
@@ -446,6 +446,9 @@ export default class OCPPStorage {
await Logging.logError({
tenantID: tenant.id,
source: meterValueToSave.chargeBoxID,
+ siteID: meterValueToSave.siteID,
+ siteAreaID: meterValueToSave.siteAreaID,
+ companyID: meterValueToSave.companyID,
module: MODULE_NAME, method: 'saveMeterValues',
action: ServerAction.METER_VALUES,
message: 'An error occurred while trying to save the meter value',

MODIFY
src/types/ocpp/OCPPServer.ts
src/types/ocpp/OCPPServer.ts
@@ -123,12 +123,18 @@ export interface OCPPMeterValuesResponse {}
export interface OCPPNormalizedMeterValues {
chargeBoxID: string;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
values: OCPPNormalizedMeterValue[];
}
export interface OCPPNormalizedMeterValue {
id: string;
chargeBoxID: string;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
connectorId: number;
transactionId: number;
timestamp: Date;

Adding additional IDs for logs in OCPPStorage and related files