From 03df629e6ac438a6963cf7241ccd767ed1b8530c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 4 Dec 2020 16:09:13 +0100 Subject: [PATCH] Heartbeat interval is expected to be a string. 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/types/ocpp/1.6/RequestResponses.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 9367f653..e7f8166e 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -615,7 +615,7 @@ export default class ChargingStation { await this._startMessageSequence(); } else { do { - await Utils.sleep(this._bootNotificationResponse.interval * 1000); + await Utils.sleep(Utils.convertToInt(this._bootNotificationResponse.interval) * 1000); // Resend BootNotification this._bootNotificationResponse = await this.sendBootNotification(); } while (this._bootNotificationResponse.status !== RegistrationStatus.ACCEPTED); @@ -1122,8 +1122,8 @@ export default class ChargingStation { if (payload.status === RegistrationStatus.ACCEPTED) { this._heartbeatInterval = Utils.convertToInt(payload.interval) * 1000; this._heartbeatSetInterval ? this._restartHeartbeat() : this._startHeartbeat(); - this._addConfigurationKey('HeartBeatInterval', payload.interval.toString()); - this._addConfigurationKey('HeartbeatInterval', payload.interval.toString(), false, false); + this._addConfigurationKey('HeartBeatInterval', payload.interval); + this._addConfigurationKey('HeartbeatInterval', payload.interval, false, false); this._hasStopped && (this._hasStopped = false); } else if (payload.status === RegistrationStatus.PENDING) { logger.info(this._logPrefix() + ' Charging station in pending state on the central server'); diff --git a/src/types/ocpp/1.6/RequestResponses.ts b/src/types/ocpp/1.6/RequestResponses.ts index baf66c15..0a29c134 100644 --- a/src/types/ocpp/1.6/RequestResponses.ts +++ b/src/types/ocpp/1.6/RequestResponses.ts @@ -43,7 +43,7 @@ export enum RegistrationStatus { export interface BootNotificationResponse { status: RegistrationStatus; currentTime: string; - interval: number; + interval: string; } // eslint-disable-next-line @typescript-eslint/no-empty-interface -- 2.34.1