Added Content
This commit is contained in:
23
http-domo-out/hoBrightConv.js
Normal file
23
http-domo-out/hoBrightConv.js
Normal file
@@ -0,0 +1,23 @@
|
||||
module.exports = function(RED) {
|
||||
function httpdomooutbright(config) {
|
||||
RED.nodes.createNode(this,config);
|
||||
this.idx = parseInt(config.idx, 10);
|
||||
var node = this;
|
||||
node.on('input', function(msg) {
|
||||
if (node.idx === 'undefined' || isNaN(node.idx) || node.idx === null || node.idx === "" ) {
|
||||
node.error("IDX not set");
|
||||
return;
|
||||
}
|
||||
var newbright = msg.payload;
|
||||
msg.payload = {
|
||||
"idx": node.idx,
|
||||
"level": newbright,
|
||||
"type": "command",
|
||||
"param": "switchlight",
|
||||
"switchcmd": "Set Level"
|
||||
};
|
||||
node.send(msg);
|
||||
});
|
||||
}
|
||||
RED.nodes.registerType("http-domo-out-bright",httpdomooutbright);
|
||||
}
|
||||
Reference in New Issue
Block a user