Skip to content

Commit

Permalink
fix: workaround for lifx's client that binds to UPD socket on init me…
Browse files Browse the repository at this point in the history
…thod
  • Loading branch information
hfreire committed Dec 9, 2018
1 parent fc9cc76 commit c433bd5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/clicks/lights/lifx-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ class LifxWrapper extends EventEmitter {

this._client = new Client()

this._client.init(_.get(this._options, 'lifx'))

this._client.on('light-new', (light) => this.emit('LightDiscovered', light))
this._client.on('light-online', (light) => this.emit('LightOnline', light))
this._client.on('light-offline', (light) => this.emit('LightOffline', light))

Health.addCheck('lifx', async () => {
if (!this._client) {
throw new Error('Unable to connect to lifx lights')
Expand All @@ -43,6 +37,12 @@ class LifxWrapper extends EventEmitter {
}

start () {
this._client.init(_.get(this._options, 'lifx'))

this._client.on('light-new', (light) => this.emit('LightDiscovered', light))
this._client.on('light-online', (light) => this.emit('LightOnline', light))
this._client.on('light-offline', (light) => this.emit('LightOffline', light))

this._client.startDiscovery()
}

Expand Down

0 comments on commit c433bd5

Please sign in to comment.