Optimized Status Notif
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -834,7 +834,7 @@ export default class OCPPService {
if (statusNotification.status === ChargePointStatus.AVAILABLE) {
// Get the last transaction
const lastTransaction = await TransactionStorage.getLastTransactionFromChargingStation(
- tenant, chargingStation.id, connector.connectorId, { withChargingStation: true, withUser: true, withTag: true });
+ tenant, chargingStation.id, connector.connectorId);
// Transaction completed
if (lastTransaction?.stop) {
// Check Inactivity
@@ -863,7 +863,7 @@ export default class OCPPService {
lastTransaction.stop.extraInactivitySecs = 0;
} else {
// Fix the Inactivity severity
- lastTransaction.stop.inactivityStatus = Utils.getInactivityStatusLevel(lastTransaction.chargeBox, lastTransaction.connectorId,
+ lastTransaction.stop.inactivityStatus = Utils.getInactivityStatusLevel(chargingStation, lastTransaction.connectorId,
lastTransaction.stop.totalInactivitySecs + lastTransaction.stop.extraInactivitySecs);
// Build extra inactivity consumption
await OCPPUtils.buildExtraConsumptionInactivity(tenant, lastTransaction);

MODIFY
src/storage/mongodb/TransactionStorage.ts
src/storage/mongodb/TransactionStorage.ts
@@ -1173,7 +1173,7 @@ export default class TransactionStorage {
}
public static async getLastTransactionFromChargingStation(tenant: Tenant, chargeBoxID: string, connectorId: number,
- params: { withChargingStation?: boolean; withUser?: boolean; withTag: boolean; }): Promise<Transaction> {
+ params: { withChargingStation?: boolean; withUser?: boolean; withTag?: boolean; } = {}): Promise<Transaction> {
// Debug
const uniqueTimerID = Logging.traceStart(tenant.id, MODULE_NAME, 'getLastTransaction');
// Check

Optimized Status Notif