node-red-contrib-deconz
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -136,2 +136,3 @@ var request = require('request'); | ||
node.config = config; | ||
node.cleanTimer = null; | ||
node.server = RED.nodes.getNode(config.server); | ||
@@ -142,32 +143,33 @@ if (typeof(config.device) == 'string' && config.device.length) { | ||
this.on('input', function (message) { | ||
clearTimeout(node.cleanTimer); | ||
node.server.getDeviceMeta(function(deviceMeta){ | ||
if (deviceMeta) { | ||
devices[node.id] = deviceMeta.uniqueid; | ||
node.server.getDeviceMeta(function(deviceMeta){ | ||
if (deviceMeta) { | ||
devices[node.id] = deviceMeta.uniqueid; | ||
node.meta = deviceMeta; | ||
node.meta = deviceMeta; | ||
node.status({ | ||
fill: "green", | ||
shape: "dot", | ||
text: (config.state in node.meta.state)?(node.meta.state[config.state]?node.meta.state[config.state]:''):"received", | ||
}); | ||
node.status({ | ||
fill: "green", | ||
shape: "dot", | ||
text: (config.state in node.meta.state)?(node.meta.state[config.state]?node.meta.state[config.state]:''):"received", | ||
}); | ||
node.send({ | ||
payload:(config.state in node.meta.state)?node.meta.state[config.state]:node.meta.state, | ||
meta:deviceMeta, | ||
}); | ||
node.send({ | ||
payload:(config.state in node.meta.state)?node.meta.state[config.state]:node.meta.state, | ||
meta:deviceMeta, | ||
}); | ||
node.cleanTimer = setTimeout(function(){ | ||
node.status({}); //clean | ||
}, 3000); | ||
} else { | ||
node.status({ | ||
fill: "red", | ||
shape: "dot", | ||
text: 'Device not found' | ||
}); | ||
} | ||
}, config.device); | ||
setTimeout(function(){ | ||
node.status({}); //clean | ||
}, 3000); | ||
} else { | ||
node.status({ | ||
fill: "red", | ||
shape: "dot", | ||
text: 'Device not found' | ||
}); | ||
} | ||
}, config.device); | ||
}); | ||
@@ -174,0 +176,0 @@ } else { |
@@ -33,3 +33,3 @@ { | ||
}, | ||
"version": "0.3.0" | ||
"version": "0.3.1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
522395
2003