diff --git a/function/rbe/README.md b/function/rbe/README.md index c43946ff..459b2aa6 100644 --- a/function/rbe/README.md +++ b/function/rbe/README.md @@ -4,10 +4,15 @@ node-red-node-rbe A Node-RED node that provides provides report-by-exception (RBE) and deadband capability. +The node blocks unless the incoming value changes - RBE mode, or +changes by more than a certain amount (absolute value or percentage) - deadband +mode. + Install ------- -Run the following command in the root directory of your Node-RED install +Run the following command in your Node-RED install directory, usually +`~/.node-red` npm install node-red-node-rbe @@ -23,7 +28,7 @@ handle multiple topics at the same time. ###RBE mode -Outputs the **msg** if the **msg.payload** is different to the previous one. +The node doesn't send any output until the **msg.payload** is different to the previous one. Works on numbers and strings. Useful for filtering out repeated messages of the same value. Saves bandwidth, etc... diff --git a/function/rbe/icons/rbe.png b/function/rbe/icons/rbe.png new file mode 100644 index 00000000..52aaba97 Binary files /dev/null and b/function/rbe/icons/rbe.png differ diff --git a/function/rbe/locales/en-US/rbe.json b/function/rbe/locales/en-US/rbe.json new file mode 100644 index 00000000..4a714a11 --- /dev/null +++ b/function/rbe/locales/en-US/rbe.json @@ -0,0 +1,18 @@ +{ + "rbe": { + "label": { + "func": "Mode", + "name": "Name" + }, + "placeholder":{ + "bandgap": "e.g. 10 or 5%" + }, + "opts": { + "rbe": "block unless value changes", + "deadband": "block unless changes by more than" + }, + "warn": { + "nonumber": "no number found in payload" + } + } +} diff --git a/function/rbe/package.json b/function/rbe/package.json index e9a86991..ea94fc17 100644 --- a/function/rbe/package.json +++ b/function/rbe/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-rbe", - "version" : "0.0.7", + "version" : "0.1.0", "description" : "A Node-RED node that provides report-by-exception (RBE) and deadband capability.", "dependencies" : { }, diff --git a/function/rbe/rbe.html b/function/rbe/rbe.html index f27cbffd..71e191ad 100644 --- a/function/rbe/rbe.html +++ b/function/rbe/rbe.html @@ -1,5 +1,5 @@
- +
- +
- +
- +

