iobroker.wifilight
Advanced tools
Comparing version 0.1.1 to 0.1.3
{ | ||
"common": { | ||
"name": "wifilight", | ||
"version": "0.1.1", | ||
"version": "0.1.3", | ||
"news": { | ||
"0.1.3": { | ||
"en": "Normalize devices for devices added by discovery", | ||
"de": "Daten-Normalisierung der von Discovery hinzugefügten Geräte" | ||
}, | ||
"0.1.2": { | ||
"en": "possible exception when deleting unused devices", | ||
"de": "Möglicher Ausnahmefehler beim Löschen unbenutzter Geräte", | ||
} | ||
}, | ||
"title": "WiFi Light", | ||
@@ -6,0 +16,0 @@ "desc": { |
{ | ||
"name": "iobroker.wifilight", | ||
"version": "0.1.1", | ||
"version": "0.1.3", | ||
"description": "WiFi Light Adapter", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -894,3 +894,3 @@ "use strict"; | ||
}); | ||
toDelete.forEachCallback(function(id, next) { | ||
toDelete.forEachCallback(function(next, id) { | ||
dcs.del(id, next); | ||
@@ -904,15 +904,30 @@ }, | ||
function normalizeConfigDevice(dev) { | ||
dev.pollIntervall = parseInt(dev.pollIntervall) | 0; | ||
if (dev.pollIntervall && dev.pollIntervall < 5) dev.pollIntervall = 5; | ||
dev.port = parseInt(dev.port) || 5577; | ||
function normalizeConfig (config) { | ||
var changed = false; | ||
config.devices.forEach(function (d, i) { | ||
var old = Object.assign({}, d); | ||
var dev = cmds.knownDeviceNames[d.name]; | ||
d.pollIntervall = parseInt(dev.pollIntervall) | 0; | ||
if (d.pollIntervall && d.pollIntervall < 5) d.pollIntervall = 5; | ||
d.port = parseInt(d.port) || 5577; | ||
if (d.type === undefined) d.type = dev ? dev.type : ''; | ||
if (d.port === undefined) d.port = dev && dev.port ? dev.port : 5577; | ||
if (d.pollIntervall === undefined) d.pollIntervall = 30; | ||
Object.keys(d).forEach(function(key) { | ||
changed = changed || d[key] !== old[key]; | ||
}); | ||
}); | ||
if (changed) { | ||
soef.changeAdapterConfig (adapter, function(conf) { | ||
conf.devices = config.devices; | ||
}); | ||
} | ||
} | ||
//var capn = require(__dirname + '/capn'); | ||
function main() { | ||
//var ln = capn.line; | ||
if (!adapter.config.devices) return; | ||
@@ -922,5 +937,4 @@ checkDeletedDevices(function(err) { | ||
}); | ||
normalizeConfig(adapter.config); | ||
for (var i=0; i<adapter.config.devices.length; i++) { | ||
normalizeConfigDevice(adapter.config.devices[i]); | ||
if (adapter.config.devices[i].type === 'MiLight') { | ||
@@ -927,0 +941,0 @@ for (var zone=0; zone<=4; zone++) { |
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
76717
1432