Send OCPI and OICP status Unavailable when Charging Station's Web Socket is disconnected
MODIFY
src/client/ocpi/CpoOCPIClient.ts
src/client/ocpi/CpoOCPIClient.ts
@@ -489,7 +489,8 @@ export default class CpoOCPIClient extends OCPIClient {
module: MODULE_NAME, method: 'patchChargingStationStatus',
});
}
- await this.patchEVSEStatus(chargingStation.id, chargingStation.siteID, OCPIUtils.buildEvseUID(chargingStation, connector), OCPIUtilsService.convertStatus2OCPIStatus(connector.status));
+ await this.patchEVSEStatus(chargingStation.id, chargingStation.siteID,
+ OCPIUtils.buildEvseUID(chargingStation, connector), OCPIUtilsService.convertStatus2OCPIStatus(connector.status));
}
public async checkSessions(): Promise<OCPIResult> {

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
@@ -749,7 +749,7 @@ export default class OCPIUtilsService {
evse_id: RoamingUtils.buildEvseID(options.countryID, options.partyID,
chargingStation.id, connector.connectorId),
location_id: chargingStation.siteID,
- status: OCPIUtilsService.convertStatus2OCPIStatus(connector.status),
+ status: chargingStation.inactive ? OCPIEvseStatus.INOPERATIVE : OCPIUtilsService.convertStatus2OCPIStatus(connector.status),
capabilities: [OCPICapability.REMOTE_START_STOP_CAPABLE, OCPICapability.RFID_READER],
connectors: [OCPIUtilsService.convertConnector2OCPIConnector(tenant, chargingStation, connector, options.countryID, options.partyID)],
last_updated: chargingStation.lastSeen,
@@ -784,10 +784,10 @@ export default class OCPIUtilsService {
// Build evse
const evse: OCPIEvse = {
// Force the connector id to always be 1 on charging station that have mutually exclusive connectors
- uid: OCPIUtils.buildEvseUID(chargingStation, { connectorId: 1, status: connectorOneStatus }),
+ uid: OCPIUtils.buildEvseUID(chargingStation, { connectorId: 1 } as Connector),
evse_id: RoamingUtils.buildEvseID(options.countryID, options.partyID, chargingStation.id, 1),
location_id: chargingStation.siteID,
- status: OCPIUtilsService.convertStatus2OCPIStatus(connectorOneStatus),
+ status: chargingStation.inactive ? OCPIEvseStatus.INOPERATIVE : OCPIUtilsService.convertStatus2OCPIStatus(connectorOneStatus),
capabilities: [OCPICapability.REMOTE_START_STOP_CAPABLE, OCPICapability.RFID_READER],
connectors: ocpiConnectors,
last_updated: chargingStation.lastSeen,

MODIFY
src/server/oicp/OICPUtils.ts
src/server/oicp/OICPUtils.ts
@@ -43,7 +43,7 @@ export default class OICPUtils {
options: { countryID: string; partyID: string; addChargeBoxID?: boolean}): OICPEvseStatusRecord {
return {
EvseID: RoamingUtils.buildEvseID(options.countryID, options.partyID, chargingStation.id, connector.connectorId),
- EvseStatus: OICPUtils.convertStatus2OICPEvseStatus(connector.status),
+ EvseStatus: chargingStation.inactive ? OICPEvseStatus.OutOfService : OICPUtils.convertStatus2OICPEvseStatus(connector.status),
ChargingStationID: chargingStation.id,
};
}

Send OCPI and OICP status Unavailable when Charging Station's Web Socket is disconnected