iobroker.wifilight
Advanced tools
Comparing version 0.0.14 to 0.0.15
{ | ||
"common": { | ||
"name": "wifilight", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"title": "WiFi Light", | ||
@@ -6,0 +6,0 @@ "desc": { |
{ | ||
"name": "iobroker.wifilight", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "WiFi Light Adapter", | ||
@@ -28,3 +28,4 @@ "author": { | ||
"dependencies": { | ||
"netmask": "^1.0.6" | ||
"netmask": "^1.0.6", | ||
"soef": "^0.1.1" | ||
}, | ||
@@ -31,0 +32,0 @@ "devDependencies": {}, |
"use strict"; | ||
var utils = require(__dirname + '/lib/utils'), | ||
soef = require(__dirname + '/lib/soef'), | ||
devices = new soef.Devices(), | ||
//soef = require(__dirname + '/lib/soef'), | ||
soef = require('soef'), | ||
//devices = new soef.Devices(), | ||
net = require('net'), | ||
@@ -49,8 +50,8 @@ discovery = require(__dirname + '/lib/discovery'), | ||
}, | ||
discover: function (callback) { | ||
}, | ||
install: function (callback) { | ||
}, | ||
uninstall: function (callback) { | ||
}, | ||
//discover: function (callback) { | ||
//}, | ||
//install: function (callback) { | ||
//}, | ||
//uninstall: function (callback) { | ||
//}, | ||
objectChange: function (id, obj) { | ||
@@ -65,14 +66,15 @@ }, | ||
ready: function () { | ||
adapter.getForeignObject('system.adapter.' + adapter.namespace, function(err, obj) { | ||
if (!err && obj && obj.common && obj.common.enabled === false) { | ||
// running in debuger | ||
adapter.log.debug = console.log; | ||
adapter.log.info = console.log; | ||
adapter.log.warn = console.log; | ||
debug = true; | ||
} | ||
devices.init(adapter, function(err) { | ||
main(); | ||
}); | ||
}); | ||
soef.main(adapter, main); | ||
//adapter.getForeignObject('system.adapter.' + adapter.namespace, function(err, obj) { | ||
// if (!err && obj && obj.common && obj.common.enabled === false) { | ||
// // running in debuger | ||
// adapter.log.debug = console.log; | ||
// adapter.log.info = console.log; | ||
// adapter.log.warn = console.log; | ||
// debug = true; | ||
// } | ||
// devices.init(adapter, function(err) { | ||
// main(); | ||
// }); | ||
//}); | ||
//devices.init(adapter, function(err) { | ||
@@ -141,2 +143,12 @@ // main(); | ||
function parseHexColor(val) { | ||
var co = { | ||
r: parseInt(val.substr(1, 2), 16), | ||
g: parseInt(val.substr(3, 2), 16) || 0, | ||
b: parseInt(val.substr(5, 2), 16) || 0, | ||
w: val.length > 7 ? parseInt(val.substr(7, 2), 16) : undefined | ||
}; | ||
return co; | ||
} | ||
function stateChange(id, state) { | ||
@@ -161,8 +173,9 @@ var ar = id.split('.'); | ||
if (typeof state.val == 'string' && state.val[0] == '#') { | ||
var co = { | ||
r: parseInt(state.val.substr(1, 2), 16), | ||
g: parseInt(state.val.substr(3, 2), 16), | ||
b: parseInt(state.val.substr(5, 2), 16), | ||
w: state.val.length > 7 ? parseInt(state.val.substr(7, 2), 16) : undefined | ||
}; | ||
var co = parseHexColors(state.val); | ||
//var co = { | ||
// r: parseInt(state.val.substr(1, 2), 16), | ||
// g: parseInt(state.val.substr(3, 2), 16), | ||
// b: parseInt(state.val.substr(5, 2), 16), | ||
// w: state.val.length > 7 ? parseInt(state.val.substr(7, 2), 16) : undefined | ||
//}; | ||
device.color(channel, co); | ||
@@ -202,5 +215,4 @@ break; | ||
case usedStateNames.command.n: | ||
var v = state.val.replace(/^on$|red|green|blue|transition|bri|off/g, function(match) { return { of:'off:1', on:'on:1', red:'r', green:'g', blue:'b', white: 'w', transition:'x', bri:'l', off:'on:0'}[match] }); | ||
v = v.replace(/\s|\"|;$|,$/g, '').replace(/=/g, ':').replace(/;/g, ',').replace(/true/g, 1).replace(/(r|g|b|w|x|l|sat|of|on|ct)/g, '"$1"').replace(/^\{?(.*?)\}?$/, '{$1}'); | ||
var v = state.val.replace(/^on$|red|green|blue|transition|bri|off|#/g, function(match) { return { '#': '#', of:'off:1', on:'on:1', red:'r', green:'g', blue:'b', white: 'w', transition:'x', bri:'l', off:'on:0'}[match] }); | ||
v = v.replace(/\s|\"|;$|,$/g, '').replace(/=/g, ':').replace(/;/g, ',').replace(/true/g, 1).replace(/#((\d|[a-f]|[A-F])*)/g, 'h:"$1"').replace(/(r|g|b|w|x|l|sat|of|on|ct|h)/g, '"$1"').replace(/^\{?(.*?)\}?$/, '{$1}'); | ||
try { | ||
@@ -212,2 +224,7 @@ var colors = JSON.parse(v); | ||
} | ||
if (colors.h) { | ||
var co = parseHexColor('#'+colors.h); | ||
colors.r = co.r; colors.g = co.g; colors.b = co.b; | ||
delete colors.h; | ||
} | ||
if (!colors || typeof colors !== 'object') return; | ||
@@ -214,0 +231,0 @@ var o = fullExtend(device.getRGBStates(channel), colors); |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
6
60472
2
12
1099
+ Addedsoef@^0.1.1
+ Addedarray-ext@0.1.5(transitive)
+ Addedsoef@0.1.55(transitive)
+ Addedsprintf-js@1.1.3(transitive)