Fixed total inactivity in CDR
MODIFY
src/client/ocpi/CpoOCPIClient.ts
src/client/ocpi/CpoOCPIClient.ts
@@ -396,7 +396,7 @@ export default class CpoOCPIClient extends OCPIClient {
id: transaction.ocpiData.session.id,
start_date_time: transaction.timestamp,
stop_date_time: transaction.stop.timestamp,
- total_parking_time: transaction.stop.totalInactivitySecs / 3600, // In hours
+ total_parking_time: (transaction.stop.totalInactivitySecs + transaction.stop.extraInactivitySecs) / 3600, // In hours
total_time: transaction.stop.totalDurationSecs / 3600, // In hours
total_energy: transaction.stop.totalConsumptionWh / 1000, // In kW.h
currency: this.settings.currency,

MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -941,7 +941,7 @@ export default class OCPPService {
return;
}
// Check for inactivity
- await this.checkStatusNotificationInactivityAndPushCdr(tenantID, chargingStation, statusNotification, foundConnector);
+ await this.checkStatusNotificationExtraInactivity(tenantID, chargingStation, statusNotification, foundConnector);
// Set connector data
foundConnector.connectorId = statusNotification.connectorId;
foundConnector.status = statusNotification.status;
@@ -989,7 +989,8 @@ export default class OCPPService {
}
}
- private async checkStatusNotificationInactivityAndPushCdr(tenantID: string, chargingStation: ChargingStation, statusNotification: OCPPStatusNotificationRequestExtended, connector: Connector) {
+ private async checkStatusNotificationExtraInactivity(tenantID: string, chargingStation: ChargingStation,
+ statusNotification: OCPPStatusNotificationRequestExtended, connector: Connector) {
// Check Inactivity
// OCPP 1.6: Finishing --> Available
if (connector.status === ChargePointStatus.FINISHING &&
@@ -1020,7 +1021,7 @@ export default class OCPPService {
tenantID: tenantID,
source: chargingStation.id,
user: lastTransaction.userID,
- module: MODULE_NAME, method: 'checkStatusNotificationInactivityAndPushCdr',
+ module: MODULE_NAME, method: 'checkStatusNotificationExtraInactivity',
action: ServerAction.EXTRA_INACTIVITY,
message: `Connector '${lastTransaction.connectorId}' > Transaction ID '${lastTransaction.id}' > Extra Inactivity of ${lastTransaction.stop.extraInactivitySecs} secs has been added`,
detailedMessages: [statusNotification, lastTransaction]
@@ -1031,7 +1032,7 @@ export default class OCPPService {
tenantID: tenantID,
source: chargingStation.id,
user: lastTransaction.userID,
- module: MODULE_NAME, method: 'checkStatusNotificationInactivityAndPushCdr',
+ module: MODULE_NAME, method: 'checkStatusNotificationExtraInactivity',
action: ServerAction.EXTRA_INACTIVITY,
message: `Connector '${lastTransaction.connectorId}' > Transaction ID '${lastTransaction.id}' > Extra Inactivity has already been computed`,
detailedMessages: [statusNotification, lastTransaction]
@@ -1057,7 +1058,7 @@ export default class OCPPService {
tenantID: tenantID,
source: chargingStation.id,
user: lastTransaction.userID,
- module: MODULE_NAME, method: 'checkStatusNotificationInactivityAndPushCdr',
+ module: MODULE_NAME, method: 'checkStatusNotificationExtraInactivity',
action: ServerAction.EXTRA_INACTIVITY,
message: `Connector '${lastTransaction.connectorId}' > Transaction ID '${lastTransaction.id}' > No Extra Inactivity has been added`,
detailedMessages: [statusNotification, lastTransaction]

MODIFY
src/server/ocpp/utils/OCPPUtils.ts
src/server/ocpp/utils/OCPPUtils.ts
@@ -53,6 +53,7 @@ export default class OCPPUtils {
action = ServerAction.UPDATE_TRANSACTION;
break;
case TransactionAction.STOP:
+ case TransactionAction.END:
action = ServerAction.STOP_TRANSACTION;
break;
}
@@ -87,7 +88,7 @@ export default class OCPPUtils {
action: action,
module: MODULE_NAME,
method: 'processOCPITransaction',
- message: `User '${user.id}' with Tag ID '${transaction.tagID}' cannot ${transactionAction} a Transaction thought OCPI protocol due to missing OCPI Token`
+ message: `User '${Utils.buildUserFullName(user)}' with Tag ID '${transaction.tagID}' cannot ${transactionAction} a Transaction thought OCPI protocol due to missing OCPI Token`
});
}
// Retrieve Authorization ID

Fixed total inactivity in CDR