Do not execute smart charging when coming from suspendedEVSE
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -692,6 +692,8 @@ export default class OCPPService {
if (!ignoreStatusNotification) {
// Check last Transaction
await this.checkAndUpdateLastCompletedTransactionFromStatusNotification(tenant, chargingStation, statusNotification, connector);
+ // Keep previous connector status for smart charging
+ const previousStatus = connector.status;
// Update Connector
connector.connectorId = statusNotification.connectorId;
connector.status = statusNotification.status;
@@ -713,7 +715,7 @@ export default class OCPPService {
// Save Charging Station
await ChargingStationStorage.saveChargingStation(tenant, chargingStation);
// Process Smart Charging
- await this.processSmartChargingFromStatusNotification(tenant, chargingStation, connector);
+ await this.processSmartChargingFromStatusNotification(tenant, chargingStation, connector, previousStatus);
await Logging.logInfo({
...LoggingHelper.getChargingStationProperties(chargingStation),
tenantID: tenant.id,
@@ -727,9 +729,10 @@ export default class OCPPService {
}
}
- private async processSmartChargingFromStatusNotification(tenant: Tenant, chargingStation: ChargingStation, connector: Connector): Promise<void> {
+ private async processSmartChargingFromStatusNotification(tenant: Tenant, chargingStation: ChargingStation,
+ connector: Connector, previousStatus: ChargePointStatus): Promise<void> {
// Trigger Smart Charging
- if (connector.status === ChargePointStatus.CHARGING ||
+ if ((connector.status === ChargePointStatus.CHARGING && previousStatus !== ChargePointStatus.SUSPENDED_EVSE) ||
connector.status === ChargePointStatus.SUSPENDED_EV) {
try {
// Trigger Smart Charging

Do not execute smart charging when coming from suspendedEVSE (#3659)