- - + +
-
Note: Copied credentials from global emailkeys.js file.
+
diff --git a/social/irc/91-irc.js b/social/irc/91-irc.js index ffc1bc28..b4a7d63c 100644 --- a/social/irc/91-irc.js +++ b/social/irc/91-irc.js @@ -47,45 +47,45 @@ module.exports = function(RED) { this.channel = n.channel || this.serverConfig.channel; var node = this; if (node.serverConfig.ircclient === null) { - node.log("CONNECT: "+node.serverConfig.server); - node.status({fill:"grey",shape:"dot",text:"connecting"}); + node.log(RED._("irc.errors.connect")+": "+node.serverConfig.server); + node.status({fill:"grey",shape:"dot",text:"node-red:common.status.connecting"}); var options = {autoConnect:true,autoRejoin:false,floodProtection:true,secure:node.serverConfig.ssl,selfSigned:node.serverConfig.cert,port:node.serverConfig.port,retryDelay:20000}; node.serverConfig.ircclient = new irc.Client(node.serverConfig.server, node.serverConfig.nickname, options); node.serverConfig.ircclient.setMaxListeners(0); node.serverConfig.ircclient.addListener('error', function(message) { - if (RED.settings.verbose) { node.log("ERR: "+JSON.stringify(message)); } + if (RED.settings.verbose) { node.log(RED._("irc.errors.err")+": "+JSON.stringify(message)); } }); node.serverConfig.ircclient.addListener('netError', function(message) { node.serverConfig.lastseen = Date.now(); - if (RED.settings.verbose) { node.log("NET: "+JSON.stringify(message)); } - node.status({fill:"red",shape:"ring",text:"net error"}); + if (RED.settings.verbose) { node.log(RED._("irc.errors.net")+": "+JSON.stringify(message)); } + node.status({fill:"red",shape:"ring",text:"node-red:common.status.neterror"}); }); node.serverConfig.ircclient.addListener('connect', function() { node.serverConfig.lastseen = Date.now(); - if (RED.settings.verbose) { node.log("CONNECTED "); } + if (RED.settings.verbose) { node.log(RED._("irc.errors.connected")); } }); node.serverConfig.ircclient.addListener('registered', function(message) { node.serverConfig.lastseen = Date.now(); - node.log(node.serverConfig.ircclient.nick+" ONLINE: "+message.server); - node.status({fill:"yellow",shape:"dot",text:"connected"}); + node.log(node.serverConfig.ircclient.nick+" "+RED._("irc.errors.online")+": "+message.server); + node.status({fill:"yellow",shape:"dot",text:"node-red:common.status.connected"}); node.serverConfig.ircclient.join( node.channel, function(data) { - node.log(data+" JOINED: "+node.channel); - node.status({fill:"green",shape:"dot",text:"joined"}); + node.log(data+" "+RED._("irc.errors.joined")+": "+node.channel); + node.status({fill:"green",shape:"dot",text:"node-red:common.status.joined"}); }); }); node.serverConfig.ircclient.addListener('ping', function(server) { node.serverConfig.lastseen = Date.now(); - if (RED.settings.verbose) { node.log("PING from "+JSON.stringify(server)); } - node.status({fill:"green",shape:"dot",text:"ok"}); + if (RED.settings.verbose) { node.log(RED._("irc.errors.ping")+" "+JSON.stringify(server)); } + node.status({fill:"green",shape:"dot",text:"node-red:common.status.ok"}); }); node.serverConfig.ircclient.addListener('quit', function(nick, reason, channels, message) { node.serverConfig.lastseen = Date.now(); - if (RED.settings.verbose) { node.log("QUIT: "+nick+" "+reason+" "+channels+" "+JSON.stringify(message)); } - node.status({fill:"grey",shape:"ring",text:"quit"}); + if (RED.settings.verbose) { node.log(RED._("irc.errors.quit")+": "+nick+" "+reason+" "+channels+" "+JSON.stringify(message)); } + node.status({fill:"grey",shape:"ring",text:"node-red:common.status.quit"}); //node.serverConfig.ircclient.disconnect( function() { // node.serverConfig.ircclient.connect(); //}); - //if (RED.settings.verbose) { node.log("restart"); } // then retry + //if (RED.settings.verbose) { node.log(RED._("irc.errors.restart")); } // then retry }); node.serverConfig.ircclient.addListener('raw', function (message) { // any message received means we are alive //console.log("RAW:"+JSON.stringify(message)); @@ -102,8 +102,8 @@ module.exports = function(RED) { if ((Date.now()-node.serverConfig.lastseen) > 300000) { // If more than 5 mins //node.serverConfig.ircclient.disconnect(); //node.serverConfig.ircclient.connect(); - node.status({fill:"grey",shape:"ring",text:"no connection"}); - if (RED.settings.verbose) { node.log("CONNECTION LOST ?"); } + node.status({fill:"grey",shape:"ring",text:"node-red:common.status.noconnection"}); + if (RED.settings.verbose) { node.log(RED._("irc.errors.connectionlost")); } } //node.serverConfig.ircclient.send.apply(node.serverConfig.ircclient,["TIME"]); // request time to check link }, 60000); // check every 1 min @@ -113,11 +113,11 @@ module.exports = function(RED) { node.ircclient = node.serverConfig.ircclient; node.ircclient.addListener('registered', function(message) { - //node.log(node.ircclient.nick+" ONLINE"); - node.status({fill:"yellow",shape:"dot",text:"connected"}); + //node.log(node.ircclient.nick+" "+RED._("irc.errors.online")); + node.status({fill:"yellow",shape:"dot",text:"node-red:common.status.connected"}); node.ircclient.join( node.channel, function(data) { - // node.log(data+" JOINED "+node.channel); - node.status({fill:"green",shape:"dot",text:"joined"}); + // node.log(data+" "+RED._("irc.errors.joined")+" "+node.channel); + node.status({fill:"green",shape:"dot",text:"node-red:common.status.joined"}); }); }); node.ircclient.addListener('message', function (from, to, message) { @@ -136,27 +136,27 @@ module.exports = function(RED) { node.ircclient.addListener('join', function(channel, who) { var msg = { "payload": { "type":"join", "who":who, "channel":channel } }; node.send([null,msg]); - //node.log(who+' has joined '+channel); + //node.log(who+' '+RED._("irc.errors.hasjoined")+' '+channel); }); node.ircclient.addListener('invite', function(channel, from, message) { var msg = { "payload": { "type":"invite", "who":from, "channel":channel, "message":message } }; node.send([null,msg]); - //node.log(from+' sent invite to '+channel+': '+message); + //node.log(from+' '+RED._("irc.errors.sentinvite")+' '+channel+': '+message); }); node.ircclient.addListener('part', function(channel, who, reason) { var msg = { "payload": { "type":"part", "who":who, "channel":channel, "reason":reason } }; node.send([null,msg]); - //node.log(who+' has left '+channel+': '+reason); + //node.log(who+' '+RED._("irc.errors.hasleft")+' '+channel+': '+reason); }); node.ircclient.addListener('quit', function(nick, reason, channels, message) { var msg = { "payload": { "type":"quit", "who":nick, "channel":channels, "reason":reason } }; node.send([null,msg]); - //node.log(nick+' has quit '+channels+': '+reason); + //node.log(nick+' '+RED._("irc.errors.hasquit")+' '+channels+': '+reason); }); node.ircclient.addListener('kick', function(channel, who, by, reason) { var msg = { "payload": { "type":"kick", "who":who, "channel":channel, "by":by, "reason":reason } }; node.send([null,msg]); - //node.log(who+' was kicked from '+channel+' by '+by+': '+reason); + //node.log(who+' '+RED._("irc.errors.kickedfrom")+' '+channel+' by '+by+': '+reason); }); node.ircclient.addListener('names', function (channel, nicks) { var msg = { "payload": { "type": "names", "channel": channel, "names": nicks} }; @@ -182,45 +182,45 @@ module.exports = function(RED) { this.channel = n.channel || this.serverConfig.channel; var node = this; if (node.serverConfig.ircclient === null) { - node.log("CONNECT: "+node.serverConfig.server); - node.status({fill:"grey",shape:"dot",text:"connecting"}); + node.log(RED._("irc.errors.connect")+": "+node.serverConfig.server); + node.status({fill:"grey",shape:"dot",text:"node-red:common.status.connecting"}); var options = {autoConnect:true,autoRejoin:false,floodProtection:true,secure:node.serverConfig.ssl,selfSigned:node.serverConfig.cert,port:node.serverConfig.port,retryDelay:20000}; node.serverConfig.ircclient = new irc.Client(node.serverConfig.server, node.serverConfig.nickname, options); node.serverConfig.ircclient.setMaxListeners(0); node.serverConfig.ircclient.addListener('error', function(message) { - if (RED.settings.verbose) { node.log("ERR: "+JSON.stringify(message)); } + if (RED.settings.verbose) { node.log(RED._("irc.errors.err")+": "+JSON.stringify(message)); } }); node.serverConfig.ircclient.addListener('netError', function(message) { node.serverConfig.lastseen = Date.now(); - if (RED.settings.verbose) { node.log("NET: "+JSON.stringify(message)); } - node.status({fill:"red",shape:"ring",text:"net error"}); + if (RED.settings.verbose) { node.log(RED._("irc.errors.net")+": "+JSON.stringify(message)); } + node.status({fill:"red",shape:"ring",text:"node-red:common.status.neterror"}); }); node.serverConfig.ircclient.addListener('connect', function() { node.serverConfig.lastseen = Date.now(); - if (RED.settings.verbose) { node.log("CONNECTED "); } + if (RED.settings.verbose) { node.log(RED._("irc.errors.connected")); } }); node.serverConfig.ircclient.addListener('registered', function(message) { node.serverConfig.lastseen = Date.now(); - node.log(node.serverConfig.ircclient.nick+" ONLINE: "+message.server); - node.status({fill:"yellow",shape:"dot",text:"connected"}); + node.log(node.serverConfig.ircclient.nick+" "+RED._("irc.errors.online")+": "+message.server); + node.status({fill:"yellow",shape:"dot",text:"node-red:common.status.connected"}); node.serverConfig.ircclient.join( node.channel, function(data) { - node.log(data+" JOINED: "+node.channel); - node.status({fill:"green",shape:"dot",text:"joined"}); + node.log(data+" "+RED._("irc.errors.joined")+": "+node.channel); + node.status({fill:"green",shape:"dot",text:"node-red:common.status.joined"}); }); }); node.serverConfig.ircclient.addListener('ping', function(server) { node.serverConfig.lastseen = Date.now(); - if (RED.settings.verbose) { node.log("PING from "+JSON.stringify(server)); } - node.status({fill:"green",shape:"dot",text:"ok"}); + if (RED.settings.verbose) { node.log(RED._("irc.errors.ping")+" "+JSON.stringify(server)); } + node.status({fill:"green",shape:"dot",text:"node-red:common.status.ok"}); }); node.serverConfig.ircclient.addListener('quit', function(nick, reason, channels, message) { node.serverConfig.lastseen = Date.now(); - if (RED.settings.verbose) { node.log("QUIT: "+nick+" "+reason+" "+channels+" "+JSON.stringify(message)); } - node.status({fill:"grey",shape:"ring",text:"quit"}); + if (RED.settings.verbose) { node.log(RED._("irc.errors.quit")+": "+nick+" "+reason+" "+channels+" "+JSON.stringify(message)); } + node.status({fill:"grey",shape:"ring",text:"node-red:common.status.quit"}); //node.serverConfig.ircclient.disconnect( function() { // node.serverConfig.ircclient.connect(); //}); - //if (RED.settings.verbose) { node.log("restart"); } // then retry + //if (RED.settings.verbose) { node.log(RED._("irc.errors.restart")); } // then retry }); node.serverConfig.ircclient.addListener('raw', function (message) { // any message received means we are alive //console.log("RAW:"+JSON.stringify(message)); @@ -237,8 +237,8 @@ module.exports = function(RED) { if ((Date.now()-node.serverConfig.lastseen) > 300000) { // If more than 5 mins //node.serverConfig.ircclient.disconnect(); //node.serverConfig.ircclient.connect(); - node.status({fill:"grey",shape:"ring",text:"no connection"}); - if (RED.settings.verbose) { node.log("CONNECTION LOST ?"); } + node.status({fill:"grey",shape:"ring",text:"node-red:common.status.noconnection"}); + if (RED.settings.verbose) { node.log(RED._("irc.errors.connectionlost")); } } //node.serverConfig.ircclient.send.apply(node.serverConfig.ircclient,["TIME"]); // request time to check link }, 60000); // check every 1 min @@ -249,7 +249,7 @@ module.exports = function(RED) { node.on("input", function(msg) { if (Object.prototype.toString.call( msg.raw ) === '[object Array]') { - if (RED.settings.verbose) { node.log("RAW command:"+msg.raw); } + if (RED.settings.verbose) { node.log(RED._("irc.errors.rawcommand")+":"+msg.raw); } node.ircclient.send.apply(node.ircclient,msg.raw); } else { @@ -259,7 +259,7 @@ module.exports = function(RED) { if ((msg.hasOwnProperty('topic'))&&(typeof msg.topic === "string")) { ch = msg.topic.split(","); // split on , so we can send to multiple } - else { node.warn("msg.topic not set"); } + else { node.warn(RED._("irc.errors.topicnotset")); } } for (var c = 0; c < ch.length; c++) { if (node.sendFlag == "false") { // send whole message object to each channel diff --git a/social/irc/locales/en-US/91-irc.json b/social/irc/locales/en-US/91-irc.json new file mode 100644 index 00000000..233df59f --- /dev/null +++ b/social/irc/locales/en-US/91-irc.json @@ -0,0 +1,39 @@ +{ + "irc": { + "label": { + "ircserver": "IRC Server", + "channel": "Channel", + "action": "Action", + "port": "Port", + "ssl": "Use Secure SSL connection?", + "self": "Allow self-signed certificates?", + "nickname": "Nickname" + }, + "payload": "Send payload to channel(s)", + "topic": "Use msg.topic to set nickname or channel(s)", + "msg": "Send complete msg object to channel(s)", + "tip": { + "in": "The channel to join must start with a #
You may join multiple channels by comma separating a list - #chan1,#chan2,etc.", + "out": "The channel to join must start with a #
Sending the complete object will stringify the whole msg object before sending." + }, + "errors": { + "connect": "CONNECT", + "err": "ERR", + "net": "NET", + "connected": "CONNECTED", + "online": "ONLINE", + "joined": "JOINED", + "ping": "PING from", + "quit": "QUIT", + "restart": "restart", + "connectionlost": "CONNECTION LOST?", + "hasjoined": "has joined", + "sentinvite": "sent invite to", + "hasleft": "has left", + "hasquit": "has quit", + "kickedfrom": "was kicked from", + "rawcommand": "RAW command", + "topicnotset": "msg.topic not set" + } + } +} \ No newline at end of file diff --git a/social/twitter/27-twitter.html b/social/twitter/27-twitter.html index f88420d1..8ebda615 100644 --- a/social/twitter/27-twitter.html +++ b/social/twitter/27-twitter.html @@ -1,5 +1,5 @@