From f0f65a6223ab14e6b7071ba6ec68c87c38de4c8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 25 Apr 2022 23:46:24 +0200 Subject: [PATCH] Ensure heartbeat interval configuration are initialized by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 6 ++++++ src/charging-station/ocpp/1.6/OCPP16ResponseService.ts | 4 ++-- src/types/ocpp/1.6/Configuration.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 8b837bc3..acaaa7df 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1237,6 +1237,12 @@ export default class ChargingStation { } private initializeOcppConfiguration(): void { + if (!this.getConfigurationKey(StandardParametersKey.HeartbeatInterval)) { + this.addConfigurationKey(StandardParametersKey.HeartbeatInterval, '0'); + } + if (!this.getConfigurationKey(StandardParametersKey.HeartBeatInterval)) { + this.addConfigurationKey(StandardParametersKey.HeartBeatInterval, '0', { visible: false }); + } if ( this.getSupervisionUrlOcppConfiguration() && !this.getConfigurationKey(this.getSupervisionUrlOcppKey()) diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index f2a08a16..5a60af63 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -105,13 +105,13 @@ export default class OCPP16ResponseService extends OCPPResponseService { private handleResponseBootNotification(payload: OCPP16BootNotificationResponse): void { if (payload.status === OCPP16RegistrationStatus.ACCEPTED) { this.chargingStation.addConfigurationKey( - OCPP16StandardParametersKey.HeartBeatInterval, + OCPP16StandardParametersKey.HeartbeatInterval, payload.interval.toString(), {}, { overwrite: true, save: true } ); this.chargingStation.addConfigurationKey( - OCPP16StandardParametersKey.HeartbeatInterval, + OCPP16StandardParametersKey.HeartBeatInterval, payload.interval.toString(), { visible: false }, { overwrite: true, save: true } diff --git a/src/types/ocpp/1.6/Configuration.ts b/src/types/ocpp/1.6/Configuration.ts index 8888dd45..55528099 100644 --- a/src/types/ocpp/1.6/Configuration.ts +++ b/src/types/ocpp/1.6/Configuration.ts @@ -15,8 +15,8 @@ export enum OCPP16StandardParametersKey { ClockAlignedDataInterval = 'ClockAlignedDataInterval', ConnectionTimeOut = 'ConnectionTimeOut', GetConfigurationMaxKeys = 'GetConfigurationMaxKeys', - HeartBeatInterval = 'HeartBeatInterval', HeartbeatInterval = 'HeartbeatInterval', + HeartBeatInterval = 'HeartBeatInterval', LightIntensity = 'LightIntensity', LocalAuthorizeOffline = 'LocalAuthorizeOffline', LocalPreAuthorize = 'LocalPreAuthorize', -- 2.34.1