Adding additional IDs to patchEVSEStatus method which uses logging.
MODIFY
src/client/ocpi/CpoOCPIClient.ts
src/client/ocpi/CpoOCPIClient.ts
@@ -454,7 +454,12 @@ export default class CpoOCPIClient extends OCPIClient {
const results: any[] = [];
for (const connector of chargingStation.connectors) {
const result = await this.patchEVSEStatus(
- chargingStation.id, chargingStation.siteID, OCPIUtils.buildEvseUID(chargingStation, connector),
+ {
+ id: chargingStation.id,
+ siteID: chargingStation.siteID,
+ siteAreaID: chargingStation.siteAreaID,
+ companyID: chargingStation.companyID
+ }, chargingStation.siteID, OCPIUtils.buildEvseUID(chargingStation, connector),
status ?? OCPIUtilsService.convertStatus2OCPIStatus(connector.status));
results.push(result.data);
}
@@ -497,7 +502,12 @@ export default class CpoOCPIClient extends OCPIClient {
module: MODULE_NAME, method: 'patchChargingStationStatus',
});
}
- await this.patchEVSEStatus(chargingStation.id, chargingStation.siteID,
+ await this.patchEVSEStatus({
+ id: chargingStation.id,
+ siteID: chargingStation.siteID,
+ siteAreaID: chargingStation.siteAreaID,
+ companyID: chargingStation.companyID,
+ }, chargingStation.siteID,
OCPIUtils.buildEvseUID(chargingStation, connector), OCPIUtilsService.convertStatus2OCPIStatus(connector.status));
}
@@ -702,7 +712,13 @@ export default class CpoOCPIClient extends OCPIClient {
// Process it if not empty
if (location.id && evse?.uid) {
try {
- await this.patchEVSEStatus(evse.chargeBoxId, location.id, evse.uid, evse.status);
+ const chargingStationDetails : any = {
+ id: evse.chargeBoxId,
+ siteID: evse.siteID,
+ siteAreaID: evse.siteAreaID,
+ companyID: evse.companyID,
+ };
+ await this.patchEVSEStatus(chargingStationDetails, location.id, evse.uid, evse.status);
result.success++;
} catch (error) {
result.failure++;
@@ -786,11 +802,12 @@ export default class CpoOCPIClient extends OCPIClient {
return [];
}
- private async patchEVSEStatus(chargingStationID: string, locationId: string, evseUID: string, newStatus: OCPIEvseStatus): Promise<AxiosResponse<any>> {
+ private async patchEVSEStatus(chargingStation: { id: string, siteID: string, siteAreaID: string, companyID: string },
+ locationId: string, evseUID: string, newStatus: OCPIEvseStatus): Promise<AxiosResponse<any>> {
// Check for input parameter
if (!locationId || !evseUID || !newStatus) {
throw new BackendError({
- source: chargingStationID,
+ source: chargingStation.id,
action: ServerAction.OCPI_PATCH_STATUS,
module: MODULE_NAME, method: 'patchEVSEStatus',
message: 'Invalid parameters',
@@ -817,7 +834,11 @@ export default class CpoOCPIClient extends OCPIClient {
});
await Logging.logInfo({
tenantID: this.tenant.id,
- source: chargingStationID,
+ siteID: chargingStation.siteID,
+ siteAreaID: chargingStation.siteAreaID,
+ companyID: chargingStation.companyID,
+ chargeBoxID: chargingStation.id,
+ source: chargingStation.id,
action: ServerAction.OCPI_PATCH_STATUS,
message: `OCPI Charging Station ID '${evseUID}' has been patched successfully to '${newStatus}'`,
module: MODULE_NAME, method: 'patchEVSEStatus',

MODIFY
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/OCPIUtilsService.ts
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/OCPIUtilsService.ts
@@ -432,7 +432,7 @@ export default class OCPIUtilsService {
const chargingStations = await ChargingStationStorage.getChargingStations(tenant,
{ ...dbFilters, siteIDs: [ siteID ], public: true, issuer: true, withSiteArea: true },
dbParams ?? Constants.DB_PARAMS_MAX_LIMIT,
- [ 'id', 'chargePoints', 'connectors', 'coordinates', 'lastSeen', 'siteAreaID', 'siteID' ]);
+ [ 'id', 'chargePoints', 'connectors', 'coordinates', 'lastSeen', 'siteAreaID', 'siteID', 'companyID' ]);
for (const chargingStation of chargingStations.result) {
const chargingStationEvses: OCPIEvse[] = [];
if (!Utils.isEmptyArray(chargingStation.chargePoints)) {
@@ -831,6 +831,9 @@ export default class OCPIUtilsService {
// Check addChargeBoxID flag
if (options?.addChargeBoxID) {
evse.chargeBoxId = chargingStation.id;
+ evse.siteID = chargingStation.siteID;
+ evse.siteAreaID = chargingStation.siteAreaID;
+ evse.companyID = chargingStation.companyID;
}
return evse;
});
@@ -869,6 +872,9 @@ export default class OCPIUtilsService {
// Check addChargeBoxID flag
if (options?.addChargeBoxID) {
evse.chargeBoxId = chargingStation.id;
+ evse.siteID = chargingStation.siteID;
+ evse.siteAreaID = chargingStation.siteAreaID;
+ evse.companyID = chargingStation.companyID;
}
return [evse];
}

MODIFY
src/types/ocpi/OCPIEvse.ts
src/types/ocpi/OCPIEvse.ts
@@ -13,6 +13,9 @@ export interface OCPIEvse {
};
last_updated: Date;
chargeBoxId?: string;
+ siteID?: string;
+ siteAreaID?: string;
+ companyID?: string;
}
export enum OCPIEvseStatus {

Adding additional IDs to patchEVSEStatus method which uses logging.