Adjust notification end of charge
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -9,6 +9,7 @@ import ChargingStationConfiguration from '../../../types/configuration/ChargingS
import ChargingStationStorage from '../../../storage/mongodb/ChargingStationStorage';
import Configuration from '../../../utils/Configuration';
import Constants from '../../../utils/Constants';
+import Consumption from '../../../types/Consumption';
import ConsumptionStorage from '../../../storage/mongodb/ConsumptionStorage';
import CpoOCPIClient from '../../../client/ocpi/CpoOCPIClient';
import { DataResult } from '../../../types/DataResult';
@@ -1480,14 +1481,20 @@ export default class OCPPService {
// Has consumption?
if (transaction.numberOfMeterValues > 1 && transaction.currentTotalConsumptionWh > 0) {
// End of charge?
- if (this.chargingStationConfig.notifEndOfChargeEnabled &&
- ((transaction.currentTotalConsumptionWh > 0) && (transaction.currentTotalInactivitySecs >= 300) || transaction.currentStateOfCharge === 100)) {
+ if (this.chargingStationConfig.notifEndOfChargeEnabled && transaction.currentTotalConsumptionWh > 0) {
+ // Battery full
+ if (transaction.currentStateOfCharge === 100) {
+ // Send Notification
+ await this.notifyEndOfCharge(tenantID, chargingStation, transaction);
+ } else {
// Check last 5 consumptions
- const consumptions = await ConsumptionStorage.getTransactionConsumptions(tenantID, { transactionId: transaction.id }, { limit: 5, skip: 0, sort: { startedAt: -1 } });
- if (consumptions.result.every((element) => element.instantAmps === 0)) {
+ const consumptions = await ConsumptionStorage.getTransactionConsumptions(
+ tenantID, { transactionId: transaction.id }, { limit: 5, skip: 0, sort: { startedAt: -1 } });
+ if (consumptions.result.every((consumption) => consumption.consumptionWh === 0)) {
// Send Notification
await this.notifyEndOfCharge(tenantID, chargingStation, transaction);
}
+ }
// Optimal Charge? (SoC)
} else if (this.chargingStationConfig.notifBeforeEndOfChargeEnabled &&
transaction.currentStateOfCharge >= this.chargingStationConfig.notifBeforeEndOfChargePercent) {

Adjust notification end of charge