Heartbeat interval is expected to be a string.
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 4 Dec 2020 15:09:13 +0000 (16:09 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 4 Dec 2020 15:09:13 +0000 (16:09 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts
src/types/ocpp/1.6/RequestResponses.ts

index 9367f6530030d0e3813e5704e68aeaae8063135d..e7f8166e38caa679ee366243974138e57cafe775 100644 (file)
@@ -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');
index baf66c159a390d8ba6c095d643d82d63e618e42f..0a29c134ccc9ae86181d09944ef32571888c1b1f 100644 (file)
@@ -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