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); }