Fixed remote start transaction
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
@@ -112,8 +112,10 @@ export default class OCPIUtilsService {
}
// Build ID
chargingStation.id = evse.evse_id;
+ // TODO: Handle missing evse_id in eMSP (tokens, sessions, cdr): Need to identify the use cases so force it to crash here
if (!chargingStation.id) {
throw new BackendError({
+ action: ServerAction.OCPI_ENDPOINT,
message: `Cannot find Charging Station EVSE ID`,
module: MODULE_NAME, method: 'convertEvseToChargingStation',
detailedMessages: { evse, location }

MODIFY
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/cpo/CPOCommandsEndpoint.ts
src/server/ocpi/ocpi-services-impl/ocpi-2.1.1/cpo/CPOCommandsEndpoint.ts
@@ -105,8 +105,8 @@ export default class CPOCommandsEndpoint extends AbstractEndpoint {
return this.getOCPIResponse(OCPICommandResponseType.REJECTED);
}
// Get the Charging Station
- const chargingStation = await ChargingStationStorage.getChargingStationByOcpiEvseID(
- tenant.id, startSession.evse_uid);
+ const chargingStation = await ChargingStationStorage.getChargingStationByOcpiLocationUid(
+ tenant.id, startSession.location_id, startSession.evse_uid);
if (!chargingStation) {
Logging.logError({
tenantID: tenant.id,

MODIFY
src/storage/mongodb/ChargingStationStorage.ts
src/storage/mongodb/ChargingStationStorage.ts
@@ -151,12 +151,12 @@ export default class ChargingStationStorage {
return chargingStationsMDB.count === 1 ? chargingStationsMDB.result[0] : null;
}
- public static async getChargingStationByOcpiLocationUid(tenantID: string, ocpiLocation: string = Constants.UNKNOWN_STRING_ID,
- ocpiUid: string = Constants.UNKNOWN_STRING_ID,
+ public static async getChargingStationByOcpiLocationUid(tenantID: string, ocpiLocationID: string = Constants.UNKNOWN_STRING_ID,
+ ocpiEvseUid: string = Constants.UNKNOWN_STRING_ID,
projectFields?: string[]): Promise<ChargingStation> {
const chargingStationsMDB = await ChargingStationStorage.getChargingStations(tenantID, {
- siteIDs: [ocpiLocation],
- ocpiUid: ocpiUid,
+ siteIDs: [ocpiLocationID],
+ ocpiEvseUid: ocpiEvseUid,
}, Constants.DB_PARAMS_SINGLE_RECORD, projectFields);
return chargingStationsMDB.count === 1 ? chargingStationsMDB.result[0] : null;
}
@@ -164,7 +164,7 @@ export default class ChargingStationStorage {
public static async getChargingStations(tenantID: string,
params: {
search?: string; chargingStationIDs?: string[]; chargingStationSerialNumbers?: string[]; siteAreaIDs?: string[]; withNoSiteArea?: boolean;
- connectorStatuses?: string[]; connectorTypes?: string[]; statusChangedBefore?: Date; ocpiUid?: string; ocpiEvseID?: string;
+ connectorStatuses?: string[]; connectorTypes?: string[]; statusChangedBefore?: Date; ocpiEvseUid?: string; ocpiEvseID?: string;
siteIDs?: string[]; withSite?: boolean; includeDeleted?: boolean; offlineSince?: Date; issuer?: boolean;
locCoordinates?: number[]; locMaxDistanceMeters?: number; public?: boolean;
},
@@ -226,8 +226,8 @@ export default class ChargingStationStorage {
};
}
// OCPI Uids
- if (params.ocpiUid) {
- filters['ocpiData.evses.uid'] = params.ocpiUid;
+ if (params.ocpiEvseUid) {
+ filters['ocpiData.evses.uid'] = params.ocpiEvseUid;
}
// OCPI Evse ID
if (params.ocpiEvseID) {

Fixed remote start transaction