homebridge-syntex-magichome
Advanced tools
Comparing version 1.0.0-b53 to 1.0.0-b54
{ | ||
"name": "homebridge-syntex-magichome", | ||
"version": "1.0.0-b53", | ||
"version": "1.0.0-b54", | ||
"description": "Homebridge Plugin for MagicHome LED Strips with preset scenes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,2 +5,4 @@ const cp = require('child_process'); | ||
var logger = null; | ||
const Accessory = class | ||
@@ -10,4 +12,5 @@ { | ||
{ | ||
logger = log; | ||
this.homebridge = homebridge; | ||
this.log = log; | ||
this.config = config; | ||
@@ -44,3 +47,3 @@ this.name = config.name; | ||
{ | ||
self.log(cmd); | ||
logger.debug(cmd); | ||
} | ||
@@ -52,3 +55,3 @@ | ||
{ | ||
self.log(stdOut); | ||
logger.debug(stdOut); | ||
} | ||
@@ -55,0 +58,0 @@ if(callback) |
@@ -66,3 +66,3 @@ const convert = require('color-convert'); | ||
{ | ||
this.log(args); | ||
logger.debug(args); | ||
} | ||
@@ -69,0 +69,0 @@ } |
@@ -19,3 +19,3 @@ const Accessory = require('./base'); | ||
{ | ||
log('Present Not Found... Try Different Preset'); | ||
log.log('warn', 'bridge', 'Bridge', 'Present Not Found... Try Different Preset'); | ||
this.sceneValue = 37; | ||
@@ -22,0 +22,0 @@ } |
@@ -7,2 +7,4 @@ const cp = require('child_process') | ||
var logger = null; | ||
const LightAgent = class { | ||
@@ -14,3 +16,2 @@ | ||
this.pollingInterval = 300 * 1000; | ||
this.logger = null; | ||
this.storage = null; | ||
@@ -29,3 +30,3 @@ this.hasDiscoveryStarted = false; | ||
this.log('Getting Bulbs from Cache'); | ||
logger.debug('Getting Bulbs from Cache'); | ||
@@ -48,4 +49,4 @@ return this.storage.getItem(cacheKey).then((data) => { | ||
this.log(' ** Fetched Lights from Cache **'); | ||
this.logger.debug(devices); | ||
logger.debug(' ** Fetched Lights from Cache **'); | ||
logger.debug(devices); | ||
@@ -62,8 +63,8 @@ return devices; | ||
this.log('Saving Lights'); | ||
this.logger.debug(data); | ||
logger.debug('Saving Lights'); | ||
logger.debug(data); | ||
this.storage.setItem(cacheKey, data).then(() => { | ||
this.log('Lights Saved.'); | ||
logger.debug('Lights Saved.'); | ||
}); | ||
@@ -87,5 +88,5 @@ } | ||
setLogger(logger) | ||
setLogger(log) | ||
{ | ||
this.logger = logger; | ||
logger = log; | ||
} | ||
@@ -117,11 +118,2 @@ | ||
log(message) | ||
{ | ||
if(this.logger && this.isVerbose) | ||
{ | ||
//this.logger(message); | ||
this.logger.log('info', 'bridge', 'Bridge', message); | ||
} | ||
} | ||
parseDevices(res) | ||
@@ -192,3 +184,3 @@ { | ||
self.log('Discovering Devices'); | ||
logger.debug('Discovering Devices'); | ||
@@ -200,3 +192,3 @@ this.proc = spawn(cmd, ['-s']); | ||
self.logger.debug(newData); | ||
logger.debug(newData); | ||
self.cachedAddress = self.parseDevices(newData); | ||
@@ -207,3 +199,3 @@ }); | ||
self.logger.log('error', 'bridge', 'Bridge', 'Error : ' + data) | ||
logger.log('error', 'bridge', 'Bridge', 'Error : ' + data) | ||
}); | ||
@@ -213,3 +205,3 @@ | ||
self.log('Discovery Finished'); | ||
logger.debug('Discovery Finished'); | ||
self.rediscoverLights(); | ||
@@ -223,3 +215,3 @@ }); | ||
this.logger.debug(this.cachedAddress); | ||
logger.debug(this.cachedAddress); | ||
@@ -226,0 +218,0 @@ setTimeout(this.getDevices.bind(this), this.pollingInterval); |
@@ -16,3 +16,2 @@ const LightBulb = require('./accessories/lightBulb'); | ||
{ | ||
this.log = log; | ||
this.config = config; | ||
@@ -168,3 +167,3 @@ this.lights = []; | ||
this.lights.push(new LightBulb(newLightConfig, this.log, homebridge)); | ||
this.lights.push(new LightBulb(newLightConfig, logger, homebridge)); | ||
}); | ||
@@ -177,3 +176,3 @@ } | ||
this.presetSwitches.push(new PresetSwitch(switchConfig, this.log, homebridge)); | ||
this.presetSwitches.push(new PresetSwitch(switchConfig, logger, homebridge)); | ||
}); | ||
@@ -184,3 +183,3 @@ } | ||
{ | ||
this.resetSwitches.push(new ResetSwitch(this.config.resetSwitch, this.log, homebridge)); | ||
this.resetSwitches.push(new ResetSwitch(this.config.resetSwitch, logger, homebridge)); | ||
} | ||
@@ -187,0 +186,0 @@ |
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
108070
1077