Fixed OCPI consistent naming
MODIFY
src/async-task/tasks/ocpi/OCPIPushEVSEStatusesAsyncTask.ts
src/async-task/tasks/ocpi/OCPIPushEVSEStatusesAsyncTask.ts
@@ -28,7 +28,7 @@ export default class OCPIPushEVSEStatusesAsyncTask extends AbstractAsyncTask {
if (!ocpiClient) {
throw new Error(`OCPI Client not found in Endpoint ID '${this.getAsyncTask().parameters.endpointID}'`);
}
- await ocpiClient.sendEVSEStatuses();
+ await ocpiClient.pushChargingStationStatuses();
} finally {
// Release the lock
await LockingManager.release(patchStatusesLock);

MODIFY
src/client/ocpi/CpoOCPIClient.ts
src/client/ocpi/CpoOCPIClient.ts
@@ -461,47 +461,17 @@ export default class CpoOCPIClient extends OCPIClient {
}
}
- public async updateChargingStationStatus(chargingStation: ChargingStation, status?: OCPIEvseStatus): Promise<void> {
- if (!chargingStation.siteAreaID) {
- throw new BackendError({
- ...LoggingHelper.getChargingStationProperties(chargingStation),
- action: ServerAction.OCPI_CPO_UPDATE_STATUS,
- message: 'Charging Station must be associated to a Site Area',
- module: MODULE_NAME, method: 'removeChargingStation',
- });
- }
- if (!chargingStation.issuer) {
- throw new BackendError({
- ...LoggingHelper.getChargingStationProperties(chargingStation),
- action: ServerAction.OCPI_CPO_UPDATE_STATUS,
- message: 'Only charging Station issued locally can be exposed to IOP',
- module: MODULE_NAME, method: 'removeChargingStation',
- });
- }
+ public async patchChargingStationStatus(chargingStation: ChargingStation, status?: OCPIEvseStatus): Promise<void> {
const results: any[] = [];
for (const connector of chargingStation.connectors) {
- const result = await this.patchEVSEStatus(
- {
- id: chargingStation.id,
- siteID: chargingStation.siteID,
- siteAreaID: chargingStation.siteAreaID,
- companyID: chargingStation.companyID
- }, chargingStation.siteID, RoamingUtils.buildEvseUID(chargingStation, connector.connectorId),
- status ?? OCPIUtils.convertStatusToOcpiStatus(connector.status));
+ const result = await this.patchChargingStationConnectorStatus(chargingStation, connector, status);
results.push(result.data);
}
- await Logging.logInfo({
- ...LoggingHelper.getChargingStationProperties(chargingStation),
- tenantID: this.tenant.id,
- action: ServerAction.OCPI_CPO_UPDATE_STATUS,
- message: 'Charging Station has been removed successfully',
- module: MODULE_NAME, method: 'removeChargingStation',
- detailedMessages: { responses: results }
- });
}
- public async patchChargingStationStatus(chargingStation: ChargingStation, connector: Connector): Promise<void> {
- if (!chargingStation.siteAreaID && !chargingStation.siteArea) {
+ public async patchChargingStationConnectorStatus(chargingStation: ChargingStation,
+ connector: Connector, status?: OCPIEvseStatus): Promise<AxiosResponse<any>> {
+ if (!chargingStation.siteAreaID) {
throw new BackendError({
...LoggingHelper.getChargingStationProperties(chargingStation),
action: ServerAction.OCPI_CPO_UPDATE_STATUS,
@@ -525,7 +495,7 @@ export default class CpoOCPIClient extends OCPIClient {
module: MODULE_NAME, method: 'patchChargingStationStatus',
});
}
- await this.patchEVSEStatus(
+ return this.patchEVSEStatus(
{
id: chargingStation.id,
siteID: chargingStation.siteID,
@@ -533,7 +503,8 @@ export default class CpoOCPIClient extends OCPIClient {
companyID: chargingStation.companyID,
},
chargingStation.siteID,
- RoamingUtils.buildEvseUID(chargingStation, connector.connectorId), OCPIUtils.convertStatusToOcpiStatus(connector.status)
+ RoamingUtils.buildEvseUID(chargingStation, connector.connectorId),
+ status ?? OCPIUtils.convertStatusToOcpiStatus(connector.status)
);
}
@@ -683,7 +654,7 @@ export default class CpoOCPIClient extends OCPIClient {
return result;
}
- public async sendEVSEStatuses(partial = false): Promise<OCPIResult> {
+ public async pushChargingStationStatuses(partial = false): Promise<OCPIResult> {
// Result
const result: OCPIResult = {
success: 0,

MODIFY
src/scheduler/tasks/ocpi/OCPIPushEVSEStatusesTask.ts
src/scheduler/tasks/ocpi/OCPIPushEVSEStatusesTask.ts
@@ -66,7 +66,7 @@ export default class OCPIPushEVSEStatusesTask extends TenantSchedulerTask {
// Build OCPI Client
const ocpiClient = await OCPIClientFactory.getCpoOcpiClient(tenant, ocpiEndpoint);
// Send EVSE statuses
- const sendResult = await ocpiClient.sendEVSEStatuses(config.partial);
+ const sendResult = await ocpiClient.pushChargingStationStatuses(config.partial);
await Logging.logInfo({
tenantID: tenant.id,
module: MODULE_NAME, method: 'processOCPIEndpoint',

MODIFY
src/server/ocpi/OCPIFacade.ts
src/server/ocpi/OCPIFacade.ts
@@ -118,7 +118,7 @@ export default class OCPIFacade {
const ocpiClient = await OCPIClientFactory.getAvailableOcpiClient(tenant, OCPIRole.CPO) as CpoOCPIClient;
// Patch status
if (ocpiClient) {
- await ocpiClient.patchChargingStationStatus(chargingStation, connector);
+ await ocpiClient.patchChargingStationConnectorStatus(chargingStation, connector);
}
}
} catch (error) {

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1988,7 +1988,7 @@ export default class ChargingStationService {
status = OCPIEvseStatus.REMOVED;
}
if (ocpiClient) {
- await ocpiClient.updateChargingStationStatus(chargingStation, status);
+ await ocpiClient.patchChargingStationStatus(chargingStation, status);
}
} catch (error) {
await Logging.logError({

Fixed OCPI consistent naming