homebridge-misfit-bolt
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -17,2 +17,3 @@ var debug = require('debug')(require('../package').name); | ||
this.log = log; | ||
this.timeout = config.timeout || 5000; | ||
this.disconnectTimeout = config.disconnectTimeout || 10000; | ||
@@ -22,14 +23,3 @@ } | ||
MisfitBoltAccessory.prototype.initialize = function (callback) { | ||
var bolt = this.bolt, | ||
that = this; | ||
bolt.connect(function(error) { | ||
bolt.getRGBA(function(error, rgba) { | ||
debug('Initial RGBA:', rgba); | ||
that.color = new Color(`rgba(${rgba})`); | ||
that.brightness = rgba.pop(); | ||
that.disconnect(); | ||
callback(); | ||
}); | ||
}); | ||
this.getRGBA(callback); | ||
}; | ||
@@ -102,7 +92,19 @@ | ||
var that = this, | ||
bolt = this.bolt; | ||
bolt = this.bolt, | ||
timedout = false, | ||
timer = setTimeout(function() { | ||
timedout = true; | ||
debug('timed out'); | ||
callback(); | ||
}, this.timeout); | ||
debug('will get'); | ||
bolt.connect(function() { | ||
bolt[method](function(error, value) { | ||
that.disconnect(); | ||
callback(value); | ||
clearTimeout(timer); | ||
if (!timedout) { | ||
debug('got value:', value); | ||
callback(value); | ||
} | ||
}); | ||
@@ -109,0 +111,0 @@ }); |
{ | ||
"name": "homebridge-misfit-bolt", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Misfit Bolt plugin for homebridge", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10133
217