From: Jérôme Benoit Date: Mon, 25 Apr 2022 21:46:24 +0000 (+0200) Subject: Ensure heartbeat interval configuration are initialized by default X-Git-Tag: v1.1.59~21 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f0f65a6223ab14e6b7071ba6ec68c87c38de4c8c;p=e-mobility-charging-stations-simulator.git Ensure heartbeat interval configuration are initialized by default Signed-off-by: Jérôme Benoit --- 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',