Added new pingIntervalOCPPJSecs param in conf
MODIFY
docker/config-standalone.json
docker/config-standalone.json
"ChargingStation": {
"heartbeatIntervalOCPPSSecs": 180,
"heartbeatIntervalOCPPJSecs": 3600,
+ "pingIntervalOCPPJSecs": 60,
"checkEndOfChargeNotificationAfterMin": 5,
"notifBeforeEndOfChargePercent": 85,
"notifBeforeEndOfChargeEnabled": true,

MODIFY
docker/config.json
docker/config.json
"ChargingStation": {
"heartbeatIntervalOCPPSSecs": 180,
"heartbeatIntervalOCPPJSecs": 3600,
+ "pingIntervalOCPPJSecs": 60,
"checkEndOfChargeNotificationAfterMin": 5,
"notifBeforeEndOfChargePercent": 85,
"notifBeforeEndOfChargeEnabled": true,

MODIFY
src/assets/config-template-http.json
src/assets/config-template-http.json
"ChargingStation": {
"heartbeatIntervalOCPPSSecs": 60,
"heartbeatIntervalOCPPJSecs": 3600,
+ "pingIntervalOCPPJSecs": 60,
"notifBeforeEndOfChargeEnabled": true,
"notifBeforeEndOfChargePercent": 85,
"notifEndOfChargeEnabled": true,

MODIFY
src/assets/config-template-https.json
src/assets/config-template-https.json
"ChargingStation": {
"heartbeatIntervalOCPPSSecs": 60,
"heartbeatIntervalOCPPJSecs": 3600,
+ "pingIntervalOCPPJSecs": 60,
"notifBeforeEndOfChargeEnabled": true,
"notifBeforeEndOfChargePercent": 85,
"notifEndOfChargeEnabled": true,

MODIFY
src/server/ocpp/json/JsonCentralSystemServer.ts
src/server/ocpp/json/JsonCentralSystemServer.ts
@@ -34,7 +34,7 @@ export default class JsonCentralSystemServer extends CentralSystemServer {
public constructor(centralSystemConfig: CentralSystemConfiguration, chargingStationConfig: ChargingStationConfiguration) {
super(centralSystemConfig, chargingStationConfig);
// Start job to clean WS connections
- this.checkAndCleanupWSConnections();
+ this.checkAndCleanupAllWebSockets();
// Monitor WS activity
this.monitorWSConnections();
}
@@ -537,14 +537,14 @@ export default class JsonCentralSystemServer extends CentralSystemServer {
}, 30 * 60 * 1000);
}
- private checkAndCleanupWSConnections() {
+ private checkAndCleanupAllWebSockets() {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
setInterval(async () => {
// Check Json connections
await this.checkAndCleanupWebSockets(this.jsonWSConnections, 'Json');
// Check Rest connections
await this.checkAndCleanupWebSockets(this.jsonRestWSConnections, 'Rest');
- }, Configuration.getChargingStationConfig().heartbeatIntervalOCPPJSecs * 1000);
+ }, Configuration.getChargingStationConfig().pingIntervalOCPPJSecs * 1000);
}
private async checkAndCleanupWebSockets(wsConnections: Map<string, WSConnection>, type: 'Json'|'Rest') {

MODIFY
src/storage/mongodb/DatabaseUtils.ts
src/storage/mongodb/DatabaseUtils.ts
@@ -427,7 +427,7 @@ export default class DatabaseUtils {
{
$gte: [
{ $divide: [{ $subtract: [new Date(), '$lastSeen'] }, 1000] },
- Configuration.getChargingStationConfig().heartbeatIntervalOCPPJSecs * 2
+ Configuration.getChargingStationConfig().pingIntervalOCPPJSecs * 2
]
}
]

MODIFY
src/types/configuration/ChargingStationConfiguration.ts
src/types/configuration/ChargingStationConfiguration.ts
export default interface ChargingStationConfiguration {
- heartbeatIntervalSecs?: number;
heartbeatIntervalOCPPSSecs: number;
heartbeatIntervalOCPPJSecs: number;
+ pingIntervalOCPPJSecs: number;
checkEndOfChargeNotificationAfterMin: number;
notifBeforeEndOfChargeEnabled: boolean;
notifBeforeEndOfChargePercent: number;

MODIFY
src/utils/Configuration.ts
src/utils/Configuration.ts
@@ -127,27 +127,14 @@ export default class Configuration {
const chargingStationConfiguration: ChargingStationConfiguration = Configuration.getConfig().ChargingStation;
if (!Configuration.isUndefined(chargingStationConfiguration)) {
if (Configuration.isUndefined(chargingStationConfiguration.heartbeatIntervalOCPPSSecs)) {
- if (!Configuration.isUndefined(chargingStationConfiguration.heartbeatIntervalSecs)) {
- chargingStationConfiguration.heartbeatIntervalOCPPSSecs = chargingStationConfiguration.heartbeatIntervalSecs;
- } else {
- chargingStationConfiguration.heartbeatIntervalOCPPSSecs = 180;
- }
+ chargingStationConfiguration.heartbeatIntervalOCPPSSecs = 60;
}
if (Configuration.isUndefined(chargingStationConfiguration.heartbeatIntervalOCPPJSecs)) {
- if (!Configuration.isUndefined(chargingStationConfiguration.heartbeatIntervalSecs)) {
- chargingStationConfiguration.heartbeatIntervalOCPPJSecs = chargingStationConfiguration.heartbeatIntervalSecs;
- } else {
- chargingStationConfiguration.heartbeatIntervalOCPPJSecs = 3600;
- }
- }
- if (Configuration.isUndefined(chargingStationConfiguration.maxLastSeenIntervalSecs)) {
- if (!Configuration.isUndefined(chargingStationConfiguration.heartbeatIntervalSecs)) {
- chargingStationConfiguration.maxLastSeenIntervalSecs = 3 * chargingStationConfiguration.heartbeatIntervalSecs;
- } else {
- chargingStationConfiguration.maxLastSeenIntervalSecs = 540;
+ chargingStationConfiguration.heartbeatIntervalOCPPJSecs = 120;
}
+ if (Configuration.isUndefined(chargingStationConfiguration.pingIntervalOCPPJSecs)) {
+ chargingStationConfiguration.pingIntervalOCPPJSecs = 60;
}
- delete chargingStationConfiguration.heartbeatIntervalSecs;
}
return chargingStationConfiguration;
}

Added new pingIntervalOCPPJSecs param in conf