Skip to content

Commit

Permalink
fix: start zwavejs server when driver is ready (#605)
Browse files Browse the repository at this point in the history
Fixes #602
  • Loading branch information
robertsLando authored Feb 17, 2021
1 parent b048fcb commit aebd890
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/ZwaveClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ function driverReady () {

this.error = false

// start server only when driver is ready. Fixes #602
if (this.cfg.serverEnabled && this.server) {
this.server.start().catch(err => {
logger.error('Error while starting Zwavejs Server', err)
})
}

logger.info(`Scanning network with homeid: ${homeHex}`)
}

Expand Down Expand Up @@ -1691,7 +1698,6 @@ ZwaveClient.prototype.connect = async function () {
port: this.cfg.serverPort || 3000,
logger: LogManager.module('Zwave-Server')
})
await this.server.start()
}

this.status = ZWAVE_STATUS.connected
Expand Down

0 comments on commit aebd890

Please sign in to comment.