Added Content
This commit is contained in:
21
mqtt-domo-in/miBrightConv.js
Normal file
21
mqtt-domo-in/miBrightConv.js
Normal file
@@ -0,0 +1,21 @@
|
||||
module.exports = function(RED) {
|
||||
function mqttdomoinbright(config) {
|
||||
RED.nodes.createNode(this,config);
|
||||
this.idx = config.idx;
|
||||
this.Savetocontex = config.Savetocontex;
|
||||
var flowContext = this.context().flow;
|
||||
var node = this;
|
||||
node.on('input', function(msg) {
|
||||
msg.payload = msg.payload.Level;
|
||||
node.send(msg);
|
||||
if (node.Savetocontex === true) {
|
||||
if (node.idx === 'undefined' || node.idx === null || node.idx === "" ) {
|
||||
node.warn("IDX not set");
|
||||
} else{
|
||||
flowContext.set(node.idx + "-brightness", msg.payload)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
RED.nodes.registerType("mqtt-domo-in-bright",mqttdomoinbright);
|
||||
}
|
||||
Reference in New Issue
Block a user