Skip to content

Commit

Permalink
fix: scheduled jobs not running when mqtt disabled (#3409)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando authored Nov 6, 2023
1 parent 49ccf97 commit c3d00e6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/Gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand Down Expand Up @@ -2110,7 +2111,6 @@ export default class Gateway {

/**
* Driver status updates
*
*/
private _onDriverStatus(ready: boolean): void {
logger.info(`Driver is ${ready ? 'READY' : 'CLOSED'}`)
Expand All @@ -2125,7 +2125,9 @@ export default class Gateway {
}
}

this._mqtt.publish('driver/status', ready)
if (this.mqttEnabled) {
this._mqtt.publish('driver/status', ready)
}
}

/**
Expand Down

0 comments on commit c3d00e6

Please sign in to comment.