renaming: pushLocations -> pushEVSEStatuses
MODIFY
docker/config-standalone.json
docker/config-standalone.json
}
},
{
- "name": "OCPIPushLocationsTask",
+ "name": "OCPIPushEVSEStatusesTask",
"active": false,
"periodicity": "0 1 * * *",
"config": {}

MODIFY
docker/config.json
docker/config.json
}
},
{
- "name": "OCPIPushLocationsTask",
+ "name": "OCPIPushEVSEStatusesTask",
"active": false,
"periodicity": "0 1 * * *",
"config": {}

MODIFY
src/scheduler/SchedulerManager.ts
src/scheduler/SchedulerManager.ts
@@ -17,7 +17,7 @@ import OCPIGetLocationsTask from './tasks/ocpi/OCPIGetLocationsTask';
import OCPIGetSessionsTask from './tasks/ocpi/OCPIGetSessionsTask';
import OCPIGetTokensTask from './tasks/ocpi/OCPIGetTokensTask';
import OCPIPushCdrsTask from './tasks/ocpi/OCPIPushCdrsTask';
-import OCPIPushLocationsTask from './tasks/ocpi/OCPIPushLocationsTask';
+import OCPIPushEVSEStatusesTask from './tasks/ocpi/OCPIPushEVSEStatusesTask';
import SchedulerTask from './SchedulerTask';
import { ServerAction } from '../types/Server';
import SynchronizeBillingInvoicesTask from './tasks/SynchronizeBillingInvoicesTask';
@@ -71,8 +71,8 @@ export default class SchedulerManager {
// The task runs every five minutes
schedulerTask = new CheckPreparingSessionNotStartedTask();
break;
- case 'OCPIPushLocationsTask':
- schedulerTask = new OCPIPushLocationsTask();
+ case 'OCPIPushEVSEStatusesTask':
+ schedulerTask = new OCPIPushEVSEStatusesTask();
break;
case 'OCPIGetCdrsTask':
schedulerTask = new OCPIGetCdrsTask();

RENAME
src/scheduler/tasks/ocpi/OCPIPushLocationsTask.ts
src/scheduler/tasks/ocpi/OCPIPushEVSEStatusesTask.ts
-import { OCPIPushLocationsTaskConfig, TaskConfig } from '../../../types/TaskConfig';
+import { OCPIPushEVSEStatusesTaskConfig, TaskConfig } from '../../../types/TaskConfig';
import Constants from '../../../utils/Constants';
import LockingHelper from '../../../locking/LockingHelper';
@@ -15,9 +15,9 @@ import Tenant from '../../../types/Tenant';
import TenantComponents from '../../../types/TenantComponents';
import Utils from '../../../utils/Utils';
-const MODULE_NAME = 'OCPIPushLocationsTask';
+const MODULE_NAME = 'OCPIPushEVSEStatusesTask';
-export default class OCPIPushLocationsTask extends SchedulerTask {
+export default class OCPIPushEVSEStatusesTask extends SchedulerTask {
async processTenant(tenant: Tenant, config: TaskConfig): Promise<void> {
try {
@@ -31,11 +31,11 @@ export default class OCPIPushLocationsTask extends SchedulerTask {
}
} catch (error) {
// Log error
- Logging.logActionExceptionMessage(tenant.id, ServerAction.OCPI_PUSH_LOCATIONS, error);
+ Logging.logActionExceptionMessage(tenant.id, ServerAction.OCPI_PUSH_EVSE_STATUSES, error);
}
}
- private async processOCPIEndpoint(tenant: Tenant, ocpiEndpoint: OCPIEndpoint, config: OCPIPushLocationsTaskConfig): Promise<void> {
+ private async processOCPIEndpoint(tenant: Tenant, ocpiEndpoint: OCPIEndpoint, config: OCPIPushEVSEStatusesTaskConfig): Promise<void> {
// Get the lock
const ocpiLock = await LockingHelper.createOCPIPatchCpoLocationsLock(tenant.id, ocpiEndpoint);
if (ocpiLock) {
@@ -45,7 +45,7 @@ export default class OCPIPushLocationsTask extends SchedulerTask {
Logging.logDebug({
tenantID: tenant.id,
module: MODULE_NAME, method: 'processOCPIEndpoint',
- action: ServerAction.OCPI_PUSH_LOCATIONS,
+ action: ServerAction.OCPI_PUSH_EVSE_STATUSES,
message: `The OCPI endpoint '${ocpiEndpoint.name}' is not registered. Skipping the ocpiendpoint.`
});
return;
@@ -54,7 +54,7 @@ export default class OCPIPushLocationsTask extends SchedulerTask {
Logging.logDebug({
tenantID: tenant.id,
module: MODULE_NAME, method: 'processOCPIEndpoint',
- action: ServerAction.OCPI_PUSH_LOCATIONS,
+ action: ServerAction.OCPI_PUSH_EVSE_STATUSES,
message: `The OCPI endpoint '${ocpiEndpoint.name}' is inactive.`
});
return;
@@ -62,25 +62,22 @@ export default class OCPIPushLocationsTask extends SchedulerTask {
Logging.logInfo({
tenantID: tenant.id,
module: MODULE_NAME, method: 'processOCPIEndpoint',
- action: ServerAction.OCPI_PUSH_LOCATIONS,
+ action: ServerAction.OCPI_PUSH_EVSE_STATUSES,
message: `The push Locations process for endpoint '${ocpiEndpoint.name}' is being processed`
});
// Build OCPI Client
const ocpiClient = await OCPIClientFactory.getCpoOcpiClient(tenant, ocpiEndpoint);
- // TODO: Investigate if the PushLocationsTask only pushes the EVSE Statuses and not all EVSEs / Locations
- // CpoOcpiClient has no method sendLocations or pushLocation
- // sendEVSEStatuses() -> patchEVSEStatus() only contains the EVSE status in the payload and no location
// Send EVSE statuses
const sendResult = await ocpiClient.sendEVSEStatuses(!Utils.isUndefined(config.processAllEVSEs) ? config.processAllEVSEs : false);
Logging.logInfo({
tenantID: tenant.id,
module: MODULE_NAME, method: 'processOCPIEndpoint',
- action: ServerAction.OCPI_PUSH_LOCATIONS,
+ action: ServerAction.OCPI_PUSH_EVSE_STATUSES,
message: `The push Locations process for endpoint '${ocpiEndpoint.name}' is completed (Success: ${sendResult.success} / Failure: ${sendResult.failure})`
});
} catch (error) {
// Log error
- Logging.logActionExceptionMessage(tenant.id, ServerAction.OCPI_PUSH_LOCATIONS, error);
+ Logging.logActionExceptionMessage(tenant.id, ServerAction.OCPI_PUSH_EVSE_STATUSES, error);
} finally {
// Release the lock
await LockingManager.release(ocpiLock);

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -131,7 +131,7 @@ export enum ServerAction {
OCPI_PUSH_TOKENS = 'OcpiPushTokens',
OCPI_PUSH_SESSION = 'OcpiPushSession',
OCPI_PUSH_SESSIONS = 'OcpiPushSessions',
- OCPI_PUSH_LOCATIONS = 'OcpiPushLocations',
+ OCPI_PUSH_EVSE_STATUSES = 'OcpiPushEVSEStatuses',
OCPI_PUSH_CDRS = 'OcpiPushCdrs',
OCPI_PULL_CDRS = 'OcpiPullCdrs',
OCPI_PULL_LOCATIONS = 'OcpiPullLocations',

MODIFY
src/types/TaskConfig.ts
src/types/TaskConfig.ts
@@ -33,6 +33,6 @@ export interface OCPIGetLocationsTaskConfig extends TaskConfig {
partial?: boolean;
}
-export interface OCPIPushLocationsTaskConfig extends TaskConfig {
+export interface OCPIPushEVSEStatusesTaskConfig extends TaskConfig {
processAllEVSEs?: boolean;
}

renaming: pushLocations -> pushEVSEStatuses