Build opening times also in the CDR
MODIFY
src/client/ocpi/CpoOCPIClient.ts
src/client/ocpi/CpoOCPIClient.ts
@@ -1061,9 +1061,7 @@ export default class CpoOCPIClient extends OCPIClient {
last_updated: chargingStation.lastSeen
}],
last_updated: site.lastChangedOn ? site.lastChangedOn : site.createdOn,
- opening_times: {
- twentyfourseven: true,
- }
+ opening_times: OCPIUtilsService.buildOpeningTimes(tenant, site)
};
return ocpiLocation;
}

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
@@ -187,7 +187,52 @@ export default class OCPIUtilsService {
evses: withChargingStations ?
await OCPIUtilsService.getEvsesFromSite(tenant, site.id, options, Constants.DB_PARAMS_MAX_LIMIT) : [],
last_updated: site.lastChangedOn ? site.lastChangedOn : site.createdOn,
- opening_times: this.buildOpeningHours(tenant, site)
+ opening_times: this.buildOpeningTimes(tenant, site)
+ };
+ }
+
+ // TODO: Implement the Opening Hours in the Site and send it to OCPI
+ public static buildOpeningTimes(tenant: Tenant, site: Site): OCPIOpeningTimes {
+ switch (tenant?.id) {
+ // SLF
+ case '5be7fb271014d90008992f06':
+ // Mougins
+ switch (site.id) {
+ case '5abeba8d4bae1457eb565e5b':
+ return {
+ regular_hours: [
+ {
+ weekday: 1, // Monday
+ period_begin: '08:00',
+ period_end: '18:00'
+ },
+ {
+ weekday: 2,
+ period_begin: '08:00',
+ period_end: '18:00'
+ },
+ {
+ weekday: 3,
+ period_begin: '08:00',
+ period_end: '18:00'
+ },
+ {
+ weekday: 4,
+ period_begin: '08:00',
+ period_end: '18:00'
+ },
+ {
+ weekday: 5,
+ period_begin: '08:00',
+ period_end: '18:00'
+ },
+ ]
+ };
+ }
+ }
+ // Default
+ return {
+ twentyfourseven: true,
};
}
@@ -942,49 +987,4 @@ export default class OCPIUtilsService {
}
}
}
-
- // TODO: Implement the Opening Hours in the Site and send it to OCPI
- private static buildOpeningHours(tenant: Tenant, site: Site): OCPIOpeningTimes {
- switch (tenant?.id) {
- // SLF
- case '5be7fb271014d90008992f06':
- // Mougins
- switch (site.id) {
- case '5abeba8d4bae1457eb565e5b':
- return {
- regular_hours: [
- {
- weekday: 1, // Monday
- period_begin: '08:00',
- period_end: '18:00'
- },
- {
- weekday: 2,
- period_begin: '08:00',
- period_end: '18:00'
- },
- {
- weekday: 3,
- period_begin: '08:00',
- period_end: '18:00'
- },
- {
- weekday: 4,
- period_begin: '08:00',
- period_end: '18:00'
- },
- {
- weekday: 5,
- period_begin: '08:00',
- period_end: '18:00'
- },
- ]
- };
- }
- }
- // Default
- return {
- twentyfourseven: true,
- };
- }
}

Build opening times also in the CDR