From c3d00e62551e654d2e3ac0aea5e9ba75f7c986ba Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Mon, 6 Nov 2023 09:38:31 +0100 Subject: [PATCH] fix: scheduled jobs not running when mqtt disabled (#3409) --- lib/Gateway.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Gateway.ts b/lib/Gateway.ts index a308ecbfad2..77d9e3e2e5c 100644 --- a/lib/Gateway.ts +++ b/lib/Gateway.ts @@ -280,8 +280,10 @@ export default class Gateway { } if (this._zwave) { - // this is the only event we need to bind to in order to apply gateway values configs like polling + // needed in order to apply gateway values configs like polling this._zwave.on('nodeInited', this._onNodeInited.bind(this)) + // needed to init scheduled jobs + this._zwave.on('driverStatus', this._onDriverStatus.bind(this)) if (this.mqttEnabled) { this._zwave.on('nodeStatus', this._onNodeStatus.bind(this)) @@ -293,7 +295,6 @@ export default class Gateway { this._zwave.on('valueChanged', this._onValueChanged.bind(this)) this._zwave.on('nodeRemoved', this._onNodeRemoved.bind(this)) this._zwave.on('notification', this._onNotification.bind(this)) - this._zwave.on('driverStatus', this._onDriverStatus.bind(this)) if (this.config.sendEvents) { this._zwave.on('event', this._onEvent.bind(this)) @@ -2110,7 +2111,6 @@ export default class Gateway { /** * Driver status updates - * */ private _onDriverStatus(ready: boolean): void { logger.info(`Driver is ${ready ? 'READY' : 'CLOSED'}`) @@ -2125,7 +2125,9 @@ export default class Gateway { } } - this._mqtt.publish('driver/status', ready) + if (this.mqttEnabled) { + this._mqtt.publish('driver/status', ready) + } } /**