homebridge-syntex-dynamic-platform
Advanced tools
Comparing version 1.0.0-b9 to 1.0.0
@@ -1,3 +0,1 @@ | ||
let logger; | ||
module.exports = class BaseService | ||
@@ -20,3 +18,3 @@ { | ||
logger = manager.logger; | ||
this.logger = manager.logger; | ||
@@ -27,3 +25,3 @@ var service = homebridgeAccessory.getServiceById(serviceType, serviceConfig.subtype); | ||
{ | ||
logger.debug('Existierenden Service gefunden! ' + serviceConfig.name + ' ' + serviceConfig.type + ' ' + serviceConfig.subtype + ' ( ' + this.id + ' )'); | ||
this.logger.debug('Existierenden Service gefunden! ' + serviceConfig.name + ' ' + serviceConfig.type + ' ' + serviceConfig.subtype + ' ( ' + this.id + ' )'); | ||
@@ -34,3 +32,3 @@ service.setCharacteristic(manager.platform.api.hap.Characteristic.Name, serviceConfig.name); | ||
{ | ||
logger.debug('Erstelle neuen Service! ' + serviceConfig.name + ' ' + serviceConfig.type + ' ' + serviceConfig.subtype + ' ( ' + this.id + ' )'); | ||
this.logger.debug('Erstelle neuen Service! ' + serviceConfig.name + ' ' + serviceConfig.type + ' ' + serviceConfig.subtype + ' ( ' + this.id + ' )'); | ||
@@ -41,3 +39,3 @@ homebridgeAccessory.addService(serviceType, serviceConfig.name, serviceConfig.subtype) | ||
getValue(key) | ||
getValue(key, verbose) | ||
{ | ||
@@ -56,7 +54,10 @@ var value = null; | ||
logger.log('read', this.id, this.letters, 'HomeKit Status für [' + this.name + '] ist [' + JSON.stringify(value) + '] ( ' + this.id + ' )'); | ||
if(verbose) | ||
{ | ||
this.logger.log('read', this.id, this.letters, 'HomeKit Status für [' + this.name + '] ist [' + JSON.stringify(value) + '] ( ' + this.id + ' )'); | ||
} | ||
} | ||
else | ||
{ | ||
logger.log('warn', this.id, this.letters, '[' + this.name + '] wurde nicht im Cache gefunden! ( ' + this.id + ' )'); | ||
this.logger.log('warn', this.id, this.letters, '[' + this.name + '] wurde nicht im Cache gefunden! ( ' + this.id + ' )'); | ||
} | ||
@@ -67,3 +68,3 @@ | ||
setValue(key, value) | ||
setValue(key, value, verbose) | ||
{ | ||
@@ -84,3 +85,6 @@ if(this.homebridgeAccessory && this.homebridgeAccessory.context) | ||
logger.log('update', this.id, this.letters, 'HomeKit Status für [' + this.name + '] geändert zu [' + JSON.stringify(value) + '] ( ' + this.id + ' )'); | ||
if(verbose) | ||
{ | ||
this.logger.log('update', this.id, this.letters, 'HomeKit Status für [' + this.name + '] geändert zu [' + JSON.stringify(value) + '] ( ' + this.id + ' )'); | ||
} | ||
@@ -91,3 +95,3 @@ return true; | ||
{ | ||
logger.log('error', this.id, this.letters, '[' + this.name + '] konnte nicht im Cache gespeichert werden! ( ' + this.id + ' )'); | ||
this.logger.log('error', this.id, this.letters, '[' + this.name + '] konnte nicht im Cache gespeichert werden! ( ' + this.id + ' )'); | ||
@@ -111,3 +115,3 @@ return false; | ||
{ | ||
logger.log('warn', this.id, this.letters, '[' + this.name + '] wurde nicht im Cache gefunden! ( ' + this.id + ' )'); | ||
this.logger.log('warn', this.id, this.letters, '[' + this.name + '] wurde nicht im Cache gefunden! ( ' + this.id + ' )'); | ||
} | ||
@@ -114,0 +118,0 @@ |
@@ -52,10 +52,10 @@ const DimmedBulbService = require('./dimmedBulb'); | ||
getHue(callback) | ||
getHue(callback, verbose) | ||
{ | ||
callback(null, super.getValue('hue') || 0); | ||
callback(super.getValue('hue', verbose)); | ||
} | ||
setHue(level, callback) | ||
setHue(level, callback, verbose) | ||
{ | ||
super.setValue('hue', level); | ||
super.setValue('hue', level, verbose); | ||
@@ -65,10 +65,10 @@ callback(); | ||
getSaturation(callback) | ||
getSaturation(callback, verbose) | ||
{ | ||
callback(null, super.getValue('saturation') || 100); | ||
callback(super.getValue('saturation', verbose)); | ||
} | ||
setSaturation(level, callback) | ||
setSaturation(level, callback, verbose) | ||
{ | ||
super.setValue('saturation', level); | ||
super.setValue('saturation', level, verbose); | ||
@@ -75,0 +75,0 @@ callback(); |
@@ -24,6 +24,6 @@ const BaseService = require('./base'); | ||
getState(callback) | ||
getState(callback, verbose) | ||
{ | ||
callback(null, super.getValue('state') || false); | ||
callback(super.getValue('state', verbose)); | ||
} | ||
} |
@@ -49,10 +49,10 @@ const LightBulbService = require('./lightBulb'); | ||
getBrightness(callback) | ||
getBrightness(callback, verbose) | ||
{ | ||
callback(null, super.getValue('brightness') || 100); | ||
callback(super.getValue('brightness', verbose)); | ||
} | ||
setBrightness(level, callback) | ||
setBrightness(level, callback, verbose) | ||
{ | ||
super.setValue('brightness', level); | ||
super.setValue('brightness', level, verbose); | ||
@@ -59,0 +59,0 @@ callback(); |
@@ -29,10 +29,10 @@ const BaseService = require('./base'); | ||
getState(callback) | ||
getState(callback, verbose) | ||
{ | ||
callback(null, super.getValue('state') || false); | ||
callback(super.getValue('state', verbose)); | ||
} | ||
setState(level, callback) | ||
setState(level, callback, verbose) | ||
{ | ||
super.setValue('state', level); | ||
super.setValue('state', level, verbose); | ||
@@ -39,0 +39,0 @@ callback(); |
@@ -12,4 +12,4 @@ const BaseService = require('./base'); | ||
super(homebridgeAccessory, deviceConfig, serviceConfig, Service.Outlet, manager); | ||
super(homebridgeAccessory, deviceConfig, serviceConfig, Service.Outlet, manager); | ||
homebridgeAccessory.getServiceById(Service.Outlet, serviceConfig.subtype).getCharacteristic(Characteristic.On).on('get', this.getState.bind(this)).on('set', this.setState.bind(this)); | ||
@@ -24,11 +24,11 @@ | ||
} | ||
getState(callback) | ||
getState(callback, verbose) | ||
{ | ||
callback(null, super.getValue('state') || false); | ||
callback(super.getValue('state', verbose)); | ||
} | ||
setState(level, callback) | ||
setState(level, callback, verbose) | ||
{ | ||
super.setValue('state', level); | ||
super.setValue('state', level, verbose); | ||
@@ -35,0 +35,0 @@ callback(); |
@@ -24,10 +24,10 @@ const BaseService = require('./base'); | ||
getState(callback) | ||
getState(callback, verbose) | ||
{ | ||
callback(null, super.getValue('state') || false); | ||
callback(super.getValue('state', verbose)); | ||
} | ||
setState(level, callback) | ||
setState(level, callback, verbose) | ||
{ | ||
super.setValue('state', level); | ||
super.setValue('state', level, verbose); | ||
@@ -34,0 +34,0 @@ callback(); |
@@ -95,3 +95,3 @@ const AccessoryInformationService = require('./info'); | ||
{ | ||
var service = new AccessoryInformationService(this.homebridgeAccessory, this.deviceConfig, { manufacturer : this.manufacturer, model : this.model, version : this.version }, this.manager); | ||
var service = new AccessoryInformationService(this.homebridgeAccessory, this.deviceConfig, { manufacturer : this.getManufacturer(), model : this.getModel(), version : this.getVersion() }, this.manager); | ||
@@ -157,2 +157,22 @@ this.service.push(service); | ||
} | ||
getID() | ||
{ | ||
return this.id; | ||
} | ||
getManufacturer() | ||
{ | ||
return this.manufacturer | ||
} | ||
getModel() | ||
{ | ||
return this.model; | ||
} | ||
getVersion() | ||
{ | ||
return this.version; | ||
} | ||
} |
@@ -6,3 +6,3 @@ const store = require('json-fs-store'); | ||
{ | ||
constructor(pluginName, logDirectory, configDirectory) | ||
constructor(pluginName, logDirectory, debug) | ||
{ | ||
@@ -13,7 +13,12 @@ prefix = pluginName; | ||
logger = this; | ||
if(debug) | ||
{ | ||
debugLevel = 'debug'; | ||
} | ||
} | ||
log(level, mac, letters, message) | ||
log(level, id, letters, message) | ||
{ | ||
var levels = ['success', 'update', 'read', 'info', 'warn', 'error', 'debug']; | ||
var levels = ['debug', 'success', 'update', 'read', 'info', 'warn', 'error']; | ||
@@ -60,3 +65,3 @@ if(levels.indexOf(level) >= levels.indexOf(debugLevel)) | ||
saveLog(level[0].toUpperCase() + level.substring(1), mac, letters, Math.round(new Date().getTime() / 1000), message); | ||
saveLog(level[0].toUpperCase() + level.substring(1), id, letters, Math.round(new Date().getTime() / 1000), message); | ||
} | ||
@@ -126,5 +131,5 @@ } | ||
function saveLog(level, mac, letters, time, message) | ||
function saveLog(level, id, letters, time, message) | ||
{ | ||
var queOBJ = { mac : mac, letters : letters, time : time, level : level, message : message }; | ||
var queOBJ = { id : id, letters : letters, time : time, level : level, message : message }; | ||
@@ -153,13 +158,13 @@ if(inWork) | ||
if(!device[mac]) | ||
if(!device[id]) | ||
{ | ||
device[mac] = {}; | ||
device[id] = {}; | ||
} | ||
if(!device[mac][letters]) | ||
if(!device[id][letters]) | ||
{ | ||
device[mac][letters] = []; | ||
device[id][letters] = []; | ||
} | ||
device[mac][letters][device[mac][letters].length] = { t : time, l : level, m : message }; | ||
device[id][letters][device[id][letters].length] = { t : time, l : level, m : message }; | ||
@@ -177,3 +182,3 @@ logs.add(device, (err) => { | ||
{ | ||
saveLog(que[0].level, que[0].mac, que[0].letters, que[0].time, que[0].message); | ||
saveLog(que[0].level, que[0].id, que[0].letters, que[0].time, que[0].message); | ||
} | ||
@@ -186,5 +191,5 @@ }); | ||
entry[mac] = {}; | ||
entry[id] = {}; | ||
entry[mac][letters] = [ { t : time, l : level, m : message } ]; | ||
entry[id][letters] = [ { t : time, l : level, m : message } ]; | ||
@@ -202,3 +207,3 @@ logs.add(entry, (err) => { | ||
{ | ||
saveLog(que[0].level, que[0].mac, que[0].letters, que[0].time, que[0].message); | ||
saveLog(que[0].level, que[0].id, que[0].letters, que[0].time, que[0].message); | ||
} | ||
@@ -205,0 +210,0 @@ }); |
{ | ||
"name": "homebridge-syntex-dynamic-platform", | ||
"version": "1.0.0-b9", | ||
"version": "1.0.0", | ||
"description": "A Dynamic Platform Accessory", | ||
"main": "platform.js", | ||
"main": "main.js", | ||
"author": "SynTexDZN", | ||
@@ -7,0 +7,0 @@ "engines": { |
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
39288
985
1
1
14