From 7a39c6f70be58ae03c44cd4b4c25f04dff3e6f86 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 16 Nov 2016 22:48:41 +0000 Subject: [PATCH 001/142] reduce Mongo db connection retry warnings only report on first attempt to close issue 1052 on main project --- storage/mongodb/66-mongodb.js | 11 ++++++++--- storage/mongodb/package.json | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/storage/mongodb/66-mongodb.js b/storage/mongodb/66-mongodb.js index 447ae2db..3b43436e 100644 --- a/storage/mongodb/66-mongodb.js +++ b/storage/mongodb/66-mongodb.js @@ -35,7 +35,6 @@ module.exports = function(RED) { return selector; } - function MongoOutNode(n) { RED.nodes.createNode(this,n); this.collection = n.collection; @@ -47,16 +46,19 @@ module.exports = function(RED) { this.mongoConfig = RED.nodes.getNode(this.mongodb); this.status({fill:"grey",shape:"ring",text:RED._("mongodbstatus.connecting")}); var node = this; + var noerror = true; var connectToDB = function() { MongoClient.connect(node.mongoConfig.url, function(err, db) { if (err) { node.status({fill:"red",shape:"ring",text:RED._("mongodb.status.error")}); - node.error(err); + if (noerror) { node.error(err); } + noerror = false; node.tout = setTimeout(connectToDB, 10000); } else { node.status({fill:"green",shape:"dot",text:RED._("mongodb.status.connected")}); node.clientDb = db; + noerror = true; var coll; if (node.collection) { coll = db.collection(node.collection); @@ -162,16 +164,19 @@ module.exports = function(RED) { this.mongoConfig = RED.nodes.getNode(this.mongodb); this.status({fill:"grey",shape:"ring",text:RED._("mongodb.status.connecting")}); var node = this; + var noerror = true; var connectToDB = function() { MongoClient.connect(node.mongoConfig.url, function(err,db) { if (err) { node.status({fill:"red",shape:"ring",text:RED._("mongodb.status.error")}); - node.error(err); + if (noerror) { node.error(err); } + noerror = false; node.tout = setTimeout(connectToDB, 10000); } else { node.status({fill:"green",shape:"dot",text:RED._("mongodb.status.connected")}); node.clientDb = db; + noerror = true; var coll; if (node.collection) { coll = db.collection(node.collection); diff --git a/storage/mongodb/package.json b/storage/mongodb/package.json index ae04681e..5cc424cb 100644 --- a/storage/mongodb/package.json +++ b/storage/mongodb/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-mongodb", - "version" : "0.0.10", + "version" : "0.0.11", "description" : "Node-RED nodes to talk to an Mongo database", "dependencies" : { "mongodb" : "^2.2.11" From c86fdc839acab5ba8ce8f91fa367eb6663d49af8 Mon Sep 17 00:00:00 2001 From: GadgetUK Date: Sat, 26 Nov 2016 21:17:20 +0000 Subject: [PATCH 002/142] Update 100-heatmiser.js (#255) Change to underlying nodejs module for addressing Neo and Wifi units --- hardware/heatmiser/100-heatmiser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/heatmiser/100-heatmiser.js b/hardware/heatmiser/100-heatmiser.js index 10ed72b7..e9f311fe 100644 --- a/hardware/heatmiser/100-heatmiser.js +++ b/hardware/heatmiser/100-heatmiser.js @@ -13,7 +13,7 @@ module.exports = function(RED) { this.pollIntervalRef = undefined; var hmoutnode = this; - this.hm = new Heatmiser(this.ip, this.pin); + this.hm = new Heatmiser.Wifi(this.ip, this.pin); this.hm.on('success', function(data) { if (DEBUG) { @@ -84,7 +84,7 @@ module.exports = function(RED) { var hminnode = this; this.pollIntervalRef = undefined; - this.hm = new Heatmiser(this.ip, this.pin); + this.hm = new Heatmiser.Wifi(this.ip, this.pin); this.hm.on('success', function(data) { if (DEBUG) { From fcc1fcfca85d27e077d6c1b4b6a6f3ee8bb1f58a Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sat, 26 Nov 2016 21:22:18 +0000 Subject: [PATCH 003/142] bump package versions (heatmiser, arduino, pushover) --- hardware/Arduino/README.md | 2 +- hardware/Arduino/package.json | 2 +- hardware/heatmiser/package.json | 4 ++-- social/pushover/57-pushover.html | 1 - social/pushover/package.json | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hardware/Arduino/README.md b/hardware/Arduino/README.md index 2438d138..9bce8882 100644 --- a/hardware/Arduino/README.md +++ b/hardware/Arduino/README.md @@ -9,7 +9,7 @@ Install Run the following command in your Node-RED user directory - typically `~/.node-red` - npm i node-red-node-arduino + npm i --unsafe-perm node-red-node-arduino Usage ----- diff --git a/hardware/Arduino/package.json b/hardware/Arduino/package.json index 89cf432b..bad149d9 100644 --- a/hardware/Arduino/package.json +++ b/hardware/Arduino/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-arduino", - "version" : "0.0.11", + "version" : "0.0.12", "description" : "A Node-RED node to talk to an Arduino running firmata", "dependencies" : { "firmata" : "~0.14.1" diff --git a/hardware/heatmiser/package.json b/hardware/heatmiser/package.json index b4d03f8f..c4b0830d 100644 --- a/hardware/heatmiser/package.json +++ b/hardware/heatmiser/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-contrib-heatmiser", - "version" : "0.0.4", + "version" : "0.0.5", "description" : "A Node-RED node to control and poll a HeatMiser thermostat.", "dependencies" : { - "heatmiser" : "2.0.0" + "heatmiser" : "~2.0.0" }, "repository" : { "type":"git", diff --git a/social/pushover/57-pushover.html b/social/pushover/57-pushover.html index 53fef754..45fd524b 100644 --- a/social/pushover/57-pushover.html +++ b/social/pushover/57-pushover.html @@ -72,7 +72,6 @@

Optionally uses msg.topic to set the title, msg.device to set the device, msg.priority to set the priority, msg.url to add a web address and msg.url_title to add a url title if not already set in the properties.

-

The User-key and API-token are stored in a separate credentials file.

Uses Pushover. See this link for more details.

diff --git a/social/pushover/package.json b/social/pushover/package.json index 41a551d5..abd8c230 100644 --- a/social/pushover/package.json +++ b/social/pushover/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pushover", - "version" : "0.0.10", + "version" : "0.0.11", "description" : "A Node-RED node to send alerts via Pushover", "dependencies" : { "pushover-notifications" : "~0.2.3" From 738eada16bc741f25287fa435c0367eb537119c4 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 27 Nov 2016 17:03:03 +0000 Subject: [PATCH 004/142] Update Mysql Node status reporting --- storage/mysql/68-mysql.js | 19 +++++++++++++++++-- storage/mysql/package.json | 4 ++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/storage/mysql/68-mysql.js b/storage/mysql/68-mysql.js index 9dcde8bb..b8fc46eb 100644 --- a/storage/mysql/68-mysql.js +++ b/storage/mysql/68-mysql.js @@ -14,10 +14,12 @@ module.exports = function(RED) { this.connecting = false; this.dbname = n.db; + this.setMaxListeners(0); var node = this; function doConnect() { node.connecting = true; + node.emit("state","connecting"); node.connection = mysqldb.createConnection({ host : node.host, port : node.port, @@ -33,14 +35,17 @@ module.exports = function(RED) { node.connecting = false; if (err) { node.error(err); + node.emit("state",err.code); node.tick = setTimeout(doConnect, reconnect); } else { node.connected = true; + node.emit("state","connected"); } }); node.connection.on('error', function(err) { node.connected = false; + node.emit("state",err.code); if (err.code === 'PROTOCOL_CONNECTION_LOST') { doConnect(); // silently reconnect... } else { @@ -59,6 +64,7 @@ module.exports = function(RED) { this.on('close', function (done) { if (this.tick) { clearTimeout(this.tick); } node.connected = false; + node.emit("state"," "); if (this.connection) { node.connection.end(function(err) { if (err) { node.error(err); } @@ -85,9 +91,18 @@ module.exports = function(RED) { if (this.mydbConfig) { this.mydbConfig.connect(); var node = this; + node.mydbConfig.on("state", function(info) { + if (info === "connecting") { node.status({fill:"grey",shape:"ring",text:info}); } + else if (info === "connected") { node.status({fill:"green",shape:"dot",text:info}); } + else { + if (info === "ECONNREFUSED") { info = "connection refused"; } + if (info === "PROTOCOL_CONNECTION_LOST") { info = "connection lost"; } + node.status({fill:"red",shape:"ring",text:info}); + } + }); + node.on("input", function(msg) { if (node.mydbConfig.connected) { - node.status({fill:"green",shape:"dot",text:"connected"}); if (typeof msg.topic === 'string') { //console.log("query:",msg.topic); var bind = Array.isArray(msg.payload) ? msg.payload : []; @@ -109,7 +124,7 @@ module.exports = function(RED) { } else { node.error("Database not connected",msg); - node.status({fill:"grey",shape:"ring",text:"Not connected"}); + node.status({fill:"red",shape:"ring",text:"not yet connected"}); } }); } diff --git a/storage/mysql/package.json b/storage/mysql/package.json index da93005e..1dcc88df 100644 --- a/storage/mysql/package.json +++ b/storage/mysql/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-mysql", - "version" : "0.0.11", + "version" : "0.0.12", "description" : "A Node-RED node to read and write to a MySQL database", "dependencies" : { - "mysql" : "2.11.1" + "mysql" : "^2.12.0" }, "repository" : { "type":"git", From fe1a96d67d27ea36b0c9cdf1a671761a09404b7e Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 27 Nov 2016 19:21:57 +0000 Subject: [PATCH 005/142] tidy up mysql some more remove listeners on close and update status on partial deploy --- storage/mysql/68-mysql.js | 11 ++++++++--- storage/mysql/package.json | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/storage/mysql/68-mysql.js b/storage/mysql/68-mysql.js index b8fc46eb..c2e85422 100644 --- a/storage/mysql/68-mysql.js +++ b/storage/mysql/68-mysql.js @@ -56,9 +56,9 @@ module.exports = function(RED) { } this.connect = function() { - if (!this.connected && !this.connecting) { - doConnect(); - } + if (!this.connected && !this.connecting) { doConnect(); } + if (this.connected) { node.emit("state","connected"); } + else { node.emit("state","connecting"); } } this.on('close', function (done) { @@ -127,6 +127,11 @@ module.exports = function(RED) { node.status({fill:"red",shape:"ring",text:"not yet connected"}); } }); + + node.on('close', function () { + node.mydbConfig.removeAllListeners(); + node.status({}); + }); } else { this.error("MySQL database not configured"); diff --git a/storage/mysql/package.json b/storage/mysql/package.json index 1dcc88df..75916816 100644 --- a/storage/mysql/package.json +++ b/storage/mysql/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-mysql", - "version" : "0.0.12", + "version" : "0.0.13", "description" : "A Node-RED node to read and write to a MySQL database", "dependencies" : { "mysql" : "^2.12.0" From 92520f7d576e058a7273b07dddffe083911765e9 Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Sat, 3 Dec 2016 11:26:16 +0000 Subject: [PATCH 006/142] Reduce resubscription time (#256) Halve the resubscrciption timeout to make sure event subscriptions get renewed --- hardware/wemo/WeMoNG.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/wemo/WeMoNG.js b/hardware/wemo/WeMoNG.js index c43e08b6..1174b185 100644 --- a/hardware/wemo/WeMoNG.js +++ b/hardware/wemo/WeMoNG.js @@ -69,7 +69,7 @@ module.exports = function(RED) { }; - setInterval(resubscribe, 200000); + setInterval(resubscribe, 100000); var subscribe = function(node) { var dev = node.dev; From 66d4991b5b2d2e201eed149809537d0efe4281a8 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sat, 3 Dec 2016 11:28:11 +0000 Subject: [PATCH 007/142] bump demo package ver for npm --- hardware/wemo/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/wemo/package.json b/hardware/wemo/package.json index 53fb50c5..f6632636 100644 --- a/hardware/wemo/package.json +++ b/hardware/wemo/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-wemo", - "version": "0.1.9", + "version": "0.1.10", "description": "Input and Output nodes for Belkin WeMo devices", "repository": "https://github.com/node-red/node-red-nodes/tree/master/hardware", "main": "WeMoNG.js", From d4e0e9b302136db85457a09c97bfffcc4bf469c9 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sat, 10 Dec 2016 09:49:13 +0000 Subject: [PATCH 008/142] Update CONTRIBUTING.md --- CONTRIBUTING.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cec0e825..9ff88e35 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,19 +40,12 @@ the [mailing list](https://groups.google.com/forum/#!forum/node-red) first. ### Contributor License Agreement -In order for us to accept pull-requests, the contributor must first complete -a Contributor License Agreement (CLA). This clarifies the intellectual -property license granted with any contribution. It is for your protection as a -Contributor as well as the protection of IBM and its customers; it does not -change your rights to use your own Contributions for any other purpose. +All contributors need to sign the JS Foundation's Contributor License Agreement. +It is an online process and quick to do. You can read the details of the agreement +here: https://cla.js.foundation/node-red/node-red. -You can download the CLAs here: - - - [individual](http://nodered.org/cla/node-red-cla-individual.pdf) - - [corporate](http://nodered.org/cla/node-red-cla-corporate.pdf) - -If you are an IBMer, please contact us directly as the contribution process is -slightly different. +If you raise a pull-request without having signed the CLA, you will be prompted +to do so automatically. ### Coding standards From 0d0df5cef9c88d2569cb3f5e060e46604bf1082a Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 12 Dec 2016 21:10:36 +0000 Subject: [PATCH 009/142] Add to, cc and bcc fields to incoming msg To close #258 and to fix #260 --- social/email/61-email.html | 2 +- social/email/61-email.js | 28 +++++++++++++--------------- social/email/package.json | 6 +++--- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/social/email/61-email.html b/social/email/61-email.html index f62ff0c3..960d22ab 100644 --- a/social/email/61-email.html +++ b/social/email/61-email.html @@ -147,7 +147,7 @@ diff --git a/social/email/61-email.js b/social/email/61-email.js index c1509918..b0bd91b5 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -183,17 +183,13 @@ module.exports = function(RED) { msg.payload = mailMessage.text; msg.topic = mailMessage.subject; msg.date = mailMessage.date; - if (mailMessage.html) { - msg.html = mailMessage.html; - } - if (mailMessage.from && mailMessage.from.length > 0) { - msg.from = mailMessage.from[0].address; - } - if (mailMessage.attachments) { - msg.attachments = mailMessage.attachments; - } else { - msg.attachments = []; - } + if (mailMessage.html) { msg.html = mailMessage.html; } + if (mailMessage.to && mailMessage.from.to > 0) { msg.to = mailMessage.to; } + if (mailMessage.cc && mailMessage.from.cc > 0) { msg.cc = mailMessage.cc; } + if (mailMessage.bcc && mailMessage.from.bcc > 0) { msg.bcc = mailMessage.bcc; } + if (mailMessage.from && mailMessage.from.length > 0) { msg.from = mailMessage.from[0].address; } + if (mailMessage.attachments) { msg.attachments = mailMessage.attachments; } + else { msg.attachments = []; } node.send(msg); // Propagate the message down the flow } // End of processNewMessage @@ -322,11 +318,13 @@ module.exports = function(RED) { return; } + var marks = false; + if (this.disposition === "Read") { marks = true; } // We have the search results that contain the list of unseen messages and can now fetch those messages. var fetch = imap.fetch(results, { bodies: '', struct: true, - markSeen : true + markSeen: marks }); // For each fetched message returned ... @@ -357,10 +355,10 @@ module.exports = function(RED) { node.status({}); imap.end(); }; - if (this.disposition == "Delete") { + if (this.disposition === "Delete") { imap.addFlags(results, "\Deleted", cleanup); - } else if (this.disposition == "Read") { - imap.addFlags(results, "\Answered", cleanup); + } else if (this.disposition === "Read") { + imap.addFlags(results, "\Seen", cleanup); } else { cleanup(); } diff --git a/social/email/package.json b/social/email/package.json index bdd2a2e8..130d6236 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,12 +1,12 @@ { "name": "node-red-node-email", - "version": "0.1.12", + "version": "0.1.13", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0", "poplib": "^0.1.7", - "mailparser": "^0.6.0", - "imap": "^0.8.17" + "mailparser": "^0.6.1", + "imap": "^0.8.19" }, "repository": { "type": "git", From a0b95fe659626e5f715a9b176d680910f60cf36a Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 12 Dec 2016 21:14:32 +0000 Subject: [PATCH 010/142] set email default to read (as was previously happening) --- social/email/61-email.html | 2 +- social/email/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/social/email/61-email.html b/social/email/61-email.html index 960d22ab..fa233370 100644 --- a/social/email/61-email.html +++ b/social/email/61-email.html @@ -230,7 +230,7 @@ useSSL: {value: true}, port: {value:"993",required:true}, box: {value:"INBOX"}, // For IMAP, The mailbox to process - disposition: { value: "None" }, // For IMAP, the disposition of the read email + disposition: { value: "Read" }, // For IMAP, the disposition of the read email repeat: {value:"300",required:true} }, credentials: { diff --git a/social/email/package.json b/social/email/package.json index 130d6236..47ab762a 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-email", - "version": "0.1.13", + "version": "0.1.14", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0", From fa51c8fb364d04395b7870a4a15505415c912d5a Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 21 Dec 2016 17:17:35 +0000 Subject: [PATCH 011/142] Fix email read flag scoping issue to close #265 --- CONTRIBUTING.md | 1 - social/email/61-email.js | 6 +++--- social/email/package.json | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9ff88e35..006f956a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,7 +52,6 @@ to do so automatically. Please ensure you follow the coding standards used through-out the existing code base. Some basic rules include: - - all files must have the Apache license in the header. - indent with 4-spaces, no tabs. No arguments. - opening brace on same line as `if`/`for`/`function` and so on, closing brace on its own line. diff --git a/social/email/61-email.js b/social/email/61-email.js index b0bd91b5..1373cf4e 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -319,7 +319,7 @@ module.exports = function(RED) { } var marks = false; - if (this.disposition === "Read") { marks = true; } + if (node.disposition === "Read") { marks = true; } // We have the search results that contain the list of unseen messages and can now fetch those messages. var fetch = imap.fetch(results, { bodies: '', @@ -351,8 +351,8 @@ module.exports = function(RED) { // When we have fetched all the messages, we don't need the imap connection any more. fetch.on('end', function() { + node.status({}); var cleanup = function() { - node.status({}); imap.end(); }; if (this.disposition === "Delete") { @@ -370,8 +370,8 @@ module.exports = function(RED) { }); // End of imap->search }); // End of imap->openInbox }); // End of imap->ready - imap.connect(); node.status({fill:"grey",shape:"dot",text:"node-red:common.status.connecting"}); + imap.connect(); } // End of checkIMAP diff --git a/social/email/package.json b/social/email/package.json index 47ab762a..cd9a4758 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-email", - "version": "0.1.14", + "version": "0.1.15", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0", From 31cb3d1e4643cf3af2f695f15b0f2ff423066e45 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 27 Dec 2016 21:25:57 +0000 Subject: [PATCH 012/142] fix random node initial value (and tests) --- function/random/package.json | 2 +- function/random/random.html | 2 +- test/function/random/random_spec.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/function/random/package.json b/function/random/package.json index f2815dc3..f6e48cac 100644 --- a/function/random/package.json +++ b/function/random/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-random", - "version" : "0.0.7", + "version" : "0.0.8", "description" : "A Node-RED node that when triggered generates a random number between two values.", "dependencies" : { }, diff --git a/function/random/random.html b/function/random/random.html index eaf292f8..1a9cb7c7 100644 --- a/function/random/random.html +++ b/function/random/random.html @@ -35,7 +35,7 @@ defaults: { name: {value:""}, low: {value:"1"}, - high: {value:"6"}, + high: {value:"10"}, inte: {value:"true"} }, inputs:1, diff --git a/test/function/random/random_spec.js b/test/function/random/random_spec.js index fc82d378..412fd5ac 100644 --- a/test/function/random/random_spec.js +++ b/test/function/random/random_spec.js @@ -20,6 +20,7 @@ describe('random node', function() { var flow = [{"id":"n1", "type":"random", "name":"random1", "wires":[[]]}]; helper.load(testNode, flow, function() { var n1 = helper.getNode("n1"); + console.log(n1); n1.should.have.property("low", 1); n1.should.have.property("high", 10); n1.should.have.property("inte", false); @@ -28,7 +29,7 @@ describe('random node', function() { }); it('should output an integer between -3 and 3', function(done) { - var flow = [{"id":"n1", "type":"random", low:3, high:3, inte:true, wires:[["n2"]] }, + var flow = [{"id":"n1", "type":"random", low:-3, high:3, inte:true, wires:[["n2"]] }, {id:"n2", type:"helper"} ]; helper.load(testNode, flow, function() { var n1 = helper.getNode("n1"); From 83ea35d0ddd70803d97ccf488d675d6837beeceb Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 1 Jan 2017 23:34:23 +0000 Subject: [PATCH 013/142] Let daemon node call done() so it has time to kill child process --- utility/daemon/daemon.js | 5 +++-- utility/daemon/package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/utility/daemon/daemon.js b/utility/daemon/daemon.js index 13ce4c90..6f1b9f03 100644 --- a/utility/daemon/daemon.js +++ b/utility/daemon/daemon.js @@ -86,11 +86,12 @@ module.exports = function(RED) { }, 10000); // Restart after 10 secs if required } - node.on("close", function() { + node.on("close", function(done) { + clearInterval(loop); if (node.child != null) { node.child.kill('SIGKILL'); } if (RED.settings.verbose) { node.log(node.cmd+" stopped"); } - clearInterval(loop); node.status({}); + setTimeout(function() { done(); }, 100); }); runit(); diff --git a/utility/daemon/package.json b/utility/daemon/package.json index 93f42e1e..4fcf0626 100644 --- a/utility/daemon/package.json +++ b/utility/daemon/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-daemon", - "version" : "0.0.9", + "version" : "0.0.10", "description" : "A Node-RED node that runs and monitors a long running system command.", "dependencies" : { }, From dcd2ede2c49eb4d286f447cad5a039982b340ad9 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 9 Jan 2017 20:53:43 +0000 Subject: [PATCH 014/142] bump serial port package --- io/serialport/package.json | 6 +++--- storage/mongodb/66-mongodb.js | 18 +++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/io/serialport/package.json b/io/serialport/package.json index 5b2f03cf..f97c4a6d 100644 --- a/io/serialport/package.json +++ b/io/serialport/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-serialport", - "version" : "0.4.1", + "version" : "0.4.2", "description" : "Node-RED nodes to talk to serial ports", "dependencies" : { - "serialport" : "~4.0.3" + "serialport" : "~4.0.7" }, "repository" : { "type":"git", @@ -12,7 +12,7 @@ "license": "Apache-2.0", "keywords": [ "node-red", "serial" ], "node-red": { - "version": ">=0.13.0", + "version": ">=0.14.0", "nodes": { "serialport": "25-serial.js" } diff --git a/storage/mongodb/66-mongodb.js b/storage/mongodb/66-mongodb.js index 3b43436e..d829af19 100644 --- a/storage/mongodb/66-mongodb.js +++ b/storage/mongodb/66-mongodb.js @@ -178,18 +178,19 @@ module.exports = function(RED) { node.clientDb = db; noerror = true; var coll; - if (node.collection) { - coll = db.collection(node.collection); - } node.on("input", function(msg) { if (!node.collection) { if (msg.collection) { coll = db.collection(msg.collection); - } else { + } + else { node.error(RED._("mongodb.errors.nocollection")); return; } } + else { + coll = db.collection(node.collection); + } var selector; if (node.operation === "find") { msg.projection = msg.projection || {}; @@ -206,7 +207,8 @@ module.exports = function(RED) { coll.find(selector,msg.projection).sort(msg.sort).limit(limit).skip(skip).toArray(function(err, items) { if (err) { node.error(err); - } else { + } + else { msg.payload = items; delete msg.projection; delete msg.sort; @@ -220,12 +222,14 @@ module.exports = function(RED) { coll.count(selector, function(err, count) { if (err) { node.error(err); - } else { + } + else { msg.payload = count; node.send(msg); } }); - } else if (node.operation === "aggregate") { + } + else if (node.operation === "aggregate") { msg.payload = (Array.isArray(msg.payload)) ? msg.payload : []; coll.aggregate(msg.payload, function(err, result) { if (err) { From b2634ab4f2cdec4c38f42dddd196e44c0fbab0f3 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 18 Jan 2017 18:55:10 +0000 Subject: [PATCH 015/142] fix error logging in snap node to close #267 --- io/snmp/package.json | 2 +- io/snmp/snmp.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/io/snmp/package.json b/io/snmp/package.json index f964ff29..0626d0a4 100644 --- a/io/snmp/package.json +++ b/io/snmp/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-snmp", - "version" : "0.0.9", + "version" : "0.0.10", "description" : "A Node-RED node that looks for SNMP oids.", "dependencies" : { "net-snmp" : "^1.1.19" diff --git a/io/snmp/snmp.js b/io/snmp/snmp.js index 47bd9725..c246bcce 100644 --- a/io/snmp/snmp.js +++ b/io/snmp/snmp.js @@ -61,7 +61,7 @@ module.exports = function(RED) { function responseCb(error, table) { if (error) { - le.error(error.toString()); + console.error(error.toString()); } else { var indexes = []; for (var index in table) { From f70f4c4fffa3be4c19e245015bdcc91808ae5cc6 Mon Sep 17 00:00:00 2001 From: Bart Date: Sun, 29 Jan 2017 18:39:44 +0100 Subject: [PATCH 016/142] remove firmata/node_modules path in require('serialport') (#271) serialport is not found when installing the npm module local (instead of 'npm install node-red-node-arduino -g') --- hardware/Arduino/35-arduino.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/Arduino/35-arduino.js b/hardware/Arduino/35-arduino.js index 5a475d51..6526d6cf 100644 --- a/hardware/Arduino/35-arduino.js +++ b/hardware/Arduino/35-arduino.js @@ -3,7 +3,7 @@ module.exports = function(RED) { "use strict"; var Board = require('firmata'); - var SP = require('firmata/node_modules/serialport'); + var SP = require('serialport'); // The Board Definition - this opens (and closes) the connection function ArduinoNode(n) { From 603189f123bfe6caa5c67324ca1a803b998edd74 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 29 Jan 2017 17:43:48 +0000 Subject: [PATCH 017/142] Bump arduino package, thanks to PR --- hardware/Arduino/35-arduino.js | 6 ++++-- hardware/Arduino/package.json | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hardware/Arduino/35-arduino.js b/hardware/Arduino/35-arduino.js index 6526d6cf..ca0a1d5c 100644 --- a/hardware/Arduino/35-arduino.js +++ b/hardware/Arduino/35-arduino.js @@ -36,8 +36,10 @@ module.exports = function(RED) { done(); if (RED.settings.verbose) { node.log(RED._("arduino.status.portclosed")); } }); - } catch(e) { done(); } - } else { done(); } + } + catch(e) { done(); } + } + else { done(); } }); } RED.nodes.registerType("arduino-board",ArduinoNode); diff --git a/hardware/Arduino/package.json b/hardware/Arduino/package.json index bad149d9..f6835b2c 100644 --- a/hardware/Arduino/package.json +++ b/hardware/Arduino/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-arduino", - "version" : "0.0.12", + "version" : "0.0.13", "description" : "A Node-RED node to talk to an Arduino running firmata", "dependencies" : { - "firmata" : "~0.14.1" + "firmata" : "~0.15.0" }, "repository" : { "type":"git", From 316a2fd27290954e2112545c5f2a959bce7120b4 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 29 Jan 2017 17:45:44 +0000 Subject: [PATCH 018/142] Re-lint a load of nodes --- .jscsrc | 4 +- function/datagenerator/datagenerator.js | 11 ++- function/random/random.js | 3 +- function/smooth/17-smooth.js | 2 +- hardware/BBB/145-BBB-hardware.js | 96 +++++++++++++------- hardware/BBB/package.json | 4 +- hardware/LEDborg/78-ledborg.js | 3 +- hardware/Pibrella/38-rpi-pibrella.js | 6 +- hardware/blinkstick/76-blinkstick.js | 53 ++++++----- hardware/digiRGB/78-digiRGB.js | 12 ++- hardware/intel/mraa-gpio-din.js | 18 ++-- hardware/intel/mraa-gpio-dout.js | 6 +- hardware/makey/42-makey.js | 3 +- hardware/mcp3008/pimcp3008.js | 3 +- hardware/neopixel/neopixel.js | 9 +- hardware/physical-web/physical-web.js | 116 ++++++++++++++---------- hardware/sensorTag/79-sensorTag.js | 27 ++++-- hardware/wemo/WeMoNG.js | 57 ++++++++---- io/emoncms/88-emoncms.js | 6 +- io/mqlight/mqlight.js | 12 ++- io/serialport/25-serial.js | 24 +++-- io/snmp/snmp.js | 6 +- io/stomp/18-stomp.js | 8 +- io/wol/39-wol.js | 3 +- parsers/base64/70-base64.js | 3 +- parsers/geohash/70-geohash.js | 9 +- parsers/msgpack/70-msgpack.js | 3 +- parsers/what3words/what3words.js | 24 +++-- social/dweetio/55-dweetio.js | 3 +- social/email/61-email.js | 5 +- social/email/package.json | 2 +- social/feedparser/32-feedparse.js | 3 +- social/irc/91-irc.js | 8 +- social/pushbullet/57-pushbullet.js | 15 ++- social/twilio/56-twilio.js | 12 ++- social/twitter/27-twitter.js | 30 ++++-- social/xmpp/92-xmpp.js | 9 +- storage/mongodb/66-mongodb.js | 30 ++++-- storage/redis/65-redisout.js | 21 +++-- time/timeswitch/timeswitch.js | 6 +- utility/daemon/package.json | 2 +- utility/exif/94-exif.js | 24 +++-- 42 files changed, 447 insertions(+), 254 deletions(-) diff --git a/.jscsrc b/.jscsrc index 2d41de15..d235991a 100644 --- a/.jscsrc +++ b/.jscsrc @@ -6,11 +6,13 @@ "disallowMixedSpacesAndTabs": true, "disallowMultipleSpaces": {"allowEOLComments": true}, "disallowKeywordsOnNewLine": [], + "requireKeywordsOnNewLine": ["else", "catch"], "requireSpaceBeforeBlockStatements": 1, //"requireSpaceBeforeObjectValues": false, //"requireSemicolons": true, //"validateParameterSeparator": ", ", //"validateQuoteMarks": false, "requireSpaceAfterKeywords": ["do","for","if","else","switch","case","try","while"], - "maximumLineLength": 255 + "maximumLineLength": 255, + "disallowTabs": true } diff --git a/function/datagenerator/datagenerator.js b/function/datagenerator/datagenerator.js index 0979f80e..15366a37 100644 --- a/function/datagenerator/datagenerator.js +++ b/function/datagenerator/datagenerator.js @@ -20,14 +20,17 @@ module.exports = function(RED) { } if (node.fieldType === 'msg') { RED.util.setMessageProperty(msg,node.field,value); - } else if (node.fieldType === 'flow') { + } + else if (node.fieldType === 'flow') { node.context().flow.set(node.field,value); - } else if (node.fieldType === 'global') { + } + else if (node.fieldType === 'global') { node.context().global.set(node.field,value); } node.send(msg); - } catch(err) { - node.error(err.message); + } + catch(e) { + node.error(e.message); } }); } diff --git a/function/random/random.js b/function/random/random.js index c5a3eaa3..69da1d65 100644 --- a/function/random/random.js +++ b/function/random/random.js @@ -10,7 +10,8 @@ module.exports = function(RED) { this.on("input", function(msg) { if (node.inte == "true" || node.inte === true) { msg.payload = Math.round(Number(Math.random()) * (node.high - node.low + 1) + node.low - 0.5); - } else { + } + else { msg.payload = Number(Math.random()) * (node.high - node.low) + node.low; } node.send(msg); diff --git a/function/smooth/17-smooth.js b/function/smooth/17-smooth.js index cd954d96..e924c8ae 100644 --- a/function/smooth/17-smooth.js +++ b/function/smooth/17-smooth.js @@ -42,7 +42,7 @@ module.exports = function(RED) { tot = tot + n - pop; tot2 = tot2 + (n*n) - (pop * pop); if (a.length > 1) { - msg.payload = Math.sqrt((a.length * tot2 - tot * tot)/(a.length * (a.length - 1))); + msg.payload = Math.sqrt((a.length * tot2 - tot * tot)/(a.length * (a.length - 1))); } else { msg.payload = 0; } } diff --git a/hardware/BBB/145-BBB-hardware.js b/hardware/BBB/145-BBB-hardware.js index 1d9a8d9e..696fd75e 100644 --- a/hardware/BBB/145-BBB-hardware.js +++ b/hardware/BBB/145-BBB-hardware.js @@ -14,9 +14,11 @@ module.exports = function (RED) { adjustName = function (pin) { if (pin === "P8_7") { pin = "P8_07"; - } else if (pin === "P8_8") { + } + else if (pin === "P8_8") { pin = "P8_08"; - } else if (pin === "P8_9") { + } + else if (pin === "P8_9") { pin = "P8_09"; } return pin; @@ -38,7 +40,8 @@ module.exports = function (RED) { this.averaging = n.averaging; if (this.averaging) { this.averages = 10; - } else { + } + else { this.averages = 1; } @@ -54,7 +57,8 @@ module.exports = function (RED) { count = count - 1; if (count > 0) { bonescript.analogRead(node._pin, analogReadCallback); - } else { + } + else { var msg = {}; msg.topic = node.topic; sum = sum/node.averages; @@ -76,7 +80,8 @@ module.exports = function (RED) { count = node.averages; bonescript.analogRead(node._pin, analogReadCallback); }); - } else { + } + else { node.error("Unconfigured input pin"); } } @@ -92,18 +97,22 @@ module.exports = function (RED) { this._pin = adjustName(this.pin); // Adjusted for Octal if necessary if (n.activeLow) { // Set the 'active' state 0 or 1 as appropriate this.activeState = 0; - } else { + } + else { this.activeState = 1; } this.updateInterval = n.updateInterval*1000; // How often to send totalActiveTime messages this.debounce = n.debounce || null; // Enable switch contact debouncing algorithm if (n.outputOn === "rising") { this.activeEdges = [false, true]; - } else if (n.outputOn === "falling") { + } + else if (n.outputOn === "falling") { this.activeEdges = [true, false]; - } else if (n.outputOn === "both") { + } + else if (n.outputOn === "both") { this.activeEdges = [true, true]; - } else { + } + else { node.error("Invalid edge type: " + n.outputOn); } @@ -130,10 +139,12 @@ module.exports = function (RED) { node.interruptAttached = true; node.on("input", inputCallback); node.intervalId = setInterval(timerCallback, node.updateInterval); - } else { + } + else { node.error("Failed to attach interrupt"); } - } else if (node.currentState !== Number(x)) { + } + else if (node.currentState !== Number(x)) { if (node.debounce) { if (node.debouncing === false) { node.debouncing = true; @@ -141,7 +152,8 @@ module.exports = function (RED) { bonescript.digitalRead(node._pin, debounceCallback); }, Number(node.debounce)); } - } else { + } + else { sendStateMessage(x); } } @@ -166,7 +178,8 @@ module.exports = function (RED) { var now = Date.now(); if (node.currentState === node.activeState) { node.lastActiveTime = now; - } else if (!isNaN(node.lastActiveTime)) { + } + else if (!isNaN(node.lastActiveTime)) { node.totalActiveTime += now - node.lastActiveTime; } if (node.activeEdges[node.currentState]) { @@ -203,7 +216,8 @@ module.exports = function (RED) { var inputCallback = function (ipMsg) { if (String(ipMsg.topic).search(/load/i) < 0 || isFinite(ipMsg.payload) === false) { node.totalActiveTime = 0; - } else { + } + else { node.totalActiveTime = Number(ipMsg.payload); } if (node.currentState === node.activeState) { @@ -217,7 +231,8 @@ module.exports = function (RED) { if (node.activeEdges[0] && node.activeEdges[1]) { msg = [{topic: node.topic}, {topic: node.topic}]; msg[0].payload = node.currentState; - } else { + } + else { msg = [null, {topic: node.topic}]; } msg[1].payload = node.totalActiveTime; @@ -246,12 +261,14 @@ module.exports = function (RED) { node.emit("input", {}); }, 50); }); - } else { + } + else { node.error("Unable to set " + pin + " as input: " + response); } }); }); - } else { + } + else { node.error("Unconfigured input pin"); } } @@ -286,10 +303,12 @@ module.exports = function (RED) { node.interruptAttached = true; node.on("input", inputCallback); node.intervalId = setInterval(timerCallback, node.updateInterval); - } else { + } + else { node.error("Failed to attach interrupt"); } - } else { + } + else { node.pulseTime = [node.pulseTime[1], process.hrtime()]; node.pulseCount = node.pulseCount + 1; } @@ -301,7 +320,8 @@ module.exports = function (RED) { var inputCallback = function (msg) { if (String(msg.topic).search(/load/i) < 0 || isFinite(msg.payload) === false) { node.pulseCount = 0; - } else { + } + else { node.pulseCount = Number(msg.payload); } }; @@ -337,19 +357,22 @@ module.exports = function (RED) { if (node.countType === "pulse") { // interruptType = bonescript.FALLING; <- doesn't work in v0.2.4 interruptType = bonescript.RISING; - } else { + } + else { interruptType = bonescript.CHANGE; } // Attempt to attach the required interrupt handler to the pin. If we succeed, // the input event and interval handlers will be installed by interruptCallback bonescript.attachInterrupt(node._pin, interruptType, interruptCallback) }); - } else { + } + else { node.error("Unable to set " + pin + " as input: " + response); } }); }); - } else { + } + else { node.error("Unconfigured input pin"); } } @@ -376,12 +399,15 @@ module.exports = function (RED) { var newState; if (node.toggle) { newState = node.currentState === 0 ? 1 : 0; - } else { + } + else { if (isFinite(Number(msg.payload))) { newState = Number(msg.payload) > 0.5; - } else if (msg.payload) { + } + else if (msg.payload) { newState = true; - } else { + } + else { newState = false; } if (node.inverting) { @@ -402,7 +428,8 @@ module.exports = function (RED) { setPinMode(node._pin, bonescript.OUTPUT, function (response, pin) { if (response) { node.error("Unable to set " + pin + " as output: " + response.err); - } else { + } + else { node.on("input", inputCallback); setTimeout(function () { bonescript.digitalWrite(node._pin, node.defaultState, function() {}); @@ -410,7 +437,8 @@ module.exports = function (RED) { } }); }); - } else { + } + else { node.error("Unconfigured output pin"); } } @@ -453,10 +481,12 @@ module.exports = function (RED) { node.send({topic: node.topic, payload: node.pulseState}); }); } - } else { + } + else { if (node.pulseTimer !== null) { clearTimeout(node.pulseTimer); - } else { + } + else { bonescript.digitalWrite(node._pin, node.pulseState, function() { node.send({topic: node.topic, payload: node.pulseState}); }); @@ -484,12 +514,14 @@ module.exports = function (RED) { node.on("input", inputCallback); // Set the pin to the default state once the dust settles setTimeout(endPulseCallback, 50); - } else { + } + else { node.error("Unable to set " + pin + " as output: " + response.err); } }); }); - } else { + } + else { node.error("Unconfigured output pin"); } } diff --git a/hardware/BBB/package.json b/hardware/BBB/package.json index 98143bbd..c4c1acc9 100644 --- a/hardware/BBB/package.json +++ b/hardware/BBB/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-beaglebone", - "version" : "0.1.8", + "version" : "0.1.9", "description" : "A set of Node-RED nodes to interface to the GPIO pins of a Beaglebone Black board", "dependencies" : { - "octalbonescript":"^1.2.*" + "octalbonescript":"^1.2.2" }, "repository" : { "type":"git", diff --git a/hardware/LEDborg/78-ledborg.js b/hardware/LEDborg/78-ledborg.js index d5af9e20..dea2ebe9 100644 --- a/hardware/LEDborg/78-ledborg.js +++ b/hardware/LEDborg/78-ledborg.js @@ -12,7 +12,8 @@ module.exports = function(RED) { try { var cpuinfo = fs.readFileSync("/proc/cpuinfo").toString(); if (cpuinfo.indexOf(": BCM") === -1) { throw "Info : "+RED._("rpi-gpio.errors.ignorenode"); } - } catch(err) { + } + catch(err) { throw "Info : "+RED._("rpi-gpio.errors.ignorenode"); } diff --git a/hardware/Pibrella/38-rpi-pibrella.js b/hardware/Pibrella/38-rpi-pibrella.js index ffe719b2..be8b49f8 100644 --- a/hardware/Pibrella/38-rpi-pibrella.js +++ b/hardware/Pibrella/38-rpi-pibrella.js @@ -164,10 +164,12 @@ module.exports = function(RED) { if (node.pin !== undefined) { if (node.pin === "12") { node.child = spawn(gpioCommand, ["buzz",node.pin]); - } else { + } + else { if (node.set && (node.out === "out")) { node.child = spawn(gpioCommand, [node.out,node.pin,node.level]); - } else { + } + else { node.child = spawn(gpioCommand, [node.out,node.pin]); } } diff --git a/hardware/blinkstick/76-blinkstick.js b/hardware/blinkstick/76-blinkstick.js index d403e11a..bb78719c 100644 --- a/hardware/blinkstick/76-blinkstick.js +++ b/hardware/blinkstick/76-blinkstick.js @@ -32,7 +32,7 @@ module.exports = function(RED) { return typeof (value) === "undefined" || value === null ? value = defaultValue : value; } - function validateArray(value, defaultValue){ + function validateArray(value, defaultValue) { return typeof (value) === "undefined" || Array.isArray(value) ? value : defaultValue; } @@ -66,7 +66,7 @@ module.exports = function(RED) { this.name = n.name; this.serial = n.serial; - this.mode = n.mode || "normal"; + this.mode = n.mode || "normal"; this.task = n.task || "set_color"; this.delay = n.delay || 500; this.repeats = n.repeats || 1; @@ -95,25 +95,28 @@ module.exports = function(RED) { if (Object.size(node.led) === 0) { node.status({fill:"red",shape:"ring",text:"not found"}); node.error("BlinkStick with serial number " + node.serial + " not found"); - } else { + } + else { node.status({fill:"green",shape:"dot",text:"connected"}); - if(node.mode == "normal"){node.led.setMode(0);} - else if(node.mode == "inverted"){node.led.setMode(1);} - else if(node.mode == "neopixel"){node.led.setMode(2);} + if (node.mode == "normal") {node.led.setMode(0);} + else if (node.mode == "inverted") {node.led.setMode(1);} + else if (node.mode == "neopixel") {node.led.setMode(2);} if (callback) { callback(); } } }); - } else { + } + else { node.led = blinkstick.findFirst(); if (Object.size(node.led) === 0) { node.status({fill:"red",shape:"ring",text:"not found"}); node.error("No BlinkStick found"); - } else { + } + else { node.status({fill:"green",shape:"dot",text:"connected"}); - if(node.mode == "normal"){node.led.setMode(0);} - else if(node.mode == "inverted"){node.led.setMode(1);} - else if(node.mode == "neopixel"){node.led.setMode(2);} + if (node.mode == "normal") {node.led.setMode(0);} + else if (node.mode == "inverted") {node.led.setMode(1);} + else if (node.mode == "neopixel") {node.led.setMode(2);} if (callback) { callback(); } } } @@ -159,12 +162,15 @@ module.exports = function(RED) { //Select animation to perform if (node.task == "pulse") { node.led.pulse(node.color, {'duration': node.duration, 'steps': node.steps, 'channel': node.channel, 'index': node.index }, blinkstickAnimationComplete); - } else if (node.task == "morph") { + } + else if (node.task == "morph") { node.led.morph(node.color, {'duration': node.duration, 'steps': node.steps, 'channel': node.channel, 'index': node.index }, blinkstickAnimationComplete); - } else if (node.task == "blink") { + } + else if (node.task == "blink") { node.led.blink(node.color,{'repeats': node.repeats, 'delay': node.delay, 'channel': node.channel, 'index': node.index }, blinkstickAnimationComplete); - } else { - if(node.row.length > 0){ + } + else { + if (node.row.length > 0) { var dat = []; for (var i = 0; i < node.row.length; i++) { if (typeof node.row[i] === "string") { // if string then assume must be colour names @@ -187,14 +193,15 @@ module.exports = function(RED) { node.led.setColors(node.channel, dat, blinkstickAnimationComplete); } else { - node.warn("Colour array length not / 3"); + node.warn("Colour array length not / 3"); } } else { node.led.setColor(node.color, {'channel': node.channel, 'index': node.index}, blinkstickAnimationComplete); } } - } catch (err) { + } + catch (err) { if (err.toString().indexOf("setColor") !== -1) { node.led.setColour(node.color, blinkstickAnimationComplete); node.warn("Old version - please upgrade Blinkstick npm"); @@ -269,19 +276,22 @@ module.exports = function(RED) { node.channel = typeof(data.channel) !== 'undefined' ? data.channel : node.channel; node.index = data.index ? data.index : node.index; node.row = data.row ? data.row : node.row; - } else { + } + else { node.error(data); return; } } - } else if (p1.test(msg.payload)) { + } + else if (p1.test(msg.payload)) { //Color value is represented as "red,green,blue" string of bytes var rgb = msg.payload.split(","); //Convert color value back to HEX string for easier implementation node.color = "#" + decimalToHex(parseInt(rgb[0])&255) + decimalToHex(parseInt(rgb[1])&255) + decimalToHex(parseInt(rgb[2])&255); - } else { + } + else { //Sanitize color value node.color = msg.payload.toLowerCase().replace(/\s+/g,''); if (node.color === "amber") { node.color = "#FFBF00"; } @@ -293,7 +303,8 @@ module.exports = function(RED) { if (animationComplete) { applyColor(); } - } else { + } + else { //Attempt to find BlinkStick and start animation if it's found findBlinkStick(function() { if (animationComplete) { diff --git a/hardware/digiRGB/78-digiRGB.js b/hardware/digiRGB/78-digiRGB.js index 128cb476..eac688e8 100644 --- a/hardware/digiRGB/78-digiRGB.js +++ b/hardware/digiRGB/78-digiRGB.js @@ -16,7 +16,8 @@ module.exports = function(RED) { try { device = new HID.HID(devices[i].path); break; - } catch (e) { + } + catch (e) { node.log(e) } } @@ -32,16 +33,19 @@ module.exports = function(RED) { var g = parseInt(msg.payload.slice(3,5),16); var b = parseInt(msg.payload.slice(5),16); device.sendFeatureReport([115,r,g,b]); - } else if (p2.test(msg.payload)) { + } + else if (p2.test(msg.payload)) { var args = msg.payload.split(','); if (args.length == 3) { device.sendFeatureReport([115,parseInt(args[0]),parseInt(args[1]),parseInt(args[2])]); } - } else { + } + else { node.warn("incompatable input - " + msg.payload); } }); - } else { + } + else { node.warn("no digispark RGB found"); } diff --git a/hardware/intel/mraa-gpio-din.js b/hardware/intel/mraa-gpio-din.js index 56605d72..5966e448 100644 --- a/hardware/intel/mraa-gpio-din.js +++ b/hardware/intel/mraa-gpio-din.js @@ -16,31 +16,37 @@ module.exports = function(RED) { var g = node.x.read(); var msg = { payload:g, topic:node.board+"/D"+node.pin }; switch (g) { - case 0: + case 0: { node.status({fill:"green",shape:"ring",text:"low"}); if (node.interrupt=== "f" || node.interrupt === "b") { node.send(msg); } break; - case 1: + } + case 1: { node.status({fill:"green",shape:"dot",text:"high"}); if (node.interrupt=== "r" || node.interrupt === "b") { node.send(msg); } break; - default: + } + default: { node.status({fill:"grey",shape:"ring",text:"unknown"}); + } } }); switch (node.x.read()) { - case 0: + case 0: { node.status({fill:"green",shape:"ring",text:"low"}); break; - case 1: + } + case 1: { node.status({fill:"green",shape:"dot",text:"high"}); break; - default: + } + default: { node.status({}); + } } this.on('close', function() { node.x.isr(m.EDGE_BOTH, null); diff --git a/hardware/intel/mraa-gpio-dout.js b/hardware/intel/mraa-gpio-dout.js index 75ce9456..020db558 100644 --- a/hardware/intel/mraa-gpio-dout.js +++ b/hardware/intel/mraa-gpio-dout.js @@ -10,7 +10,8 @@ module.exports = function(RED) { var node = this; if (node.pin === 14) { node.p = new m.Gpio(3,false,true); // special for onboard LED v1 - } else { + } + else { node.p = new m.Gpio(node.pin); } node.p.mode(m.PIN_GPIO); @@ -21,7 +22,8 @@ module.exports = function(RED) { node.on("input", function(msg) { if (msg.payload == "1") { node.p.write(1); - } else { + } + else { node.p.write(0); } }); diff --git a/hardware/makey/42-makey.js b/hardware/makey/42-makey.js index ad6d185b..837f5621 100644 --- a/hardware/makey/42-makey.js +++ b/hardware/makey/42-makey.js @@ -56,7 +56,8 @@ module.exports = function(RED) { } else { console.log(key); } }); - } catch(err) { node.warn("can't open MakeyMakey: Do you need root access ?"); } + } + catch(err) { node.warn("can't open MakeyMakey: Do you need root access ?"); } } else { findmakey(); diff --git a/hardware/mcp3008/pimcp3008.js b/hardware/mcp3008/pimcp3008.js index 439bcdfb..5cc6d1ff 100644 --- a/hardware/mcp3008/pimcp3008.js +++ b/hardware/mcp3008/pimcp3008.js @@ -6,7 +6,8 @@ module.exports = function(RED) { try { var cpuinfo = fs.readFileSync("/proc/cpuinfo").toString(); if (cpuinfo.indexOf(": BCM") === -1) { throw "Info : "+RED._("rpi-gpio.errors.ignorenode"); } - } catch(err) { + } + catch(err) { throw "Info : "+RED._("rpi-gpio.errors.ignorenode"); } diff --git a/hardware/neopixel/neopixel.js b/hardware/neopixel/neopixel.js index 2ebcbea8..8d146703 100644 --- a/hardware/neopixel/neopixel.js +++ b/hardware/neopixel/neopixel.js @@ -10,7 +10,8 @@ module.exports = function(RED) { try { var cpuinfo = fs.readFileSync("/proc/cpuinfo").toString(); if (cpuinfo.indexOf(": BCM") === -1) { throw "Info : "+RED._("rpi-gpio.errors.ignorenode"); } - } catch(err) { + } + catch(err) { throw "Info : "+RED._("rpi-gpio.errors.ignorenode"); } @@ -57,7 +58,8 @@ module.exports = function(RED) { if (node.mode.indexOf("need") >= 0) { needle = colors.getRGB(parts[0],node.rgb); pay = "0,"+(l-1)+","+node.fgnd+"\n"+l+","+needle+"\n"+(l+1)+","+(node.pixels-1)+","+node.bgnd; - } else { + } + else { node.fgnd = colors.getRGB(parts[0],node.rgb); pay = "0,"+l+","+node.fgnd+"\n"+(l+1)+","+(node.pixels-1)+","+node.bgnd; } @@ -78,7 +80,8 @@ module.exports = function(RED) { ll = ll - 1; if (node.mode.indexOf("need") >= 0) { pay = "0,"+(ll-1)+","+node.fgnd+"\n"+ll+","+needle+"\n"+(ll+1)+","+(node.pixels-1)+","+node.bgnd; - } else { + } + else { pay = "0,"+ll+","+node.fgnd+"\n"+(ll+1)+","+(node.pixels-1)+","+node.bgnd; } } diff --git a/hardware/physical-web/physical-web.js b/hardware/physical-web/physical-web.js index af185d30..3631b598 100644 --- a/hardware/physical-web/physical-web.js +++ b/hardware/physical-web/physical-web.js @@ -7,42 +7,49 @@ module.exports = function(RED) { var checkLength = function(text) { var l = text.length; - switch(true) { - case /^http:\/\/www./.test(text): - l -= 10; - break; - case /^https:\/\/www./.test(text): - l -= 11; - break; - case /^http:\/\//.test(text): - l -= 6; - break; - case /^https:\/\//.test(text): - l -= 7; - break; + switch (true) { + case /^http:\/\/www./.test(text): { + l -= 10; + break; + } + case /^https:\/\/www./.test(text): { + l -= 11; + break; + } + case /^http:\/\//.test(text): { + l -= 6; + break; + } + case /^https:\/\//.test(text): { + l -= 7; + break; + } } - switch(true) { - case /.*\.info\/.*/.test(text): - l -= 5; - break; + switch (true) { + case /.*\.info\/.*/.test(text): { + l -= 5; + break; + } case /.*\.com\/.*/.test(text): case /.*\.net\/.*/.test(text): case /.*\.org\/.*/.test(text): case /.*\.edu\/.*/.test(text): case /.*\.biz\/.*/.test(text): case /.*\.gov\/.*/.test(text): - case /.*\.info.*/.test(text): - l -= 4; - break; + case /.*\.info.*/.test(text): { + l -= 4; + break; + } case /.*\.com.*/.test(text): case /.*\.net.*/.test(text): case /.*\.org.*/.test(text): case /.*\.edu.*/.test(text): case /.*\.biz.*/.test(text): - case /.*\.gov.*/.test(text): - l -= 3; - break; + case /.*\.gov.*/.test(text): { + l -= 3; + break; + } } return l; } @@ -70,7 +77,8 @@ module.exports = function(RED) { try { eddystoneBeacon.advertiseUrl(node.url, node.options); node.status({fill:"green",shape:"dot",text:node.url}); - } catch(e) { + } + catch(e) { node.error('Error setting beacon URL', e); } } @@ -83,7 +91,8 @@ module.exports = function(RED) { try { eddystoneBeacon.advertiseUid(node.namespace, node.instance, node.options); node.status({fill:"green",shape:"dot",text:node.namespace}); - } catch(e) { + } + catch(e) { node.error('Error setting beacon information', e); } } @@ -96,7 +105,8 @@ module.exports = function(RED) { try { eddystoneBeacon.stop(); node.status({fill:"red",shape:"dot",text:"Stopped"}); - } catch(e) { + } + catch(e) { node.error('error shutting down beacon', e); } return; @@ -107,7 +117,8 @@ module.exports = function(RED) { try { eddystoneBeacon.advertiseUrl(node.url, node.options); node.status({fill:"green",shape:"dot",text:node.url}); - } catch(e) { + } + catch(e) { node.error('Error setting beacon URL', e); } return; @@ -116,7 +127,8 @@ module.exports = function(RED) { try { eddystoneBeacon.advertiseUid(node.namespace, node.instance, node.options); node.status({fill:"green",shape:"dot",text:node.namespace}); - } catch(e) { + } + catch(e) { node.error('Error setting beacon information', e); } return; @@ -124,30 +136,33 @@ module.exports = function(RED) { } // url mode if (node.mode === "url") { - if (checkLength(msg.payload) <= 18) { - try { - node.url = msg.payload; - eddystoneBeacon.advertiseUrl(node.url, node.options); - node.status({fill:"green",shape:"dot",text:node.url}); - } catch(e) { - node.status({fill:"red",shape:"dot",text:"Error setting URL"}); - node.error('error updating beacon URL', e); - } - } else { - node.status({fill:"red",shape:"dot",text:"URL too long"}); - } + if (checkLength(msg.payload) <= 18) { + try { + node.url = msg.payload; + eddystoneBeacon.advertiseUrl(node.url, node.options); + node.status({fill:"green",shape:"dot",text:node.url}); + } + catch(e) { + node.status({fill:"red",shape:"dot",text:"Error setting URL"}); + node.error('error updating beacon URL', e); + } + } + else { + node.status({fill:"red",shape:"dot",text:"URL too long"}); + } } // uid mode else { - try { - node.namespace = msg.payload; - node.instance = msg.topic; - eddystoneBeacon.advertiseUid(node.namespace, node.instance, node.options); - node.status({fill:"green",shape:"dot",text:msg.payload}); - } catch(e) { - node.status({fill:"red",shape:"dot",text:"Error setting beacon information"}); - node.error('Error setting beacon information', e); - } + try { + node.namespace = msg.payload; + node.instance = msg.topic; + eddystoneBeacon.advertiseUid(node.namespace, node.instance, node.options); + node.status({fill:"green",shape:"dot",text:msg.payload}); + } + catch(e) { + node.status({fill:"red",shape:"dot",text:"Error setting beacon information"}); + node.error('Error setting beacon information', e); + } } }); @@ -157,7 +172,8 @@ module.exports = function(RED) { node.status({}); eddystoneBeacon.stop(); done(); - } catch(e) { + } + catch(e) { node.error('error shutting down beacon', e); } }); diff --git a/hardware/sensorTag/79-sensorTag.js b/hardware/sensorTag/79-sensorTag.js index 1fa53241..bc3a8c89 100644 --- a/hardware/sensorTag/79-sensorTag.js +++ b/hardware/sensorTag/79-sensorTag.js @@ -100,7 +100,8 @@ module.exports = function(RED) { },node.uuid); } },15000); - } else { + } + else { console.log("reconfig",node.uuid); enable(node); } @@ -114,46 +115,54 @@ module.exports = function(RED) { var enable = function(node) { if (node.temperature) { node.stag.notifyIrTemperature(function() {}); - } else { + } + else { node.stag.unnotifyIrTemperature(function() {}); } if (node.pressure) { node.stag.notifyBarometricPressure(function() {}); - } else { + } + else { node.stag.unnotifyBarometricPressure(function() {}); } if (node.humidity) { node.stag.notifyHumidity(function() {}); - } else { + } + else { node.stag.unnotifyHumidity(function() {}); } if (node.accelerometer) { node.stag.notifyAccelerometer(function() {}); - } else { + } + else { node.stag.unnotifyAccelerometer(function() {}); } if (node.magnetometer) { node.stag.notifyMagnetometer(function() {}); - } else { + } + else { node.stag.unnotifyMagnetometer(function() {}); } if (node.gyroscope) { node.stag.notifyGyroscope(function() {}); - } else { + } + else { node.stag.unnotifyGyroscope(function() {}); } if (node.stag.type === "cc2650") { if (node.luxometer) { node.stag.enableLuxometer(function() {}); node.stag.notifyLuxometer(function() {}); - } else { + } + else { node.stag.unnotifyLuxometer(function() {}); node.stag.disableLuxometer(function() {}); } } if (node.keys) { node.stag.notifySimpleKey(function() {}); - } else { + } + else { node.stag.unnotifySimpleKey(function() {}); } } diff --git a/hardware/wemo/WeMoNG.js b/hardware/wemo/WeMoNG.js index 1174b185..827b91ab 100644 --- a/hardware/wemo/WeMoNG.js +++ b/hardware/wemo/WeMoNG.js @@ -48,7 +48,8 @@ module.exports = function(RED) { delete subscriptions[dev]; delete sub2dev[sub.sid]; subscribe({dev: subs[s]}); - } else { + } + else { // console.log("resubscription good %s", res.statusCode); // console.log("dev - %s", util.inspect(dev)); } @@ -78,7 +79,8 @@ module.exports = function(RED) { if (subscriptions[dev]) { //exists subscriptions[dev].count++; - } else { + } + else { //new var ipAddr; @@ -97,7 +99,8 @@ module.exports = function(RED) { break; } } - } else { + } + else { //node 0.10 not great but best we can do if (!addrs[add].internal && addrs[add].family == 'IPv4') { ipAddr = addrs[add].address; @@ -143,7 +146,8 @@ module.exports = function(RED) { if (res.statusCode == 200) { subscriptions[dev] = {'count': 1, 'sid': res.headers.sid}; sub2dev[res.headers.sid] = dev; - } else { + } + else { console.log('failed to subsrcibe'); } }); @@ -181,10 +185,12 @@ module.exports = function(RED) { unSubreq.end(); - } else { + } + else { subscriptions[dev].count--; } - } else { + } + else { //shouldn't ever get here } } @@ -210,7 +216,8 @@ module.exports = function(RED) { node.status({fill: 'green',shape: 'dot',text: 'found'}); } }); - } else { + } + else { node.status({fill: 'green',shape: 'dot',text: 'found'}); } @@ -227,27 +234,32 @@ module.exports = function(RED) { if (typeof msg.payload === 'string') { if (msg.payload == 'on' || msg.payload == '1' || msg.payload == 'true') { on = 1; - } else if (msg.payload === 'toggle') { + } + else if (msg.payload === 'toggle') { on = 2; } - } else if (typeof msg.payload === 'number') { + } + else if (typeof msg.payload === 'number') { if (msg.payload >= 0 && msg.payload < 3) { on = msg.payload; } - } else if (typeof msg.payload === 'object') { + } + else if (typeof msg.payload === 'object') { //object need to get complicated here if (msg.payload.state && typeof msg.payload.state === 'number') { if (dev.type === 'socket') { if (msg.payload >= 0 && msg.payload < 2) { on = msg.payload.state; } - } else if (dev.type === 'light' || dev.type === 'group') { + } + else if (dev.type === 'light' || dev.type === 'group') { if (msg.payload >= 0 && msg.payload < 3) { on = msg.payload.state; } } } - } else if (typeof msg.payload === 'boolean') { + } + else if (typeof msg.payload === 'boolean') { if (msg.payload) { on = 1; } @@ -256,10 +268,12 @@ module.exports = function(RED) { if (dev.type === 'socket') { //console.log("socket"); wemo.toggleSocket(dev, on); - } else if (dev.type === 'light`') { + } + else if (dev.type === 'light`') { //console.log("light"); wemo.setStatus(dev,'10006', on); - } else { + } + else { console.log('group'); wemo.setStatus(dev, '10006', on); } @@ -295,17 +309,18 @@ module.exports = function(RED) { switch (notification.type){ case 'light': - case 'group': + case 'group': { if (dd.id === notification.id) { node.send(msg); } break; - case 'socket': + } + case 'socket': { node.send(msg); break; - default: + } + default: {} } - } }; @@ -316,7 +331,8 @@ module.exports = function(RED) { if (wemo.get(node.dev)) { node.status({fill: 'green',shape: 'dot',text: 'found'}); subscribe(node); - } else { + } + else { wemo.on('discovered', function(d) { if (node.dev === d) { node.status({fill: 'green',shape: 'dot',text: 'found'}); @@ -324,7 +340,8 @@ module.exports = function(RED) { } }); } - } else if (node.ipaddr) { + } + else if (node.ipaddr) { //legacy var devices = Object.keys(wemo.devices); for (var d in devices) { diff --git a/io/emoncms/88-emoncms.js b/io/emoncms/88-emoncms.js index 8fb8e0c1..145aff29 100644 --- a/io/emoncms/88-emoncms.js +++ b/io/emoncms/88-emoncms.js @@ -34,7 +34,8 @@ module.exports = function(RED) { else { if (msg.payload.indexOf(':') > -1) { this.url += 'json={' + msg.payload + '}'; - } else { + } + else { this.url += 'csv='+msg.payload; } } @@ -96,7 +97,8 @@ module.exports = function(RED) { if (msg.rc === 200) { try { msg.payload = JSON.parse(msg.payload); - } catch(err) { + } + catch(err) { // Failed to parse, pass it on } node.send(msg); diff --git a/io/mqlight/mqlight.js b/io/mqlight/mqlight.js index d917723e..88ca0a1a 100644 --- a/io/mqlight/mqlight.js +++ b/io/mqlight/mqlight.js @@ -22,7 +22,8 @@ module.exports = function(RED) { this.client = mqlight.createClient(opts, function(err) { if (err) { util.log('[mqlight] ['+id+'] not connected to service '+n.service); - } else { + } + else { util.log('[mqlight] ['+id+'] connected to service '+n.service); } }); @@ -72,13 +73,15 @@ module.exports = function(RED) { var subscribeCallback = function(err) { if (err) { node.error("Failed to subscribe: " + err); - } else { + } + else { node.log("Subscribed to "+node.topic+(node.share?" ["+node.share+"]":"")); } }; if (node.share) { recvClient.subscribe(node.topic, node.share, subscribeCallback); - } else { + } + else { recvClient.subscribe(node.topic, subscribeCallback); } }); @@ -113,7 +116,8 @@ module.exports = function(RED) { if (topic === "") { if (msg.topic) { topic = msg.topic; - } else { + } + else { node.warn("No topic set in MQ Light out node"); return; } diff --git a/io/serialport/25-serial.js b/io/serialport/25-serial.js index d03adee2..0f9a9bc4 100644 --- a/io/serialport/25-serial.js +++ b/io/serialport/25-serial.js @@ -45,11 +45,13 @@ module.exports = function(RED) { if (!Buffer.isBuffer(payload)) { if (typeof payload === "object") { payload = JSON.stringify(payload); - } else { + } + else { payload = payload.toString(); } payload += node.addCh; - } else if (node.addCh !== "") { + } + else if (node.addCh !== "") { payload = Buffer.concat([payload,new Buffer(node.addCh)]); } node.port.write(payload,function(err,res) { @@ -66,14 +68,16 @@ module.exports = function(RED) { node.port.on('closed', function() { node.status({fill:"red",shape:"ring",text:"node-red:common.status.not-connected"}); }); - } else { + } + else { this.error(RED._("serial.errors.missing-conf")); } this.on("close", function(done) { if (this.serialConfig) { serialPool.close(this.serialConfig.serialport,done); - } else { + } + else { done(); } }); @@ -105,7 +109,8 @@ module.exports = function(RED) { var splitc; if (node.serialConfig.newline.substr(0,2) == "0x") { splitc = new Buffer([parseInt(node.serialConfig.newline)]); - } else { + } + else { splitc = new Buffer(node.serialConfig.newline.replace("\\n","\n").replace("\\r","\r").replace("\\t","\t").replace("\\e","\e").replace("\\f","\f").replace("\\0","\0")); // jshint ignore:line } @@ -169,14 +174,16 @@ module.exports = function(RED) { this.port.on('closed', function() { node.status({fill:"red",shape:"ring",text:"node-red:common.status.not-connected"}); }); - } else { + } + else { this.error(RED._("serial.errors.missing-conf")); } this.on("close", function(done) { if (this.serialConfig) { serialPool.close(this.serialConfig.serialport,done); - } else { + } + else { done(); } }); @@ -273,7 +280,8 @@ module.exports = function(RED) { } catch(err) { } delete connections[port]; - } else { + } + else { done(); } } diff --git a/io/snmp/snmp.js b/io/snmp/snmp.js index c246bcce..c243496c 100644 --- a/io/snmp/snmp.js +++ b/io/snmp/snmp.js @@ -18,7 +18,8 @@ module.exports = function(RED) { node.session.get(oids.split(","), function(error, varbinds) { if (error) { node.error(error.toString(),msg); - } else { + } + else { for (var i = 0; i < varbinds.length; i++) { if (snmp.isVarbindError(varbinds[i])) { node.error(snmp.varbindError(varbinds[i]),msg); @@ -62,7 +63,8 @@ module.exports = function(RED) { function responseCb(error, table) { if (error) { console.error(error.toString()); - } else { + } + else { var indexes = []; for (var index in table) { if (table.hasOwnProperty(index)) { diff --git a/io/stomp/18-stomp.js b/io/stomp/18-stomp.js index 1ac3d58f..62fa5044 100644 --- a/io/stomp/18-stomp.js +++ b/io/stomp/18-stomp.js @@ -41,7 +41,7 @@ module.exports = function(RED) { } }; if (this.serverConfig.vhost) { - this.stompClientOpts.vhost = this.serverConfig.vhost; + this.stompClientOpts.vhost = this.serverConfig.vhost; } var node = this; @@ -49,7 +49,7 @@ module.exports = function(RED) { node.client = new StompClient(node.stompClientOpts); node.client.on("connect", function() { - node.status({fill:"green",shape:"dot",text:"connected"}); + node.status({fill:"green",shape:"dot",text:"connected"}); }); node.client.on("reconnecting", function() { @@ -110,14 +110,14 @@ module.exports = function(RED) { } }; if (this.serverConfig.vhost) { - this.stompClientOpts.vhost = this.serverConfig.vhost; + this.stompClientOpts.vhost = this.serverConfig.vhost; } var node = this; node.client = new StompClient(node.stompClientOpts); node.client.on("connect", function() { - node.status({fill:"green",shape:"dot",text:"connected"}); + node.status({fill:"green",shape:"dot",text:"connected"}); }); node.client.on("reconnecting", function() { diff --git a/io/wol/39-wol.js b/io/wol/39-wol.js index aee413be..0bd45d01 100644 --- a/io/wol/39-wol.js +++ b/io/wol/39-wol.js @@ -22,7 +22,8 @@ module.exports = function(RED) { node.log("sent WOL magic packet"); } }); - } catch(e) { + } + catch(e) { if (RED.settings.verbose) { node.log("WOL: socket error"); } } } diff --git a/parsers/base64/70-base64.js b/parsers/base64/70-base64.js index 5dc05140..319f7716 100644 --- a/parsers/base64/70-base64.js +++ b/parsers/base64/70-base64.js @@ -28,7 +28,8 @@ module.exports = function(RED) { else { node.warn("This node only handles strings or buffers."); } - } else { node.warn("No payload found to process"); } + } + else { node.warn("No payload found to process"); } }); } RED.nodes.registerType("base64",Base64Node); diff --git a/parsers/geohash/70-geohash.js b/parsers/geohash/70-geohash.js index ecc644e5..f0bebd11 100644 --- a/parsers/geohash/70-geohash.js +++ b/parsers/geohash/70-geohash.js @@ -29,7 +29,8 @@ module.exports = function(RED) { if (lt && ln) { msg.location.geohash = geohash.encode(lt, ln, le); node.send(msg); - } else { + } + else { node.warn("lat or lon missing from msg.location"); } } @@ -62,7 +63,8 @@ module.exports = function(RED) { if (!isNaN(la) && !isNaN(lo)) { msg.payload = geohash.encode(la, lo, li); node.send(msg); - } else { + } + else { node.warn("Incorrect string format - should be lat,lon"); } } @@ -79,7 +81,8 @@ module.exports = function(RED) { if (lat && lon) { msg.payload.geohash = geohash.encode(lat, lon, len); node.send(msg); - } else { + } + else { node.warn("lat or lon missing from msg.payload"); } } diff --git a/parsers/msgpack/70-msgpack.js b/parsers/msgpack/70-msgpack.js index 3b8be151..9e5c392e 100644 --- a/parsers/msgpack/70-msgpack.js +++ b/parsers/msgpack/70-msgpack.js @@ -26,7 +26,8 @@ module.exports = function(RED) { node.send(msg); node.status({text:le +" o->b "+ msg.payload.length}); } - } else { node.warn("No payload found to process"); } + } + else { node.warn("No payload found to process"); } }); } RED.nodes.registerType("msgpack",MsgPackNode); diff --git a/parsers/what3words/what3words.js b/parsers/what3words/what3words.js index cbc20c9f..8684bb8a 100644 --- a/parsers/what3words/what3words.js +++ b/parsers/what3words/what3words.js @@ -7,7 +7,8 @@ module.exports = function(RED) { RED.nodes.createNode(this, n); this.lang = n.lang || "en"; var credentials = RED.nodes.getCredentials(n.id); - if ((credentials) && (credentials.hasOwnProperty("pushkey"))) { this.pushkey = credentials.pushkey; } else { this.error("No what3words API key set"); } + if ((credentials) && (credentials.hasOwnProperty("pushkey"))) { this.pushkey = credentials.pushkey; } + else { this.error("No what3words API key set"); } this.w3w = new What3Words(this.pushkey); var node = this; var w1 = /^\*\w{6,31}$/; @@ -25,7 +26,8 @@ module.exports = function(RED) { .catch(function(err) { node.warn(err) }); - } else if (typeof (msg.payload) === "string") { + } + else if (typeof (msg.payload) === "string") { if (msg.payload.split(",").length === 2) { // see if it's 2 comma separated words node.w3w.positionToWords({ position:msg.payload, lang:node.lang }) .then(function(response) { @@ -36,7 +38,8 @@ module.exports = function(RED) { .catch(function(err) { node.warn(err); }); - } else if (msg.payload.match(w3)) { // see if it's 3 dot separated words + } + else if (msg.payload.match(w3)) { // see if it's 3 dot separated words node.w3w.wordsToPosition({ words:msg.payload }) .then(function(response) { if (!msg.hasOwnProperty("location")) { msg.location = {}; } @@ -47,7 +50,8 @@ module.exports = function(RED) { .catch(function(err) { node.warn(err) }); - } else if (msg.payload.match(w1)) { // see if it's a *Oneword + } + else if (msg.payload.match(w1)) { // see if it's a *Oneword node.w3w.wordsToPosition({ words:msg.payload }) .then(function(response) { if (!msg.hasOwnProperty("location")) { msg.location = {}; } @@ -59,8 +63,10 @@ module.exports = function(RED) { .catch(function(err) { node.warn(err); }); - } else { node.warn("No useable data found. See info."); } - } else { node.warn("No useable data found. See info."); } + } + else { node.warn("No useable data found. See info."); } + } + else { node.warn("No useable data found. See info."); } }); } RED.nodes.registerType("what3words", what3wordsNode); @@ -71,7 +77,8 @@ module.exports = function(RED) { var credentials = RED.nodes.getCredentials(req.params.id); if (credentials) { res.send(JSON.stringify({hasPassword:(credentials.pushkey && credentials.pushkey !== "")})); - } else { + } + else { res.send(JSON.stringify({})); } }); @@ -91,7 +98,8 @@ module.exports = function(RED) { var credentials = RED.nodes.getCredentials(req.params.id) || {}; if (newCreds.pushkey === "") { delete credentials.pushkey; - } else { + } + else { credentials.pushkey = newCreds.pushkey || credentials.pushkey; } RED.nodes.addCredentials(req.params.id, credentials); diff --git a/social/dweetio/55-dweetio.js b/social/dweetio/55-dweetio.js index a3be3678..df20c97c 100644 --- a/social/dweetio/55-dweetio.js +++ b/social/dweetio/55-dweetio.js @@ -45,7 +45,8 @@ module.exports = function(RED) { // This will be called anytime there is a new dweet for my-thing if (dweet.content.hasOwnProperty("payload")) { dweet.payload = dweet.content.payload; - } else { + } + else { dweet.payload = dweet.content; } delete dweet.content; diff --git a/social/email/61-email.js b/social/email/61-email.js index 1373cf4e..f814c437 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -19,7 +19,8 @@ module.exports = function(RED) { try { var globalkeys = RED.settings.email || require(process.env.NODE_RED_HOME+"/../emailkeys.js"); - } catch(err) { + } + catch(err) { } function EmailNode(n) { @@ -57,7 +58,7 @@ module.exports = function(RED) { var smtpTransport = nodemailer.createTransport({ host: node.outserver, port: node.outport, - secure: true, + secure: node.useSSL, auth: { user: node.userid, pass: node.password diff --git a/social/email/package.json b/social/email/package.json index cd9a4758..eb78bad0 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-email", - "version": "0.1.15", + "version": "0.1.16", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0", diff --git a/social/feedparser/32-feedparse.js b/social/feedparser/32-feedparse.js index 8d0ba2a8..bf898ef8 100644 --- a/social/feedparser/32-feedparse.js +++ b/social/feedparser/32-feedparse.js @@ -15,7 +15,8 @@ module.exports = function(RED) { var parsedUrl = url.parse(this.url); if (!(parsedUrl.host || (parsedUrl.hostname && parsedUrl.port)) && !parsedUrl.isUnix) { this.error(RED._("feedparse.errors.invalidurl")); - } else { + } + else { var getFeed = function() { var req = request(node.url, {timeout: 10000, pool: false}); //req.setMaxListeners(50); diff --git a/social/irc/91-irc.js b/social/irc/91-irc.js index 68d3b291..d6e2e98e 100644 --- a/social/irc/91-irc.js +++ b/social/irc/91-irc.js @@ -33,10 +33,10 @@ module.exports = function(RED) { } RED.nodes.registerType("irc-server",IRCServerNode, { - credentials: { - username: {type:"text"}, - password: {type:"password"} - } + credentials: { + username: {type:"text"}, + password: {type:"password"} + } }); diff --git a/social/pushbullet/57-pushbullet.js b/social/pushbullet/57-pushbullet.js index bbb4d71e..7b7bd60a 100644 --- a/social/pushbullet/57-pushbullet.js +++ b/social/pushbullet/57-pushbullet.js @@ -62,7 +62,8 @@ module.exports = function(RED) { pusher.me(function(err, me) { if (err) { reject(err); - } else { + } + else { resolve(me); } }); @@ -74,7 +75,8 @@ module.exports = function(RED) { pusher.history({limit:1}, function(err, res) { if (err) { resolve(0); - } else { + } + else { try { resolve(res.pushes[0].modified); } @@ -144,7 +146,8 @@ module.exports = function(RED) { closing = true; try { this.stream.close(); - } catch(err) { + } + catch(err) { // Ignore error if not connected } }); @@ -167,7 +170,8 @@ module.exports = function(RED) { } try { resolve(res.pushes[0].modified); - } catch(ex) { + } + catch(ex) { resolve(last); } }); @@ -360,7 +364,8 @@ module.exports = function(RED) { if (me) { deviceid = me.email; self.pushMsg(pushtype, deviceid, title, msg); - } else { + } + else { self.error("Unable to push",msg); } }); diff --git a/social/twilio/56-twilio.js b/social/twilio/56-twilio.js index c30ae4e8..95b7ca0c 100644 --- a/social/twilio/56-twilio.js +++ b/social/twilio/56-twilio.js @@ -39,10 +39,12 @@ module.exports = function(RED) { if (this.api) { this.twilioClient = twilio(this.api.sid,this.api.token); this.fromNumber = this.api.from; - } else if (twiliokey) { + } + else if (twiliokey) { this.twilioClient = twilio(twiliokey.account, twiliokey.authtoken); this.fromNumber = twiliokey.from; - } else { + } + else { this.error("missing twilio credentials"); return; } @@ -66,7 +68,8 @@ module.exports = function(RED) { } //console.log(response); }); - } else { + } + else { // Send SMS node.twilioClient.sendMessage( {to: tonum, from: node.fromNumber, body: msg.payload}, function(err, response) { if (err) { @@ -76,7 +79,8 @@ module.exports = function(RED) { }); } - } catch (err) { + } + catch (err) { node.error(err); } }); diff --git a/social/twitter/27-twitter.js b/social/twitter/27-twitter.js index a5db37de..b3dbbfee 100644 --- a/social/twitter/27-twitter.js +++ b/social/twitter/27-twitter.js @@ -32,7 +32,8 @@ module.exports = function(RED) { msg.location.lon = msg.tweet.geo.coordinates[1]; msg.location.icon = "twitter"; } - } else if (msg.tweet.coordinates) { // otherwise attempt go get it from coordinates + } + else if (msg.tweet.coordinates) { // otherwise attempt go get it from coordinates if (msg.tweet.coordinates.coordinates && msg.tweet.coordinates.coordinates.length === 2) { if (!msg.location) { msg.location = {}; } // WARNING! coordinates[1] is lat, coordinates[0] is lon!!! @@ -94,7 +95,8 @@ module.exports = function(RED) { } if (cb[0]) { node.since_ids[u] = cb[0].id_str; - } else { + } + else { node.since_ids[u] = '0'; } node.poll_ids.push(setInterval(function() { @@ -143,7 +145,8 @@ module.exports = function(RED) { } if (cb[0]) { node.since_id = cb[0].id_str; - } else { + } + else { node.since_id = '0'; } node.poll_ids.push(setInterval(function() { @@ -203,7 +206,8 @@ module.exports = function(RED) { //console.log("ERRO",rc,tweet); if (rc == 420) { node.status({fill:"red", shape:"ring", text:RED._("twitter.errors.ratelimit")}); - } else { + } + else { node.status({fill:"red", shape:"ring", text:" "}); node.warn(RED._("twitter.errors.streamerror",{error:tweet.toString(),rc:rc})); } @@ -265,7 +269,8 @@ module.exports = function(RED) { //console.log("ERRO",rc,tweet); if (rc == 420) { node.status({fill:"red", shape:"ring", text:RED._("twitter.errors.ratelimit")}); - } else { + } + else { node.status({fill:"red", shape:"ring", text:tweet.toString()}); node.warn(RED._("twitter.errors.streamerror",{error:tweet.toString(),rc:rc})); } @@ -409,13 +414,15 @@ module.exports = function(RED) { if (err) { node.error(err,msg); node.status({fill:"red",shape:"ring",text:"twitter.status.failed"}); - } else { + } + else { var response = JSON.parse(body); if (response.errors) { var errorList = response.errors.map(function(er) { return er.code+": "+er.message }).join(", "); node.error(RED._("twitter.errors.sendfail",{error:errorList}),msg); node.status({fill:"red",shape:"ring",text:"twitter.status.failed"}); - } else { + } + else { node.status({}); } } @@ -424,7 +431,8 @@ module.exports = function(RED) { form.append("status",msg.payload); form.append("media[]",msg.media,{filename:"image"}); - } else { + } + else { if (typeof msg.params === 'undefined') { msg.params = {}; } twit.updateStatus(msg.payload, msg.params, function (err, data) { if (err) { @@ -460,7 +468,8 @@ module.exports = function(RED) { var err = {statusCode: 401, data: "dummy error"}; var resp = RED._("twitter.errors.oautherror",{statusCode: err.statusCode, errorData: err.data}); res.send(resp) - } else { + } + else { credentials.oauth_token = oauth_token; credentials.oauth_token_secret = oauth_token_secret; res.redirect('https://api.twitter.com/oauth/authorize?oauth_token='+oauth_token) @@ -481,7 +490,8 @@ module.exports = function(RED) { if (error) { RED.log.error(error); res.send(RED._("twitter.errors.oauthbroke")); - } else { + } + else { credentials = {}; credentials.access_token = oauth_access_token; credentials.access_token_secret = oauth_access_token_secret; diff --git a/social/xmpp/92-xmpp.js b/social/xmpp/92-xmpp.js index 3f970098..262b5d4c 100644 --- a/social/xmpp/92-xmpp.js +++ b/social/xmpp/92-xmpp.js @@ -104,7 +104,8 @@ module.exports = function(RED) { skipPresence : true, reconnect : false }); - } catch(e) { + } + catch(e) { node.error("Bad xmpp configuration"); node.status({fill:"red",shape:"ring",text:"not connected"}); } @@ -180,7 +181,8 @@ module.exports = function(RED) { skipPresence : true, reconnect : false }); - } catch(e) { + } + catch(e) { node.error("Bad xmpp configuration"); node.status({fill:"red",shape:"ring",text:"not connected"}); } @@ -201,7 +203,8 @@ module.exports = function(RED) { else if (msg.payload) { if (typeof(msg.payload) === "object") { xmpp.send(to, JSON.stringify(msg.payload), node.join); - } else { + } + else { xmpp.send(to, msg.payload.toString(), node.join); } } diff --git a/storage/mongodb/66-mongodb.js b/storage/mongodb/66-mongodb.js index d829af19..a5438020 100644 --- a/storage/mongodb/66-mongodb.js +++ b/storage/mongodb/66-mongodb.js @@ -55,7 +55,8 @@ module.exports = function(RED) { if (noerror) { node.error(err); } noerror = false; node.tout = setTimeout(connectToDB, 10000); - } else { + } + else { node.status({fill:"green",shape:"dot",text:RED._("mongodb.status.connected")}); node.clientDb = db; noerror = true; @@ -67,7 +68,8 @@ module.exports = function(RED) { if (!node.collection) { if (msg.collection) { coll = db.collection(msg.collection); - } else { + } + else { node.error(RED._("mongodb.errors.nocollection"),msg); return; } @@ -87,14 +89,16 @@ module.exports = function(RED) { node.error(err,msg); } }); - } else { + } + else { coll.save(msg,function(err, item) { if (err) { node.error(err,msg); } }); } - } else if (node.operation === "insert") { + } + else if (node.operation === "insert") { if (node.payonly) { if (typeof msg.payload !== "object") { msg.payload = {"payload": msg.payload}; @@ -107,14 +111,16 @@ module.exports = function(RED) { node.error(err,msg); } }); - } else { + } + else { coll.insert(msg, function(err,item) { if (err) { node.error(err,msg); } }); } - } else if (node.operation === "update") { + } + else if (node.operation === "update") { if (typeof msg.payload !== "object") { msg.payload = {"payload": msg.payload}; } @@ -132,7 +138,8 @@ module.exports = function(RED) { node.error(err,msg); } }); - } else if (node.operation === "delete") { + } + else if (node.operation === "delete") { coll.remove(msg.payload, function(err, items) { if (err) { node.error(err,msg); @@ -173,7 +180,8 @@ module.exports = function(RED) { if (noerror) { node.error(err); } noerror = false; node.tout = setTimeout(connectToDB, 10000); - } else { + } + else { node.status({fill:"green",shape:"dot",text:RED._("mongodb.status.connected")}); node.clientDb = db; noerror = true; @@ -217,7 +225,8 @@ module.exports = function(RED) { node.send(msg); } }); - } else if (node.operation === "count") { + } + else if (node.operation === "count") { selector = ensureValidSelectorObject(msg.payload); coll.count(selector, function(err, count) { if (err) { @@ -234,7 +243,8 @@ module.exports = function(RED) { coll.aggregate(msg.payload, function(err, result) { if (err) { node.error(err); - } else { + } + else { msg.payload = result; node.send(msg); } diff --git a/storage/redis/65-redisout.js b/storage/redis/65-redisout.js index 11ef5644..76335b23 100644 --- a/storage/redis/65-redisout.js +++ b/storage/redis/65-redisout.js @@ -47,7 +47,8 @@ module.exports = function(RED) { if (this.client.connected) { this.status({fill:"green",shape:"dot",text:"node-red:common.status.connected"}); - } else { + } + else { this.status({fill:"red",shape:"ring",text:"node-red:common.status.disconnected"},true); } @@ -64,23 +65,29 @@ module.exports = function(RED) { if (k) { if (this.structtype == "string") { this.client.set(k,RED.util.ensureString(msg.payload)); - } else if (this.structtype == "hash") { + } + else if (this.structtype == "hash") { if (typeof msg.payload == "object") { this.client.hmset(k,msg.payload); - } else { + } + else { var r = hashFieldRE.exec(msg.payload); if (r) { this.client.hset(k,r[1],r[2]); - } else { + } + else { this.warn(RED._("redisout.errors.invalidpayload")); } } - } else if (this.structtype == "set") { + } + else if (this.structtype == "set") { this.client.sadd(k,msg.payload); - } else if (this.structtype == "list") { + } + else if (this.structtype == "list") { this.client.rpush(k,msg.payload); } - } else { + } + else { this.warn(RED._("redisout.errors.nokey")); } }); diff --git a/time/timeswitch/timeswitch.js b/time/timeswitch/timeswitch.js index 126a77af..593c648a 100644 --- a/time/timeswitch/timeswitch.js +++ b/time/timeswitch/timeswitch.js @@ -144,11 +144,13 @@ module.exports = function(RED) { try { node.emit("input", {payload:"reset"}); res.sendStatus(200); - } catch (err) { + } + catch (err) { res.sendStatus(500); node.error("Inject failed:" + err); } - } else { + } + else { res.sendStatus(404); } }); diff --git a/utility/daemon/package.json b/utility/daemon/package.json index 4fcf0626..f559c4c0 100644 --- a/utility/daemon/package.json +++ b/utility/daemon/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-daemon", - "version" : "0.0.10", + "version" : "0.0.11", "description" : "A Node-RED node that runs and monitors a long running system command.", "dependencies" : { }, diff --git a/utility/exif/94-exif.js b/utility/exif/94-exif.js index 8f5b21f0..e4cbb887 100644 --- a/utility/exif/94-exif.js +++ b/utility/exif/94-exif.js @@ -50,13 +50,16 @@ module.exports = function(RED) { msg.location.lat = latitude; msg.location.lon = longitude; return; - } else { + } + else { node.log("Invalid longitude data, no location information has been added to the message."); } - } else { + } + else { node.log("Invalid latitude data, no location information has been added to the message."); } - } else { + } + else { node.log("The location of this image cannot be determined safely so no location information has been added to the message."); } } @@ -68,26 +71,31 @@ module.exports = function(RED) { new ExifImage({ image : msg.payload }, function (error, exifData) { if (error) { node.log(error.toString()); - } else { + } + else { //msg.payload remains the same buffer if ((exifData) && (exifData.hasOwnProperty("gps")) && (Object.keys(exifData.gps).length !== 0)) { msg.exif = exifData; addMsgLocationDataFromExifGPSData(msg); - } else { + } + else { node.warn("The incoming image did not contain Exif GPS data, nothing to do. "); } } node.send(msg); }); - } else { + } + else { node.error("Invalid payload received, the Exif node cannot proceed, no messages sent."); return; } - } else { + } + else { node.error("No payload received, the Exif node cannot proceed, no messages sent."); return; } - } catch (error) { + } + catch (error) { node.error("An error occurred while extracting Exif information. Please check the log for details."); node.log('Error: '+error.message); return; From faba134e42d4ee37eaf2f9c8ebb585b1244f3a30 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 29 Jan 2017 17:46:50 +0000 Subject: [PATCH 019/142] add lables to daemon node --- utility/daemon/daemon.html | 1 + utility/daemon/daemon.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/utility/daemon/daemon.html b/utility/daemon/daemon.html index 792a26df..f9e1547d 100644 --- a/utility/daemon/daemon.html +++ b/utility/daemon/daemon.html @@ -59,6 +59,7 @@ }, inputs:1, outputs:3, + outputLabels: ["stdout","stderr","exit code"], icon: "arrow-in.png", align: "right", label: function() { diff --git a/utility/daemon/daemon.js b/utility/daemon/daemon.js index 6f1b9f03..30f0d62f 100644 --- a/utility/daemon/daemon.js +++ b/utility/daemon/daemon.js @@ -46,7 +46,8 @@ module.exports = function(RED) { node.send([{payload:bits.shift()},null,null]); } line = bits[0]; - } else { + } + else { if (data && (data.length !== 0)) { node.send([{payload:data},null,null]); } From c064b885405abd742445905a355e1fe5ec6c6b77 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 29 Jan 2017 17:47:06 +0000 Subject: [PATCH 020/142] bump suncalc package --- time/suncalc/79-suncalc.html | 1 + time/suncalc/package.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/time/suncalc/79-suncalc.html b/time/suncalc/79-suncalc.html index 4ca109e7..883bd5a6 100644 --- a/time/suncalc/79-suncalc.html +++ b/time/suncalc/79-suncalc.html @@ -57,6 +57,7 @@ }, inputs:0, outputs:2, + outputLabels: ["once per minute","only on change"], icon: "sun.png", label: function() { return this.name||"Sun rise/set"; diff --git a/time/suncalc/package.json b/time/suncalc/package.json index 66195dc0..fe538b73 100644 --- a/time/suncalc/package.json +++ b/time/suncalc/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-suncalc", - "version" : "0.0.9", + "version" : "0.0.10", "description" : "A Node-RED node to provide a signal at sunrise and sunset", "dependencies" : { - "suncalc" : "1.6.*" + "suncalc" : "^1.8.0" }, "repository" : { "type":"git", From fa781d6e1abd26161cff3702e0c449d24ce84705 Mon Sep 17 00:00:00 2001 From: wbchn Date: Sun, 5 Feb 2017 01:06:19 +0800 Subject: [PATCH 021/142] fix email login error when using pop3 method (#272) Thanks for spotting this (and fixing it !) --- social/email/61-email.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/social/email/61-email.js b/social/email/61-email.js index f814c437..e0714f40 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -239,7 +239,7 @@ module.exports = function(RED) { pop3Client.on("connect", function() { //node.log("We are now connected"); - pop3Client.login("kolban@test.com", "password"); + pop3Client.login(node.userid, node.password); }); pop3Client.on("login", function(status, rawData) { @@ -253,7 +253,7 @@ module.exports = function(RED) { }); pop3Client.on("retr", function(status, msgNumber, data, rawData) { - node.log(util.format("retr: status=%s, msgNumber=%d, data=%j", status, msgNumber, data)); + // node.log(util.format("retr: status=%s, msgNumber=%d, data=%j", status, msgNumber, data)); if (status) { // We have now received a new email message. Create an instance of a mail parser From 0ad4a7bc4dd9615030c8d265b6be272c771b9f40 Mon Sep 17 00:00:00 2001 From: Julian Hille Date: Mon, 6 Feb 2017 23:13:19 +0100 Subject: [PATCH 022/142] Add freebsd as a valid platform (#274) Freebsd ping command equals darwins ping command --- io/ping/88-ping.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/ping/88-ping.js b/io/ping/88-ping.js index a8999a73..84fb577e 100644 --- a/io/ping/88-ping.js +++ b/io/ping/88-ping.js @@ -14,7 +14,7 @@ module.exports = function(RED) { var ex; if (plat == "linux") { ex = spawn('ping', ['-n', '-w', '5', '-c', '1', node.host]); } else if (plat.match(/^win/)) { ex = spawn('ping', ['-n', '1', '-w', '5000', node.host]); } - else if (plat == "darwin") { ex = spawn('ping', ['-n', '-t', '5', '-c', '1', node.host]); } + else if (plat == "darwin" || plat == "freebsd") { ex = spawn('ping', ['-n', '-t', '5', '-c', '1', node.host]); } else { node.error("Sorry - your platform - "+plat+" - is not recognised."); } var res = false; var line = ""; From 7e421db6424319c49df11245c73ce37bbb2fe818 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 6 Feb 2017 22:29:55 +0000 Subject: [PATCH 023/142] emoncms - improve check for no input to close #275 --- io/emoncms/88-emoncms.html | 2 +- io/emoncms/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/io/emoncms/88-emoncms.html b/io/emoncms/88-emoncms.html index 9aa22c88..76c70a0a 100644 --- a/io/emoncms/88-emoncms.html +++ b/io/emoncms/88-emoncms.html @@ -31,7 +31,7 @@ defaults: { name: {value:"Emoncms"}, emonServer: {type:"emoncms-server", required:true}, - nodegroup: {value:"", validate:function(v) {return ((v === undefined)||(/^\d+$/).test(v)); }} + nodegroup: {value:"", validate:function(v) {return ((v === "")||(/^\d+$/).test(v));} } }, inputs:1, outputs:0, diff --git a/io/emoncms/package.json b/io/emoncms/package.json index cc74809f..623821d7 100644 --- a/io/emoncms/package.json +++ b/io/emoncms/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-emoncms", - "version" : "0.0.11", + "version" : "0.0.13", "description" : "A Node-RED node to fetch/post data to/from emoncms", "dependencies" : { }, From 93c85ca7cd2b3c58f7f527252424cb355d8f1847 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 7 Feb 2017 21:41:18 +0000 Subject: [PATCH 024/142] Allow Smooth node to be reset by msg.reset to close #273 --- function/smooth/17-smooth.html | 5 ++++- function/smooth/17-smooth.js | 7 +++++++ function/smooth/README.md | 2 ++ function/smooth/package.json | 2 +- test/function/smooth/17-smooth_spec.js | 21 +++++++++++++++++++++ 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/function/smooth/17-smooth.html b/function/smooth/17-smooth.html index 177fefd7..7fa06e74 100644 --- a/function/smooth/17-smooth.html +++ b/function/smooth/17-smooth.html @@ -32,7 +32,10 @@ diff --git a/function/smooth/17-smooth.js b/function/smooth/17-smooth.js index e924c8ae..14e69af4 100644 --- a/function/smooth/17-smooth.js +++ b/function/smooth/17-smooth.js @@ -16,6 +16,13 @@ module.exports = function(RED) { var old = null; this.on('input', function (msg) { + if (msg.hasOwnProperty("reset")) { + a = []; + tot = 0; + tot2 = 0; + pop = 0; + old = null; + } if (msg.hasOwnProperty("payload")) { var n = Number(msg.payload); if (!isNaN(n)) { diff --git a/function/smooth/README.md b/function/smooth/README.md index 9beb68e5..5cb2f7dd 100644 --- a/function/smooth/README.md +++ b/function/smooth/README.md @@ -33,5 +33,7 @@ the more the smoothing. E.g. a value of 10 is similar to an α of 0.1. It is analogous to an RC time constant - but there is no time component to this as the code is based on events arriving. +If `msg.reset` is received (with any value), all the counters and intermediate values are reset to an initial state. + **Note:** This node only operates on **numbers**. Anything else will try to be made into a number and rejected if that fails. diff --git a/function/smooth/package.json b/function/smooth/package.json index c2f857c4..3c0654f2 100644 --- a/function/smooth/package.json +++ b/function/smooth/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-smooth", - "version" : "0.0.9", + "version" : "0.0.10", "description" : "A Node-RED node that provides several simple smoothing algorithms for incoming data values.", "dependencies" : { }, diff --git a/test/function/smooth/17-smooth_spec.js b/test/function/smooth/17-smooth_spec.js index 14bd2d24..3408151a 100644 --- a/test/function/smooth/17-smooth_spec.js +++ b/test/function/smooth/17-smooth_spec.js @@ -48,6 +48,27 @@ describe('smooth node', function() { }); }); + it('should be able to be reset', function(done) { + var flow = [{"id":"n1", "type":"smooth", action:"mean", count:"5", round:"true", wires:[["n2"]] }, + {id:"n2", type:"helper"} ]; + helper.load(testNode, flow, function() { + var n1 = helper.getNode("n1"); + var n2 = helper.getNode("n2"); + var c = 0; + n2.on("input", function(msg) { + c += 1; + if (c === 3) { msg.should.have.a.property("payload", 2); } + if (c === 6) { msg.should.have.a.property("payload", 5); done(); } + }); + n1.emit("input", {payload:1}); + n1.emit("input", {payload:2}); + n1.emit("input", {payload:3}); + n1.emit("input", {reset:true, payload:4}); + n1.emit("input", {payload:5}); + n1.emit("input", {payload:6}); + }); + }); + it('should output max over a number of inputs', function(done) { var flow = [{"id":"n1", "type":"smooth", action:"max", count:"5", wires:[["n2"]] }, {id:"n2", type:"helper"} ]; From 367237d94647ea1b4b4ccc8c7f546d1481755669 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 13 Feb 2017 22:43:43 +0000 Subject: [PATCH 025/142] Let email out node set secure connection explicitly to close #1148 --- social/email/61-email.html | 6 +++++- social/email/61-email.js | 3 ++- social/email/package.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/social/email/61-email.html b/social/email/61-email.html index fa233370..9850bcea 100644 --- a/social/email/61-email.html +++ b/social/email/61-email.html @@ -35,7 +35,10 @@
- + + + + Use secure connection.
@@ -77,6 +80,7 @@ defaults: { server: {value:"smtp.gmail.com",required:true}, port: {value:"465",required:true}, + secure: {value: true}, name: {value:""}, dname: {value:""} }, diff --git a/social/email/61-email.js b/social/email/61-email.js index e0714f40..dc655a85 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -29,6 +29,7 @@ module.exports = function(RED) { this.name = n.name; this.outserver = n.server; this.outport = n.port; + this.secure = n.secure; var flag = false; if (this.credentials && this.credentials.hasOwnProperty("userid")) { this.userid = this.credentials.userid; @@ -58,7 +59,7 @@ module.exports = function(RED) { var smtpTransport = nodemailer.createTransport({ host: node.outserver, port: node.outport, - secure: node.useSSL, + secure: node.secure, auth: { user: node.userid, pass: node.password diff --git a/social/email/package.json b/social/email/package.json index eb78bad0..95a3ab95 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-email", - "version": "0.1.16", + "version": "0.1.17", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0", From 8e001fcd455cc54bab767140197ced65d8b7e3d5 Mon Sep 17 00:00:00 2001 From: Yohann Ciurlik Date: Wed, 15 Feb 2017 19:33:05 +0100 Subject: [PATCH 026/142] Adding No Auth support to social email out node (#277) * Let email out node connect to SMTP without authentication Add the possibility to connect to local SMTP without authentication. * Adapt test to connect to SMTP without credentials Adapt test to connect to SMTP without credentials * Add coverage for social email out node Add coverage for social email out node * Add more coverage to email out node Add more coverage to email out node --- social/email/61-email.js | 17 +- social/email/locales/en-US/61-email.json | 1 + social/email/package.json | 2 +- test/social/email/61-email_spec.js | 193 +++++++++++++++++------ 4 files changed, 156 insertions(+), 57 deletions(-) diff --git a/social/email/61-email.js b/social/email/61-email.js index dc655a85..bb049fe2 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -37,8 +37,6 @@ module.exports = function(RED) { if (globalkeys) { this.userid = globalkeys.user; flag = true; - } else { - this.error(RED._("email.errors.nouserid")); } } if (this.credentials && this.credentials.hasOwnProperty("password")) { @@ -47,8 +45,6 @@ module.exports = function(RED) { if (globalkeys) { this.password = globalkeys.pass; flag = true; - } else { - this.error(RED._("email.errors.nopassword")); } } if (flag) { @@ -59,12 +55,15 @@ module.exports = function(RED) { var smtpTransport = nodemailer.createTransport({ host: node.outserver, port: node.outport, - secure: node.secure, - auth: { + secure: node.secure + }); + + if(this.userid && this.password) { + smtpTransport.auth = { user: node.userid, pass: node.password - } - }); + }; + } this.on("input", function(msg) { if (msg.hasOwnProperty("payload")) { @@ -113,7 +112,7 @@ module.exports = function(RED) { } }); } - else { node.warn(RED._("email.errors.nocredentials")); } + else { node.warn(RED._("email.errors.nosmtptransport")); } } else { node.warn(RED._("email.errors.nopayload")); } }); diff --git a/social/email/locales/en-US/61-email.json b/social/email/locales/en-US/61-email.json index b87560e5..c85ffbfd 100644 --- a/social/email/locales/en-US/61-email.json +++ b/social/email/locales/en-US/61-email.json @@ -38,6 +38,7 @@ "nouserid": "No e-mail userid set", "nopassword": "No e-mail password set", "nocredentials": "No Email credentials found. See info panel.", + "nosmtptransport": "No SMTP transport. See info panel.", "nopayload": "No payload to send", "fetchfail": "Failed to fetch folder: __folder__", "messageerror": "Fetch message error: __error__" diff --git a/social/email/package.json b/social/email/package.json index 95a3ab95..97de9be5 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-email", - "version": "0.1.17", + "version": "0.1.18", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0", diff --git a/test/social/email/61-email_spec.js b/test/social/email/61-email_spec.js index ca8bf94d..38d76036 100644 --- a/test/social/email/61-email_spec.js +++ b/test/social/email/61-email_spec.js @@ -1,91 +1,190 @@ - var should = require("should"); var sinon = require("sinon"); var helper = require('../../../test/helper.js'); var emailNode = require('../../../social/email/61-email.js'); -describe('email Node', function() { +describe('email Node', function () { - beforeEach(function(done) { + beforeEach(function (done) { helper.startServer(done); }); - afterEach(function(done) { + afterEach(function (done) { helper.unload(); helper.stopServer(done); }); - describe('email in', function() { + describe('email in', function () { - it('should load with defaults', function(done) { - var flow = [ { id:"n1", type:"e-mail in", name:"emailin", wires:[[]] } ]; - helper.load(emailNode, flow, function() { + it('should load with defaults', function (done) { + var flow = [{ + id: "n1", + type: "e-mail in", + name: "emailin", + wires: [ + [] + ] + }]; + helper.load(emailNode, flow, function () { var n1 = helper.getNode("n1"); - n1.should.have.property('name', "emailin"); + n1.should.have.property('name', "emailin"); n1.should.have.property("repeat", 300000); n1.should.have.property("inserver", "imap.gmail.com"); n1.should.have.property("inport", "993"); done(); }); }); - - //it('should load', function(done) { - //var flow = [ { id:"n1", type:"e-mail in", wires:[["n2"]] }, - //{id:"n2", type:"helper"} ]; - //helper.load(emailNode, flow, function() { - //var n1 = helper.getNode("n1"); - //var n2 = helper.getNode("n2"); - //n2.on("input", function(msg) { - //msg.should.have.property('payload', "hello"); - //done(); - //}); - //var testString = "1,2,3,4"+String.fromCharCode(10); - //n1.emit("input", {payload:testString}); - //}); - //}); - }); - describe('email out', function() { + describe('email out', function () { - it('should load with defaults', function(done) { - var flow = [ { id:"n1", type:"e-mail", name:"emailout", wires:[[]] } ]; - helper.load(emailNode, flow, function() { + it('should load with defaults', function (done) { + var flow = [{ + id: "n1", + type: "e-mail", + name: "emailout", + wires: [ + [] + ] + }]; + helper.load(emailNode, flow, function () { var n1 = helper.getNode("n1"); - n1.should.have.property('name', "emailout"); + n1.should.have.property('name', "emailout"); done(); }); }); - it('should fail to send an email (no valid creds)', function(done) { - var smtpTransport = require("nodemailer").createTransport(); - //var spy = sinon.stub(smtpTransport, 'sendMail', function(arg1,arg2,arg3,arg4) { - //console.log("HELLO"); - //console.log(arg1,arg2,arg3,arg4); - //done(); - //}); - var flow = [ { id:"n1", type:"e-mail", name:"emailout", outserver:"smtp.gmail.com", outport:"465", wires:[[]] } ]; - helper.load(emailNode, flow, function() { + it('should fail with no payload', function (done) { + var flow = [{ + id: "n1", + type: "e-mail", + name: "emailout", + wires: [ + [] + ] + }]; + helper.load(emailNode, flow, function () { var n1 = helper.getNode("n1"); - n1.should.have.property('name', "emailout"); - n1.emit("input", {payload:"Hello World"}); + n1.credentials = { + userid: "test", + password: "test", + }; + n1.emit("input", {}); //done(); }); - setTimeout(function() { + setTimeout(function () { try { - var logEvents = helper.log().args.filter(function(evt) { + var logEvents = helper.log().args.filter(function (evt) { + //console.log(evt[0].msg); return evt[0].type == "e-mail"; }); - //console.log(logEvents); + //console.log(helper.log().args); + //console.log(helper.log()); //logEvents.should.have.length(3); logEvents[0][0].should.have.a.property('msg'); - logEvents[0][0].msg.toString().should.startWith("email.errors.nouserid"); + logEvents[0][0].msg.toString().should.startWith("email.errors.nopayload"); done(); + } catch (e) { + done(e); + } + //finally { smtpTransport.sendMail.restore(); } + }, 1000); + }); + + it('should fail to send an email (invalid creds)', function (done) { + //var smtpTransport = require("nodemailer").createTransport(); + //var spy = sinon.stub(smtpTransport, 'sendMail', function(arg1,arg2,arg3,arg4) { + //console.log("HELLO"); + //console.log(arg1,arg2,arg3,arg4); + //done(); + //}); + var flow = [{ + id: "n1", + type: "e-mail", + name: "test@gmail.com", + server: "smtp.gmail.com", + secure: true, + port: "465", + wires: [ + [] + ] + }]; + helper.load(emailNode, flow, function () { + var n1 = helper.getNode("n1"); + n1.credentials = { + userid: "test", + password: "test", + }; + n1.should.have.property('name', "test@gmail.com"); + n1.emit("input", { + payload: "Hello World", + to: "test@gmail.com" + }); + //done(); + }); + setTimeout(function () { + try { + var logEvents = helper.log().args.filter(function (evt) { + //console.log(evt[0].msg); + return evt[0].type == "e-mail"; + }); + //console.log(helper.log().args); + //console.log(helper.log()); + //logEvents.should.have.length(3); + logEvents[0][0].should.have.a.property('msg'); + logEvents[0][0].msg.toString().should.startWith("Error:"); + done(); + } catch (e) { + done(e); + } + //finally { smtpTransport.sendMail.restore(); } + }, 1000); + }) + + it('should fail to send an email (no creds provided)', function (done) { + //var smtpTransport = require("nodemailer").createTransport(); + //var spy = sinon.stub(smtpTransport, 'sendMail', function(arg1,arg2,arg3,arg4) { + //console.log("HELLO"); + //console.log(arg1,arg2,arg3,arg4); + //done(); + //}); + var flow = [{ + id: "n1", + type: "e-mail", + name: "test@gmail.com", + server: "smtp.gmail.com", + secure: true, + port: "465", + wires: [ + [] + ] + }]; + helper.load(emailNode, flow, function () { + var n1 = helper.getNode("n1"); + n1.should.have.property('name', "test@gmail.com"); + n1.emit("input", { + payload: "Hello World", + to: "test@gmail.com" + }); + //done(); + }); + setTimeout(function () { + try { + var logEvents = helper.log().args.filter(function (evt) { + //console.log(evt[0].msg); + return evt[0].type == "e-mail"; + }); + //console.log(helper.log().args); + //logEvents.should.have.length(3); + logEvents[0][0].should.have.a.property('msg'); + logEvents[0][0].msg.toString().should.startWith("Error:"); + done(); + } catch (e) { + done(e); } - catch(e) { done(e); } //finally { smtpTransport.sendMail.restore(); } }, 1000); }) }); -}); +}); \ No newline at end of file From 80942c5da8476a64e1a8f6fbbbbfeed022f114ef Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 15 Feb 2017 18:33:59 +0000 Subject: [PATCH 027/142] update travis node.js levels --- .jscsrc | 2 +- .travis.yml | 7 +++---- test/function/random/random_spec.js | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.jscsrc b/.jscsrc index d235991a..16af03e3 100644 --- a/.jscsrc +++ b/.jscsrc @@ -6,7 +6,7 @@ "disallowMixedSpacesAndTabs": true, "disallowMultipleSpaces": {"allowEOLComments": true}, "disallowKeywordsOnNewLine": [], - "requireKeywordsOnNewLine": ["else", "catch"], + //"requireKeywordsOnNewLine": ["else", "catch"], "requireSpaceBeforeBlockStatements": 1, //"requireSpaceBeforeObjectValues": false, //"requireSemicolons": true, diff --git a/.travis.yml b/.travis.yml index 4b22e120..38692698 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,14 +11,13 @@ addons: - gcc-4.8 matrix: allow_failures: - - node_js: "5" + - node_js: "7" before_install: - npm install -g npm@latest-2 node_js: - - "5" + - "7" + - "6" - "4" - - "0.12" - - "0.10" before_script: - npm install -g istanbul grunt-cli - npm install coveralls diff --git a/test/function/random/random_spec.js b/test/function/random/random_spec.js index 412fd5ac..e1a7d963 100644 --- a/test/function/random/random_spec.js +++ b/test/function/random/random_spec.js @@ -20,7 +20,7 @@ describe('random node', function() { var flow = [{"id":"n1", "type":"random", "name":"random1", "wires":[[]]}]; helper.load(testNode, flow, function() { var n1 = helper.getNode("n1"); - console.log(n1); + //console.log(n1); n1.should.have.property("low", 1); n1.should.have.property("high", 10); n1.should.have.property("inte", false); From 6ace40c1f24a08850b70a6619f6fc271b9f2ac32 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 21 Feb 2017 12:23:47 +0000 Subject: [PATCH 028/142] re-add auth to email out... apologies all round --- social/email/61-email.js | 6 +++++- social/email/package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/social/email/61-email.js b/social/email/61-email.js index bb049fe2..9a7c0c34 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -55,7 +55,11 @@ module.exports = function(RED) { var smtpTransport = nodemailer.createTransport({ host: node.outserver, port: node.outport, - secure: node.secure + secure: node.secure, + auth: { + user: node.userid, + pass: node.password + } }); if(this.userid && this.password) { diff --git a/social/email/package.json b/social/email/package.json index 97de9be5..d59e45dc 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-email", - "version": "0.1.18", + "version": "0.1.19", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0", From f15f8598f3f52c8e470c47bcd1c672f6e3dd3533 Mon Sep 17 00:00:00 2001 From: timolehto Date: Tue, 21 Feb 2017 15:00:21 +0200 Subject: [PATCH 029/142] Fixes smtp/auth bug: https://github.com/node-red/node-red-nodes/issues/279 (#280) --- social/email/61-email.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/social/email/61-email.js b/social/email/61-email.js index 9a7c0c34..c6172f2a 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -52,22 +52,19 @@ module.exports = function(RED) { } var node = this; - var smtpTransport = nodemailer.createTransport({ + var smtpOptions = { host: node.outserver, port: node.outport, - secure: node.secure, - auth: { - user: node.userid, - pass: node.password - } - }); + secure: node.secure + } if(this.userid && this.password) { - smtpTransport.auth = { + smtpOptions.auth = { user: node.userid, pass: node.password }; } + var smtpTransport = nodemailer.createTransport(smtpOptions); this.on("input", function(msg) { if (msg.hasOwnProperty("payload")) { From a4eaf5596175c20f4ae6115266a9032d271d126a Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 21 Feb 2017 13:07:42 +0000 Subject: [PATCH 030/142] bump email package version on npm better fix from @timolehto --- social/email/61-email.js | 2 +- social/email/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/social/email/61-email.js b/social/email/61-email.js index c6172f2a..cb3bf1e1 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -58,7 +58,7 @@ module.exports = function(RED) { secure: node.secure } - if(this.userid && this.password) { + if (this.userid && this.password) { smtpOptions.auth = { user: node.userid, pass: node.password diff --git a/social/email/package.json b/social/email/package.json index d59e45dc..566bde72 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-email", - "version": "0.1.19", + "version": "0.1.20", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0", From dc1ca765ecdf4a3b58b576549b843c8ae8e40d77 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 22 Feb 2017 17:55:46 +0000 Subject: [PATCH 031/142] add missing header property from email in node to close #281 Thanks @obook --- social/email/61-email.js | 1 + social/email/package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/social/email/61-email.js b/social/email/61-email.js index cb3bf1e1..b21f1e9e 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -185,6 +185,7 @@ module.exports = function(RED) { msg.payload = mailMessage.text; msg.topic = mailMessage.subject; msg.date = mailMessage.date; + msg.header = mailMessage.headers; if (mailMessage.html) { msg.html = mailMessage.html; } if (mailMessage.to && mailMessage.from.to > 0) { msg.to = mailMessage.to; } if (mailMessage.cc && mailMessage.from.cc > 0) { msg.cc = mailMessage.cc; } diff --git a/social/email/package.json b/social/email/package.json index 566bde72..e1c9258d 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-email", - "version": "0.1.20", + "version": "0.1.21", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0", From 5a85813a45943db1b522a1bea170dc8ae0ec3e81 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 24 Feb 2017 22:01:57 +0000 Subject: [PATCH 032/142] Bump to Twilio package to close #282 --- social/twilio/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/social/twilio/package.json b/social/twilio/package.json index 05aad107..3b101811 100644 --- a/social/twilio/package.json +++ b/social/twilio/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-twilio", - "version" : "0.0.11", + "version" : "0.0.12", "description" : "A Node-RED node to send SMS messages via the Twilio service.", "dependencies" : { - "twilio" : "1.6.0" + "twilio" : "^2.11.1" }, "repository" : { "type":"git", From c6d214fcfee74e32f675b79b9cb2ec7b2af449ad Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 26 Feb 2017 10:18:07 +0000 Subject: [PATCH 033/142] mysql set to try to keep server connection alive --- storage/mysql/68-mysql.js | 101 +++++++++++++++++++++---------------- storage/mysql/package.json | 4 +- 2 files changed, 60 insertions(+), 45 deletions(-) diff --git a/storage/mysql/68-mysql.js b/storage/mysql/68-mysql.js index c2e85422..e5f07f57 100644 --- a/storage/mysql/68-mysql.js +++ b/storage/mysql/68-mysql.js @@ -17,62 +17,77 @@ module.exports = function(RED) { this.setMaxListeners(0); var node = this; - function doConnect() { - node.connecting = true; - node.emit("state","connecting"); - node.connection = mysqldb.createConnection({ - host : node.host, - port : node.port, - user : node.credentials.user, - password : node.credentials.password, - database : node.dbname, - timezone : node.tz, - insecureAuth: true, - multipleStatements: true - }); - - node.connection.connect(function(err) { - node.connecting = false; + function checkVer() { + node.connection.query("SELECT version();", [], function(err, rows) { if (err) { - node.error(err); - node.emit("state",err.code); - node.tick = setTimeout(doConnect, reconnect); - } else { - node.connected = true; - node.emit("state","connected"); - } - }); - - node.connection.on('error', function(err) { - node.connected = false; - node.emit("state",err.code); - if (err.code === 'PROTOCOL_CONNECTION_LOST') { - doConnect(); // silently reconnect... - } else { - node.error(err); + node.connection.release(); + node.error(err,msg); + node.status({fill:"red",shape:"ring",text:"Bad Ping"}); doConnect(); } }); } + function doConnect() { + node.connecting = true; + node.emit("state","connecting"); + if (!node.pool) { + node.pool = mysqldb.createPool({ + host : node.host, + port : node.port, + user : node.credentials.user, + password : node.credentials.password, + database : node.dbname, + timezone : node.tz, + insecureAuth: true, + multipleStatements: true, + connectionLimit: 25 + }); + } + + node.pool.getConnection(function(err, connection) { + node.connecting = false; + if (err) { + node.emit("state",err.code); + node.error(err); + node.tick = setTimeout(doConnect, reconnect); + } + else { + node.connection = connection; + node.connected = true; + node.emit("state","connected"); + node.connection.on('error', function(err) { + node.connected = false; + node.connection.release(); + node.emit("state",err.code); + if (err.code === 'PROTOCOL_CONNECTION_LOST') { + doConnect(); // silently reconnect... + } + else if (err.code === 'ECONNRESET') { + doConnect(); // silently reconnect... + } + else { + node.error(err); + doConnect(); + } + }); + if (!node.check) { node.check = setInterval(checkVer, 290000); } + } + }); + } + this.connect = function() { - if (!this.connected && !this.connecting) { doConnect(); } - if (this.connected) { node.emit("state","connected"); } - else { node.emit("state","connecting"); } + if (!this.connected && !this.connecting) { + doConnect(); + } } this.on('close', function (done) { if (this.tick) { clearTimeout(this.tick); } + if (this.check) { clearInterval(this.check); } node.connected = false; node.emit("state"," "); - if (this.connection) { - node.connection.end(function(err) { - if (err) { node.error(err); } - done(); - }); - } else { - done(); - } + node.pool.end(function (err) { done(); }); }); } RED.nodes.registerType("MySQLdatabase",MySQLNode, { diff --git a/storage/mysql/package.json b/storage/mysql/package.json index 75916816..5a8804f7 100644 --- a/storage/mysql/package.json +++ b/storage/mysql/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-mysql", - "version" : "0.0.13", + "version" : "0.0.14", "description" : "A Node-RED node to read and write to a MySQL database", "dependencies" : { - "mysql" : "^2.12.0" + "mysql" : "^2.13.0" }, "repository" : { "type":"git", From 20f7cb0a3db15073a1a47a0cad515f8aa749ea87 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 26 Feb 2017 10:20:30 +0000 Subject: [PATCH 034/142] remove console logging from mysql --- storage/mysql/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/mysql/package.json b/storage/mysql/package.json index 5a8804f7..c8ee028b 100644 --- a/storage/mysql/package.json +++ b/storage/mysql/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-mysql", - "version" : "0.0.14", + "version" : "0.0.15", "description" : "A Node-RED node to read and write to a MySQL database", "dependencies" : { "mysql" : "^2.13.0" From 2f218740c6b971944ec114bd3722205728b3f093 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Thu, 9 Mar 2017 23:17:40 +0000 Subject: [PATCH 035/142] update What3Words node to latest library and fix credentials issue closes #285 --- parsers/what3words/package.json | 4 +-- parsers/what3words/w3w.tgz | Bin 15483 -> 0 bytes parsers/what3words/what3words.html | 36 ++++------------------- parsers/what3words/what3words.js | 44 +++-------------------------- 4 files changed, 11 insertions(+), 73 deletions(-) delete mode 100644 parsers/what3words/w3w.tgz diff --git a/parsers/what3words/package.json b/parsers/what3words/package.json index 360cbae7..6d50f509 100644 --- a/parsers/what3words/package.json +++ b/parsers/what3words/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-what3words", - "version" : "0.0.4", + "version" : "0.0.5", "description" : "A Node-RED node to convert locations to/from what3words", "dependencies" : { - "geo.what3words" : "0.0.2" + "geo.what3words" : "^2.0.0" }, "repository" : { "type":"git", diff --git a/parsers/what3words/w3w.tgz b/parsers/what3words/w3w.tgz deleted file mode 100644 index 7c5bc96c67d1888f730f12faaded27a543e391e1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15483 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 diff --git a/parsers/what3words/what3words.html b/parsers/what3words/what3words.html index 1cd1ab48..fbcd342f 100644 --- a/parsers/what3words/what3words.html +++ b/parsers/what3words/what3words.html @@ -1,8 +1,8 @@ diff --git a/parsers/what3words/what3words.js b/parsers/what3words/what3words.js index 8684bb8a..ea3c7af1 100644 --- a/parsers/what3words/what3words.js +++ b/parsers/what3words/what3words.js @@ -6,11 +6,9 @@ module.exports = function(RED) { var what3wordsNode = function(n) { RED.nodes.createNode(this, n); this.lang = n.lang || "en"; - var credentials = RED.nodes.getCredentials(n.id); - if ((credentials) && (credentials.hasOwnProperty("pushkey"))) { this.pushkey = credentials.pushkey; } - else { this.error("No what3words API key set"); } - this.w3w = new What3Words(this.pushkey); var node = this; + //if ( !node.credentials.apikey ) { this.error("No what3words API key set"); } + this.w3w = new What3Words(node.credentials.apikey); var w1 = /^\*\w{6,31}$/; var w3 = /^\w+\.\w+\.\w+$/; this.on("input", function(msg) { @@ -69,41 +67,7 @@ module.exports = function(RED) { else { node.warn("No useable data found. See info."); } }); } - RED.nodes.registerType("what3words", what3wordsNode); - - var querystring = require('querystring'); - - RED.httpAdmin.get('/what3words/:id', RED.auth.needsPermission('what3words.read'), function(req, res) { - var credentials = RED.nodes.getCredentials(req.params.id); - if (credentials) { - res.send(JSON.stringify({hasPassword:(credentials.pushkey && credentials.pushkey !== "")})); - } - else { - res.send(JSON.stringify({})); - } - }); - - RED.httpAdmin.delete('/what3words/:id', RED.auth.needsPermission('what3words.write'), function(req, res) { - RED.nodes.deleteCredentials(req.params.id); - res.send(200); - }); - - RED.httpAdmin.post('/what3words/:id', RED.auth.needsPermission('what3words.write'), function(req, res) { - var body = ""; - req.on('data', function(chunk) { - body += chunk; - }); - req.on('end', function() { - var newCreds = querystring.parse(body); - var credentials = RED.nodes.getCredentials(req.params.id) || {}; - if (newCreds.pushkey === "") { - delete credentials.pushkey; - } - else { - credentials.pushkey = newCreds.pushkey || credentials.pushkey; - } - RED.nodes.addCredentials(req.params.id, credentials); - res.send(200); - }); + RED.nodes.registerType("what3words", what3wordsNode, { + credentials: { apikey: {type: "password"} } }); } From a63df3c41d12398daf1c76b5af97deb92e433840 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Thu, 9 Mar 2017 23:18:22 +0000 Subject: [PATCH 036/142] tidy up some linting files --- .jscsrc | 20 +++++++++++++------- .jshintrc | 3 +++ Gruntfile.js | 16 ++-------------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.jscsrc b/.jscsrc index 16af03e3..58f11080 100644 --- a/.jscsrc +++ b/.jscsrc @@ -2,17 +2,23 @@ "fileExtensions": [ ".js", "jscs" ], "excludeFiles": [ "node_modules/**" ], "validateIndentation": 4, - "requireCurlyBraces": true, + "disallowKeywordsOnNewLine": [], "disallowMixedSpacesAndTabs": true, "disallowMultipleSpaces": {"allowEOLComments": true}, - "disallowKeywordsOnNewLine": [], + "disallowNewlineBeforeBlockStatements": true, + "disallowTabs": true, + "disallowTrailingWhitespace": true, + "requireCurlyBraces": true, //"requireKeywordsOnNewLine": ["else", "catch"], - "requireSpaceBeforeBlockStatements": 1, - //"requireSpaceBeforeObjectValues": false, //"requireSemicolons": true, + //"requireSpaceAfterBinaryOperators": true, + //"requireSpaceAfterComma": {"allExcept": ["trailing"]}, + "requireSpaceAfterKeywords": ["do","for","if","else","switch","case","try","while"], + "requireSpaceBeforeBlockStatements": 1, + "requireSpaceBeforeObjectValues": false, + "requireSpacesInForStatement": true, + "requireSpacesInFunction": { "beforeOpeningCurlyBrace": true }, //"validateParameterSeparator": ", ", //"validateQuoteMarks": false, - "requireSpaceAfterKeywords": ["do","for","if","else","switch","case","try","while"], - "maximumLineLength": 255, - "disallowTabs": true + "maximumLineLength": 220 } diff --git a/.jshintrc b/.jshintrc index db63befe..f03a6dc8 100644 --- a/.jshintrc +++ b/.jshintrc @@ -2,6 +2,9 @@ "asi": true, // allow missing semicolons "curly": true, // require braces "eqnull": true, // ignore ==null + //"eqeqeq": true, // enforce === + "freeze": true, // don't allow override + "indent": 4, // default indent of 4 "forin": true, // require property filtering in "for in" loops "immed": true, // require immediate functions to be wrapped in ( ) "nonbsp": true, // warn on unexpected whitespace breaking chars diff --git a/Gruntfile.js b/Gruntfile.js index fc388087..e516bfc5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -14,20 +14,7 @@ module.exports = function(grunt) { }, jshint: { options: { - jshintrc:".jshintrc", // Use external file - configured as below... - // http://www.jshint.com/docs/options/ - //"asi": true, // allow missing semicolons - //"curly": true, // require braces - //"eqnull": true, // ignore ==null - //"forin": true, // require property filtering in "for in" loops - //"immed": true, // require immediate functions to be wrapped in ( ) - //"nonbsp": true, // warn on unexpected whitespace breaking chars - ////"strict": true, // commented out for now as it causes 100s of warnings, but want to get there eventually - //"loopfunc": true, // allow functions to be defined in loops - //"sub": true, // don't warn that foo['bar'] should be written as foo.bar - ////"unused": true, // Check for unused functions - ////"forin":false, // turn off check for "for (x in y...)" - //"reporter": require('jshint-stylish') + jshintrc:".jshintrc", // Use external file }, all: { src: ['*/*.js','*/*/*.js'], @@ -53,6 +40,7 @@ module.exports = function(grunt) { options: { config: ".jscsrc", reporter: "inline" + //,fix: true } } }); From 9be654573934ddcaa455f991be9897b6806789d2 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 15 Mar 2017 09:58:14 +0000 Subject: [PATCH 037/142] Twitter node: remove auth requirement on oauth callback routes Fixes #253 --- social/twitter/27-twitter.html | 2 +- social/twitter/27-twitter.js | 4 ++-- social/twitter/package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/social/twitter/27-twitter.html b/social/twitter/27-twitter.html index 1f304a0e..65f7a77b 100644 --- a/social/twitter/27-twitter.html +++ b/social/twitter/27-twitter.html @@ -34,7 +34,7 @@ } var callback = encodeURIComponent(location.protocol+"//"+location.hostname+":"+location.port+pathname+"twitter-credentials/"+twitterConfigNodeId+"/auth/callback"); $("#node-config-dialog-ok").button("disable"); - $("#node-config-twitter-row").html(''); + $("#node-config-twitter-row").html(''); $("#node-config-twitter-start").click(function() { twitterConfigNodeIntervalId = window.setTimeout(pollTwitterCredentials,2000); }); diff --git a/social/twitter/27-twitter.js b/social/twitter/27-twitter.js index b3dbbfee..aa9c17f9 100644 --- a/social/twitter/27-twitter.js +++ b/social/twitter/27-twitter.js @@ -459,7 +459,7 @@ module.exports = function(RED) { "HMAC-SHA1" ); - RED.httpAdmin.get('/twitter-credentials/:id/auth', RED.auth.needsPermission('twitter.read'), function(req, res) { + RED.httpAdmin.get('/twitter-credentials/:id/auth', function(req, res) { var credentials = {}; oa.getOAuthRequestToken({ oauth_callback: req.query.callback @@ -478,7 +478,7 @@ module.exports = function(RED) { }); }); - RED.httpAdmin.get('/twitter-credentials/:id/auth/callback', RED.auth.needsPermission('twitter.read'), function(req, res, next) { + RED.httpAdmin.get('/twitter-credentials/:id/auth/callback', function(req, res, next) { var credentials = RED.nodes.getCredentials(req.params.id); credentials.oauth_verifier = req.query.oauth_verifier; diff --git a/social/twitter/package.json b/social/twitter/package.json index 5fb4ac7c..b96f7999 100644 --- a/social/twitter/package.json +++ b/social/twitter/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-twitter", - "version" : "0.1.9", + "version" : "0.1.10", "description" : "A Node-RED node to talk to Twitter", "dependencies" : { "twitter-ng": "0.6.2", From 5a07f29ebdfcc5b7a3a8d1d0987c37e438b023a7 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 17 Mar 2017 13:45:22 +0000 Subject: [PATCH 038/142] remove invalid error parameter from mysql callback --- storage/mysql/68-mysql.js | 2 +- storage/mysql/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/mysql/68-mysql.js b/storage/mysql/68-mysql.js index e5f07f57..a3362fa5 100644 --- a/storage/mysql/68-mysql.js +++ b/storage/mysql/68-mysql.js @@ -21,7 +21,7 @@ module.exports = function(RED) { node.connection.query("SELECT version();", [], function(err, rows) { if (err) { node.connection.release(); - node.error(err,msg); + node.error(err); node.status({fill:"red",shape:"ring",text:"Bad Ping"}); doConnect(); } diff --git a/storage/mysql/package.json b/storage/mysql/package.json index c8ee028b..8de0fc77 100644 --- a/storage/mysql/package.json +++ b/storage/mysql/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-mysql", - "version" : "0.0.15", + "version" : "0.0.16", "description" : "A Node-RED node to read and write to a MySQL database", "dependencies" : { "mysql" : "^2.13.0" From 1ca1492bc447d886fc3256cbfea96eccc9b5bb6b Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 29 Mar 2017 14:13:23 +0100 Subject: [PATCH 039/142] typo in sensehat info, R->F --- hardware/sensehat/package.json | 2 +- hardware/sensehat/sensehat.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/sensehat/package.json b/hardware/sensehat/package.json index c43d641e..51d6b2f4 100644 --- a/hardware/sensehat/package.json +++ b/hardware/sensehat/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pi-sense-hat", - "version" : "0.0.13", + "version" : "0.0.14", "description" : "A Node-RED node to interact with a Raspberry Pi Sense HAT", "repository" : { "type":"git", diff --git a/hardware/sensehat/sensehat.html b/hardware/sensehat/sensehat.html index 0d1abb53..a7ec2d1e 100644 --- a/hardware/sensehat/sensehat.html +++ b/hardware/sensehat/sensehat.html @@ -102,7 +102,7 @@ be sent in a single message by separating them with newline (\n) characters.

angle must be 0, 90, 180 or 270.

Flip the screen

-

Format: R<axis>

+

Format: F<axis>

axis must be either H or V to flip on the horizontal or vertical axis respectively.

From d86cf60b063930fc7ab1c2ab2917350fa55b50b3 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 29 Mar 2017 17:01:53 +0100 Subject: [PATCH 040/142] bump sensortag pre-req --- hardware/sensorTag/package.json | 4 ++-- hardware/sensorTag/scripts/checkplatform.js | 25 +++++++++++---------- hardware/sensorTag/scripts/pibt.sh | 3 +-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hardware/sensorTag/package.json b/hardware/sensorTag/package.json index 356cf909..cee98612 100644 --- a/hardware/sensorTag/package.json +++ b/hardware/sensorTag/package.json @@ -1,7 +1,7 @@ { "name": "node-red-node-sensortag", "description": "A Node-RED node to read data from a TI SensorTag", - "version": "0.0.18", + "version": "0.0.19", "keywords": [ "node-red", "sensortag", @@ -9,7 +9,7 @@ "Ti CC2541" ], "dependencies": { - "sensortag": "~1.2.0" + "sensortag": "~1.3.0" }, "scripts" : { "postinstall" : "node scripts/checkplatform.js pibt.sh" diff --git a/hardware/sensorTag/scripts/checkplatform.js b/hardware/sensorTag/scripts/checkplatform.js index 59b8cf1e..abd58cb3 100644 --- a/hardware/sensorTag/scripts/checkplatform.js +++ b/hardware/sensorTag/scripts/checkplatform.js @@ -1,17 +1,18 @@ var spawn = require('child_process').spawn; if (process.argv.length === 3) { - var command = process.argv[2]; + var command = process.argv[2]; - if (process.platform === 'linux') { - var dir = __dirname; - var script = spawn(dir + "/" + command); - script.on('close',function(code){ - process.exit(code); - }); - } else { - process.exit(0); - } + if (process.platform === 'linux') { + var dir = __dirname; + var script = spawn(dir + "/" + command); + script.on('close',function(code) { + process.exit(code); + }); + } + else { + process.exit(0); + } } else { - process.exit(0); -} \ No newline at end of file + process.exit(0); +} diff --git a/hardware/sensorTag/scripts/pibt.sh b/hardware/sensorTag/scripts/pibt.sh index d4acebbc..9564459d 100755 --- a/hardware/sensorTag/scripts/pibt.sh +++ b/hardware/sensorTag/scripts/pibt.sh @@ -1,4 +1,3 @@ #!/bin/bash #sudo apt-get install libbluetooth-dev libudev-dev pi-bluetooth - sudo setcap cap_net_raw+eip $(eval readlink -f `which node`) - +sudo setcap cap_net_raw+eip $(eval readlink -f `which node`) From 47520ea5aab165113c991e79f7a8c288a06a3a8c Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 3 Apr 2017 18:02:17 +0100 Subject: [PATCH 041/142] email node - put description before attached file. --- social/email/61-email.js | 5 +++-- social/email/locales/en-US/61-email.json | 7 ++----- social/email/package.json | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/social/email/61-email.js b/social/email/61-email.js index b21f1e9e..d22ced3a 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -90,12 +90,13 @@ module.exports = function(RED) { if ((msg.payload[0] === 0x89)&&(msg.payload[1] === 0x50)) { fe = "png"; } //4E msg.filename = "attachment."+fe; } - sendopts.attachments = [ { content: msg.payload, filename:(msg.filename.replace(/^.*[\\\/]/, '') || "file.bin") } ]; + var fname = msg.filename.replace(/^.*[\\\/]/, '') || "file.bin"; + sendopts.attachments = [ { content:msg.payload, filename:fname } ]; if (msg.hasOwnProperty("headers") && msg.headers.hasOwnProperty("content-type")) { sendopts.attachments[0].contentType = msg.headers["content-type"]; } // Create some body text.. - sendopts.text = RED._("email.default-message",{filename:(msg.filename.replace(/^.*[\\\/]/, '') || "file.bin"),description:(msg.hasOwnProperty("description") ? "\n\n"+msg.description : "")}); + sendopts.text = RED._("email.default-message",{filename:fname, description:(msg.description||"")}); } else { var payload = RED.util.ensureString(msg.payload); diff --git a/social/email/locales/en-US/61-email.json b/social/email/locales/en-US/61-email.json index c85ffbfd..3bbcf71f 100644 --- a/social/email/locales/en-US/61-email.json +++ b/social/email/locales/en-US/61-email.json @@ -13,10 +13,7 @@ "useSSL": "Use SSL?", "disposition": "Disposition" }, - - "default-message": "Your file from Node-RED is attached: __filename__ __description__", - - + "default-message": "__description__\n\nFile from Node-RED is attached: __filename__", "tip": { "cred": "Note: Copied credentials from global emailkeys.js file.", "recent": "Tip: Only retrieves the single most recent email." @@ -39,7 +36,7 @@ "nopassword": "No e-mail password set", "nocredentials": "No Email credentials found. See info panel.", "nosmtptransport": "No SMTP transport. See info panel.", - "nopayload": "No payload to send", + "nopayload": "No payload to send", "fetchfail": "Failed to fetch folder: __folder__", "messageerror": "Fetch message error: __error__" } diff --git a/social/email/package.json b/social/email/package.json index e1c9258d..60758e8d 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-email", - "version": "0.1.21", + "version": "0.1.22", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0", From a06ad8f1a743f347baa18de74d97a8aeb34b62ce Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 3 Apr 2017 19:51:49 +0100 Subject: [PATCH 042/142] line up discovery node wording in docs to close #290 Thanks @ukmoose --- README.md | 2 +- io/mdns/README.md | 4 ++-- io/mdns/package.json | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e78ad545..cde101f2 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ Copyright 2013, 2016 IBM Corp. under [the Apache 2.0 license](LICENSE). **node-red-node-ping** - *[88-ping](io/ping)* - Pings a machine and returns the trip time in mS. Returns false if no response received within 3 seconds, or if the host is unresolveable. Default ping is every 20 seconds but can be configured. -**node-red-node-mdns** - *[mdns](io/mdns)* - discovers other Avahi/Bonjour services on the network. +**node-red-node-discovery** - *[mdns](io/mdns)* - discovers other Avahi/Bonjour services on the network. **node-red-node-mqlight** - *[mqlight](io/mqlight)* - Adds nodes to send and receive using MQlight. diff --git a/io/mdns/README.md b/io/mdns/README.md index 2c97055b..e494b886 100644 --- a/io/mdns/README.md +++ b/io/mdns/README.md @@ -1,5 +1,5 @@ -node-red-node-discover -====================== +node-red-node-discovery +======================= A Node-RED node that uses Bonjour / Avahi to discover local network services such as iTunes libraries, printers, etc. diff --git a/io/mdns/package.json b/io/mdns/package.json index beb14f9b..23118ff0 100644 --- a/io/mdns/package.json +++ b/io/mdns/package.json @@ -1,16 +1,16 @@ { "name" : "node-red-node-discovery", - "version" : "0.0.13", + "version" : "0.0.14", "description" : "A Node-RED node that uses Bonjour / Avahi to discover nearby services.", "dependencies" : { - "mdns" : "2.2.*" + "mdns" : "2.3.*" }, "repository" : { "type":"git", "url":"https://github.com/node-red/node-red-nodes/tree/master/io/mdns" }, "license": "Apache-2.0", - "keywords": [ "node-red", "mdns", "avahi", "bonjour" ], + "keywords": [ "node-red", "mdns", "avahi", "bonjour", "discovery" ], "node-red" : { "nodes" : { "discovery": "mdns.js" From 3f4261f3b768764a928715139e4970ca9454ce92 Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Thu, 6 Apr 2017 11:21:33 +0100 Subject: [PATCH 043/142] Big WeMo node update (#295) * Reduce resubscription time Halve the resubscrciption timeout to make sure event subscriptions get renewed * Big Update Includes: - New lookup node to check state of a device - Fix dimming control for lights - Fix light group control - Set the node label to match the device name - The event now includes the text description of the light capability * Fix groups properly * Fix travis error with comparitor * Bump node-ssdp version --- hardware/wemo/README.md | 2 +- hardware/wemo/WeMoNG.html | 87 +++++++++++++-- hardware/wemo/WeMoNG.js | 122 ++++++++++++++++++---- hardware/wemo/lib/wemo.js | 209 +++++++++++++++++++++++++++++++++---- hardware/wemo/package.json | 7 +- 5 files changed, 378 insertions(+), 49 deletions(-) diff --git a/hardware/wemo/README.md b/hardware/wemo/README.md index 3f5fe7f1..dd49ff71 100644 --- a/hardware/wemo/README.md +++ b/hardware/wemo/README.md @@ -24,7 +24,7 @@ The node accecpts the following inputs * Strings on/off * integers 1/0 * boolean true/false - * an Object like this (lights only, coming soon) + * an Object like this (lights only & color control is still work in the progress) ``` { state: 1, diff --git a/hardware/wemo/WeMoNG.html b/hardware/wemo/WeMoNG.html index f0e8e11d..b9cec3ab 100644 --- a/hardware/wemo/WeMoNG.html +++ b/hardware/wemo/WeMoNG.html @@ -29,8 +29,9 @@
  • Light Groups
  • Motion Detector
  • -

    Sockets will generate msg.payload with values of 0/1 for off or on, all other - types will return an object like this:

    +

    Sockets will generate msg.payload with values of 0/1/8 for off or on + (8 is on but at standby load for insight sockets), lightswill return an + object like this:

       {
         name: 'Bedroom light',
    @@ -44,6 +45,8 @@
       
    • 10006 - on/off
    • 10008 - brightness
    • +
    • 10300 - color
    • +
    • 30301 - color temperature
    @@ -53,7 +56,8 @@ defaults: { // defines the editable properties of the node name: {value:""}, // along with default values. topic: {value:"wemo", required: true}, - device: {value:"", type: "wemo-dev"} + device: {value:"", type: "wemo-dev"}, + label: {value:""} }, color: "LawnGreen", inputs:0, // set the number of inputs - only 0 or 1 @@ -61,10 +65,17 @@ // set the icon (held in icons dir below where you save the node) icon: "belkin.png", // saved in icons/myicon.png label: function() { // sets the default label contents - return this.name||"wemo"; + if (this.name){ + return this.name; + } else { + return this.label||"wemo"; + } }, labelStyle: function() { // sets the class to apply to the label return this.name?"node_label_italic":""; + }, + oneditsave: function(){ + this.label = $('#node-input-device option:selected').text(); } }); @@ -106,6 +117,7 @@ temperature: 25000 }
    +

    color control is still a work in progress, but the rest should work

    + + + + + + diff --git a/hardware/wemo/WeMoNG.js b/hardware/wemo/WeMoNG.js index 827b91ab..96ccbf7c 100644 --- a/hardware/wemo/WeMoNG.js +++ b/hardware/wemo/WeMoNG.js @@ -45,7 +45,7 @@ module.exports = function(RED) { console.log('problem with resubscription %s - %s', res.statusCode, res.statusMessage); console.log('opts - %s', util.inspect(reSubOptions)); console.log('dev - %s', util.inspect(dev)); - delete subscriptions[dev]; + delete subscriptions[subs[s]]; delete sub2dev[sub.sid]; subscribe({dev: subs[s]}); } @@ -58,7 +58,7 @@ module.exports = function(RED) { resub_request.on('error', function() { //console.log("failed to resubscribe to %s", dev.name ); //need to find a way to resubsribe - delete subscriptions[dev]; + delete subscriptions[subs[s]]; delete sub2dev[sub.sid]; subscribe({dev: subs[s]}); }); @@ -231,6 +231,7 @@ module.exports = function(RED) { } var on = 0; + var capability = '10006'; if (typeof msg.payload === 'string') { if (msg.payload == 'on' || msg.payload == '1' || msg.payload == 'true') { on = 1; @@ -238,44 +239,53 @@ module.exports = function(RED) { else if (msg.payload === 'toggle') { on = 2; } - } - else if (typeof msg.payload === 'number') { + } else if (typeof msg.payload === 'number') { if (msg.payload >= 0 && msg.payload < 3) { on = msg.payload; } - } - else if (typeof msg.payload === 'object') { + } else if (typeof msg.payload === 'object') { //object need to get complicated here - if (msg.payload.state && typeof msg.payload.state === 'number') { + if (msg.payload.hasOwnProperty('state') && typeof msg.payload.state === 'number') { if (dev.type === 'socket') { - if (msg.payload >= 0 && msg.payload < 2) { + if (msg.payload.state >= 0 && msg.payload.state < 2) { on = msg.payload.state; } } else if (dev.type === 'light' || dev.type === 'group') { - if (msg.payload >= 0 && msg.payload < 3) { - on = msg.payload.state; + // if (msg.payload.state >= 0 && msg.payload.state < 3) { + // on = msg.payload.state; + // } + var keys = Object.keys(msg.payload); + var caps = []; + var states = []; + for (var i=0; i 0) { + capability = caps.join(','); + on = states.join(','); } } } - } - else if (typeof msg.payload === 'boolean') { + } else if (typeof msg.payload === 'boolean') { if (msg.payload) { on = 1; } } - if (dev.type === 'socket') { + if (dev.type == 'socket') { //console.log("socket"); wemo.toggleSocket(dev, on); - } - else if (dev.type === 'light`') { - //console.log("light"); - wemo.setStatus(dev,'10006', on); - } - else { - console.log('group'); - wemo.setStatus(dev, '10006', on); + } else if (dev.type === 'light') { + wemo.setStatus(dev,capability, on); + } else { + //console.log('group'); + wemo.setStatus(dev, capability, on); } }); }; @@ -366,6 +376,76 @@ module.exports = function(RED) { }; RED.nodes.registerType('wemo in', wemoNGEvent); + var wemoNGLookup = function(n){ + RED.nodes.createNode(this,n); + var node = this; + node.device = n.device; + node.name = n.name; + node.dev = RED.nodes.getNode(node.device).device; + node.status({fill: 'red',shape: 'dot',text: 'searching'}); + + if (!wemo.get(node.dev)) { + wemo.on('discovered', function(d) { + if (node.dev === d) { + node.status({fill: 'green',shape: 'dot',text: 'found'}); + } + }); + } + else { + node.status({fill: 'green',shape: 'dot',text: 'found'}); + } + + node.on('input', function(msg) { + var dev = wemo.get(node.dev); + + if (!dev) { + //need to show that dev not currently found + console.log('no device found'); + return; + } + + //console.log(dev.type); + if (dev.type === 'light' || dev.type === 'group') { + //console.log("light"); + wemo.getLightStatus(dev) + .then(function(status){ + // if (status.available) { + var caps = status.capabilities.split(','); + var vals = status.state.split(','); + for (var i=0; i', '', ''].join('\n'); - var postbodyfooter = ['', '' ].join('\n'); - var getenddevs = {}; getenddevs.path = '/upnp/control/bridge1'; getenddevs.action = '"urn:Belkin:service:bridge:1#GetEndDevices"'; @@ -45,6 +44,58 @@ getcapabilities.body = [ postbodyfooter ].join('\n'); +var getDevStatus = { + method: 'POST', + path: '/upnp/control/bridge1', + action: '"urn:Belkin:service:bridge:1#GetDeviceStatus"', + body: [ + postbodyheader, + '', + '%s', + '', + postbodyfooter + ].join('\n') +}; + +var getSocketState = { + method: 'POST', + path: '/upnp/control/basicevent1', + action: '"urn:Belkin:service:basicevent:1#GetBinaryState"', + body: [ + postbodyheader, + '', + '', + postbodyfooter + ].join('\n') +} + + +var setdevstatus = {}; +setdevstatus.path = '/upnp/control/bridge1'; +setdevstatus.action = '"urn:Belkin:service:bridge:1#SetDeviceStatus"'; +setdevstatus.body = [ + postbodyheader, + '', + '', + '<?xml version="1.0" encoding="UTF-8"?><DeviceStatus><IsGroupAction>%s</IsGroupAction><DeviceID available="YES">%s</DeviceID><CapabilityID>%s</CapabilityID><CapabilityValue>%s</CapabilityValue></DeviceStatus>', + '', + '', + postbodyfooter +].join('\n'); + +var capabilityMap = { + '10006': 'state', + '10008': 'dim', + '10300': 'color', + '30301': 'temperature' + }; + +var reverseCapabilityMap = { + 'state': '10006', + 'dim': '10008', + 'color': '10300', + 'temperature': '30301' + }; var WeMoNG = function () { this.devices = {}; @@ -52,6 +103,10 @@ var WeMoNG = function () { this._interval; events.EventEmitter.call(this); + this.capabilityMap = capabilityMap; + + this.reverseCapabilityMap = reverseCapabilityMap; + } util.inherits(WeMoNG, events.EventEmitter); @@ -68,7 +123,7 @@ WeMoNG.prototype.start = function start() { request.get(location.href, function(err, res, xml) { if (!err) { xml2js.parseString(xml, function(err, json) { - if (!err) { + if (!err && json) { var device = { ip: location.hostname, port: location.port }; for (var key in json.root.device[0]) { device[key] = json.root.device[0][key][0]; @@ -248,20 +303,114 @@ WeMoNG.prototype.toggleSocket = function toggleSocket(socket, on) { post_request.end(); } -WeMoNG.prototype.setStatus = function setStatus(light, capability, value) { - var setdevstatus = {}; - setdevstatus.path = '/upnp/control/bridge1'; - setdevstatus.action = '"urn:Belkin:service:bridge:1#SetDeviceStatus"'; - setdevstatus.body = [ - postbodyheader, - '', - '', - '<?xml version="1.0" encoding="UTF-8"?><DeviceStatus><IsGroupAction>NO</IsGroupAction><DeviceID available="YES">%s</DeviceID><CapabilityID>%s</CapabilityID><CapabilityValue>%s</CapabilityValue></DeviceStatus>', - '', - '', - postbodyfooter - ].join('\n'); +WeMoNG.prototype.getSocketStatus = function getSocketStatus(socket) { + var postoptions = { + host: socket.ip, + port: socket.port, + path: getSocketState.path, + method: getSocketState.method, + headers: { + 'SOAPACTION': getSocketState.action, + 'Content-Type': 'text/xml; charset="utf-8"', + 'Accept': '' + } + } + var def = Q.defer(); + + var post_request = http.request(postoptions, function(res){ + var data = ""; + res.setEncoding('utf8'); + res.on('data', function(chunk){ + data += chunk; + }); + + res.on('end', function(){ + xml2js.parseString(data, function(err, result){ + if (!err) { + var status = result["s:Envelope"]["s:Body"][0]["u:GetBinaryStateResponse"][0]["BinaryState"][0]; + status = parseInt(status); + def.resolve(status); + } + }); + }); + }); + + post_request.on('error', function (e) { + console.log(e); + console.log("%j", postoptions); + def.reject(); + }); + + post_request.write(getSocketState.body); + post_request.end(); + + return def.promise; +}; + +WeMoNG.prototype.getLightStatus = function getLightStatus(light) { + var postoptions = { + host: light.ip, + port: light.port, + path: getDevStatus.path, + method: getDevStatus.method, + headers: { + 'SOAPACTION': getDevStatus.action, + 'Content-Type': 'text/xml; charset="utf-8"', + 'Accept': '' + } + }; + + var def = Q.defer(); + + var post_request = http.request(postoptions, function(res){ + var data = ""; + res.setEncoding('utf8'); + res.on('data', function(chunk) { + data += chunk; + }); + + res.on('end', function() { + xml2js.parseString(data, function(err, result){ + if(!err) { + if (result["s:Envelope"]) { + var status = result["s:Envelope"]["s:Body"][0]["u:GetDeviceStatusResponse"][0].DeviceStatusList[0]; + xml2js.parseString(status, function(err,result2){ + if (!err) { + var available = result2['DeviceStatusList']['DeviceStatus'][0]['DeviceID'][0]['$'].available === 'YES'; + var state = result2['DeviceStatusList']['DeviceStatus'][0]['CapabilityValue'][0]; + var capabilities = result2['DeviceStatusList']['DeviceStatus'][0]['CapabilityID'][0]; + var obj = { + available: available, + state: state, + capabilities: capabilities + }; + def.resolve(obj); + } else { + console.log("err"); + } + }); + } + } else { + console.log("err"); + } + }); + }); + }); + + post_request.on('error', function (e) { + console.log(e); + console.log("%j", postoptions); + def.reject(); + }); + + post_request.write(util.format(getDevStatus.body, light.id)); + post_request.end(); + + return def.promise; +} + +WeMoNG.prototype.setStatus = function setStatus(light, capability, value) { var postoptions = { host: light.ip, port: light.port, @@ -269,7 +418,7 @@ WeMoNG.prototype.setStatus = function setStatus(light, capability, value) { method: 'POST', headers: { 'SOAPACTION': setdevstatus.action, - 'Content-Type': 'text/xml; charset="utf-8"', + 'Content-Type': 'text/xml; charset="utf-8"', 'Accept': '' } }; @@ -293,7 +442,7 @@ WeMoNG.prototype.setStatus = function setStatus(light, capability, value) { //console.log(util.format(setdevstatus.body, light.id, capability, value)); - post_request.write(util.format(setdevstatus.body, light.id, capability, value)); + post_request.write(util.format(setdevstatus.body, light.type === 'light'?'NO':'YES',light.id, capability, value)); post_request.end(); } @@ -312,6 +461,7 @@ WeMoNG.prototype.parseEvent = function parseEvent(evt) { if (!err && res != null) { msg.id = res['StateEvent']['DeviceID'][0]['_']; msg.capability = res['StateEvent']['CapabilityId'][0]; + msg.capabilityName = capabilityMap[msg.capability]; msg.value = res['StateEvent']['Value'][0]; def.resolve(msg); } @@ -364,4 +514,27 @@ WeMoNG.prototype.rgb2xy = function rgb2xy(red, green, blue) { ]; }; +//http://stackoverflow.com/questions/22894498/philips-hue-convert-xy-from-api-to-hex-or-rgb +WeMoNG.prototype.xy2rgb = function xy2rgb(x,y,bri) { + z = 1.0 - x - y; + Y = bri / 255.0; // Brightness of lamp + X = (Y / y) * x; + Z = (Y / y) * z; + r = X * 1.612 - Y * 0.203 - Z * 0.302; + g = -X * 0.509 + Y * 1.412 + Z * 0.066; + b = X * 0.026 - Y * 0.072 + Z * 0.962; + r = r <= 0.0031308 ? 12.92 * r : (1.0 + 0.055) * Math.pow(r, (1.0 / 2.4)) - 0.055; + g = g <= 0.0031308 ? 12.92 * g : (1.0 + 0.055) * Math.pow(g, (1.0 / 2.4)) - 0.055; + b = b <= 0.0031308 ? 12.92 * b : (1.0 + 0.055) * Math.pow(b, (1.0 / 2.4)) - 0.055; + maxValue = Math.max(r,g,b); + r /= maxValue; + g /= maxValue; + b /= maxValue; + r = r * 255; if (r < 0) { r = 255 }; + g = g * 255; if (g < 0) { g = 255 }; + b = b * 255; if (b < 0) { b = 255 }; + + return [r,g,b]; +}; + module.exports = WeMoNG; diff --git a/hardware/wemo/package.json b/hardware/wemo/package.json index f6632636..9ba06250 100644 --- a/hardware/wemo/package.json +++ b/hardware/wemo/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-wemo", - "version": "0.1.10", + "version": "0.1.11", "description": "Input and Output nodes for Belkin WeMo devices", "repository": "https://github.com/node-red/node-red-nodes/tree/master/hardware", "main": "WeMoNG.js", @@ -9,7 +9,8 @@ }, "keywords": [ "node-red", - "wemo" + "wemo", + "belkin" ], "author": { "email": "hardillb@gmail.com", @@ -18,7 +19,7 @@ }, "license": "APACHE-2.0", "dependencies": { - "node-ssdp": "~2.6.3", + "node-ssdp": "~2.9.1", "request": "~2.74.0", "xml2js": "~0.4.13", "util": "~0.10.3", From 100cf9a38d18def0f549f47822ca128eb484ef34 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 12 Apr 2017 09:21:05 +0100 Subject: [PATCH 044/142] bump levels and mins dependancies --- io/mdns/package.json | 4 ++-- storage/leveldb/package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/io/mdns/package.json b/io/mdns/package.json index 23118ff0..20ea0e48 100644 --- a/io/mdns/package.json +++ b/io/mdns/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-discovery", - "version" : "0.0.14", + "version" : "0.0.15", "description" : "A Node-RED node that uses Bonjour / Avahi to discover nearby services.", "dependencies" : { - "mdns" : "2.3.*" + "mdns" : "^2.3.3" }, "repository" : { "type":"git", diff --git a/storage/leveldb/package.json b/storage/leveldb/package.json index 059292c8..f37770d6 100644 --- a/storage/leveldb/package.json +++ b/storage/leveldb/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-leveldb", - "version" : "0.0.7", + "version" : "0.0.8", "description" : "A Node-RED node to read and write to a LevelDB database", "dependencies" : { - "level" : "1.0.0" + "level" : "^1.6.0" }, "repository" : { "type":"git", From a3e69d1a2f60a86566f8c6d6c8d5f81c2f073025 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 12 Apr 2017 09:21:26 +0100 Subject: [PATCH 045/142] update travis to remove v7 allow failure --- .travis.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 38692698..c07adaca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,11 +9,6 @@ addons: packages: - g++-4.8 - gcc-4.8 -matrix: - allow_failures: - - node_js: "7" -before_install: - - npm install -g npm@latest-2 node_js: - "7" - "6" From 8abfd4841def7e917ce3c619548beb566488f7d6 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 12 Apr 2017 09:35:26 +0100 Subject: [PATCH 046/142] pin mins pre-req to old working level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit new one breaks with a deprecation… need to look for another library --- io/mdns/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io/mdns/package.json b/io/mdns/package.json index 20ea0e48..8cdf29ca 100644 --- a/io/mdns/package.json +++ b/io/mdns/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-discovery", - "version" : "0.0.15", + "version" : "0.0.16", "description" : "A Node-RED node that uses Bonjour / Avahi to discover nearby services.", "dependencies" : { - "mdns" : "^2.3.3" + "mdns" : "2.3.2" }, "repository" : { "type":"git", From 38d16b8a4d6a2618b08b737a9c2860ee8cbb1134 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 12 Apr 2017 13:32:08 +0100 Subject: [PATCH 047/142] Tidy up listing for some nodes. No functional changes to make listing task pass --- .jscsrc | 2 +- Gruntfile.js | 2 +- hardware/sensehat/sensehat.js | 10 +++++----- hardware/sensehatsim/sensehatsim.js | 14 +++++++------- hardware/wemo/WeMoNG.js | 8 ++++---- package.json | 22 +++++++++++----------- social/pushbullet/57-pushbullet.js | 2 +- social/twitter/27-twitter.js | 4 ++-- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.jscsrc b/.jscsrc index 58f11080..28abb3b7 100644 --- a/.jscsrc +++ b/.jscsrc @@ -20,5 +20,5 @@ "requireSpacesInFunction": { "beforeOpeningCurlyBrace": true }, //"validateParameterSeparator": ", ", //"validateQuoteMarks": false, - "maximumLineLength": 220 + "maximumLineLength": 280 } diff --git a/Gruntfile.js b/Gruntfile.js index e516bfc5..5e5d24f9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -29,7 +29,7 @@ module.exports = function(grunt) { }, }, inlinelint: { - html: ['*/*/*.html'], + html: ['*/*/*.html', '!node_modules/*'], options: { jshintrc: ".jshintrc" //,reporter: require('jshint-stylish') diff --git a/hardware/sensehat/sensehat.js b/hardware/sensehat/sensehat.js index f2dfec03..67179233 100644 --- a/hardware/sensehat/sensehat.js +++ b/hardware/sensehat/sensehat.js @@ -52,7 +52,7 @@ module.exports = function(RED) { } buffer = lines.pop(); var m,msg; - for (var i=0;i 0) { var pixels = {}; var rules = []; - for (i=expanded.length-1;i>=0;i--) { + for (i=expanded.length-1; i>=0; i--) { var rule = expanded[i]; if (!pixels[rule[0]+","+rule[1]]) { rules.unshift(rule.join(",")); diff --git a/hardware/sensehatsim/sensehatsim.js b/hardware/sensehatsim/sensehatsim.js index c667964a..bcdb8cd6 100644 --- a/hardware/sensehatsim/sensehatsim.js +++ b/hardware/sensehatsim/sensehatsim.js @@ -42,9 +42,9 @@ module.exports = function(RED) { currentFlipV = false; currentRotation = "R0"; currentDisplay = []; - for (var y=0;y<8;y++) { + for (var y=0; y<8; y++) { currentDisplay.push([]); - for (var x=0;x<8;x++) { + for (var x=0; x<8; x++) { currentDisplay[y].push('0,0,0'); } } @@ -80,8 +80,8 @@ module.exports = function(RED) { socket.send("FH"); } var cmd = ""; - for (var y=0;y<8;y++) { - for (var x=0;x<8;x++) { + for (var y=0; y<8; y++) { + for (var x=0; x<8; x++) { cmd += ","+x+","+y+","+currentDisplay[y][x]; } } @@ -110,7 +110,7 @@ module.exports = function(RED) { topic: "joystick", payload: {key: KEY_MAP[m[1]], state: Number(m[2])} } - for (var j=0;j 0) { var pixels = {}; var rules = []; - for (i=expanded.length-1;i>=0;i--) { + for (i=expanded.length-1; i>=0; i--) { var rule = expanded[i]; if (!pixels[rule[0]+","+rule[1]]) { rules.unshift(rule.join(",")); diff --git a/hardware/wemo/WeMoNG.js b/hardware/wemo/WeMoNG.js index 96ccbf7c..1676fb94 100644 --- a/hardware/wemo/WeMoNG.js +++ b/hardware/wemo/WeMoNG.js @@ -283,7 +283,7 @@ module.exports = function(RED) { wemo.toggleSocket(dev, on); } else if (dev.type === 'light') { wemo.setStatus(dev,capability, on); - } else { + } else { //console.log('group'); wemo.setStatus(dev, capability, on); } @@ -376,7 +376,7 @@ module.exports = function(RED) { }; RED.nodes.registerType('wemo in', wemoNGEvent); - var wemoNGLookup = function(n){ + var wemoNGLookup = function(n) { RED.nodes.createNode(this,n); var node = this; node.device = n.device; @@ -408,7 +408,7 @@ module.exports = function(RED) { if (dev.type === 'light' || dev.type === 'group') { //console.log("light"); wemo.getLightStatus(dev) - .then(function(status){ + .then(function(status) { // if (status.available) { var caps = status.capabilities.split(','); var vals = status.state.split(','); @@ -430,7 +430,7 @@ module.exports = function(RED) { console.log("socket"); //socket wemo.getSocketStatus(dev) - .then(function(status){ + .then(function(status) { msg.payload = { state: status }; diff --git a/package.json b/package.json index a6cbec9e..c747b0ca 100644 --- a/package.json +++ b/package.json @@ -17,24 +17,24 @@ "Node-RED", "nodes", "iot", "ibm", "flow" ], "devDependencies": { - "grunt": "^0.4.5", - "grunt-simple-mocha": "^0.4.1", - "grunt-contrib-jshint": "^1.0.0", - "grunt-lint-inline": "^0.4.4", + "grunt": "^1.0.1", + "grunt-contrib-jshint": "^1.1.0", "grunt-jscs": "^2.8.0", + "grunt-lint-inline": "^1.0.0", + "grunt-simple-mocha": "^0.4.1", "mocha": "^2.4.5", - "should": "^8.3.1", - "sinon": "^1.17.3", + "should": "^8.4.0", + "sinon": "^1.17.7", "supertest": "^1.2.0", - "proxyquire": "^1.7.10", - "pushbullet": "^1.4.3", - "when": "^3.7.7", + "proxyquire": "^1.7.11", + "pushbullet": "^2.0.0", + "when": "^3.7.8", "exif": "^0.6.0", "ngeohash": "^0.6.0", "nodemailer" : "^1.11.0", "poplib" : "^0.1.7", - "mailparser" : "^0.6.1", - "imap" : "^0.8.18", + "mailparser" : "^0.6.2", + "imap" : "^0.8.19", "msgpack-js": "^0.3.0" }, "engines": { diff --git a/social/pushbullet/57-pushbullet.js b/social/pushbullet/57-pushbullet.js index 7b7bd60a..ec5ee553 100644 --- a/social/pushbullet/57-pushbullet.js +++ b/social/pushbullet/57-pushbullet.js @@ -165,7 +165,7 @@ module.exports = function(RED) { resolve(last); return onError(err); } - for (var i=0;i=0;t-=1) { + for (var t=cb.length-1; t>=0; t-=1) { var tweet = cb[t]; var where = tweet.sender.location; var la = tweet.lang || tweet.sender.lang; @@ -370,7 +370,7 @@ module.exports = function(RED) { this.stream.destroy(); } if (this.poll_ids) { - for (var i=0;i Date: Wed, 12 Apr 2017 13:44:04 +0100 Subject: [PATCH 048/142] another kick to get node_modules ignored by lint --- Gruntfile.js | 2 +- package.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 5e5d24f9..821f97e1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -29,7 +29,7 @@ module.exports = function(grunt) { }, }, inlinelint: { - html: ['*/*/*.html', '!node_modules/*'], + html: ['*/*/*.html', '!node_modules/*/*.html', '!*/node_modules/*.html'], options: { jshintrc: ".jshintrc" //,reporter: require('jshint-stylish') diff --git a/package.json b/package.json index c747b0ca..0f32886c 100644 --- a/package.json +++ b/package.json @@ -31,10 +31,10 @@ "when": "^3.7.8", "exif": "^0.6.0", "ngeohash": "^0.6.0", - "nodemailer" : "^1.11.0", - "poplib" : "^0.1.7", - "mailparser" : "^0.6.2", - "imap" : "^0.8.19", + "nodemailer": "^1.11.0", + "poplib": "^0.1.7", + "mailparser": "^0.6.2", + "imap": "^0.8.19", "msgpack-js": "^0.3.0" }, "engines": { From ec96d3622b89576be7ee203b624f1c48f67211ef Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 12 Apr 2017 20:33:55 +0100 Subject: [PATCH 049/142] patch mdns resolver sequence to stay working on Pi. --- io/mdns/mdns.js | 9 +++++++-- io/mdns/package.json | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/io/mdns/mdns.js b/io/mdns/mdns.js index b202018d..0e235958 100644 --- a/io/mdns/mdns.js +++ b/io/mdns/mdns.js @@ -10,13 +10,18 @@ module.exports = function(RED) { RED.nodes.createNode(this, n); this.topic = n.topic || ""; this.service = n.service; + var node = this; // var sequence = [ // mdns.rst.DNSServiceResolve(), // mdns.rst.getaddrinfo({families: [4] }) // ]; // var browser = mdns.createBrowser(this.service,{resolverSequence: sequence}); - var browser = mdns.createBrowser(this.service); - var node = this; + var sequence = [ + mdns.rst.DNSServiceResolve(), + 'DNSServiceGetAddrInfo' in mdns.dns_sd ? mdns.rst.DNSServiceGetAddrInfo() : mdns.rst.getaddrinfo({families:[4]}), + mdns.rst.makeAddressesUnique() + ]; + var browser = mdns.createBrowser((this.service), {resolverSequence:sequence}); browser.on('serviceUp', function(service) { if (RED.settings.verbose) { node.log("here : " + service.name); } diff --git a/io/mdns/package.json b/io/mdns/package.json index 8cdf29ca..caee09f8 100644 --- a/io/mdns/package.json +++ b/io/mdns/package.json @@ -1,9 +1,9 @@ { "name" : "node-red-node-discovery", - "version" : "0.0.16", + "version" : "0.0.17", "description" : "A Node-RED node that uses Bonjour / Avahi to discover nearby services.", "dependencies" : { - "mdns" : "2.3.2" + "mdns" : "~2.3.3" }, "repository" : { "type":"git", From fc249b679215d7278cce0c77c462c439f3626d79 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 14 Apr 2017 21:37:44 +0100 Subject: [PATCH 050/142] Add PiGPIOd node alternative to Pi GPIO nodes with remote access --- hardware/pigpiod/LICENSE | 177 +++++++++++ hardware/pigpiod/README.md | 69 +++++ hardware/pigpiod/locales/en-US/pi-gpiod.json | 57 ++++ hardware/pigpiod/package.json | 29 ++ hardware/pigpiod/pi-gpiod.html | 293 +++++++++++++++++++ hardware/pigpiod/pi-gpiod.js | 164 +++++++++++ 6 files changed, 789 insertions(+) create mode 100644 hardware/pigpiod/LICENSE create mode 100644 hardware/pigpiod/README.md create mode 100644 hardware/pigpiod/locales/en-US/pi-gpiod.json create mode 100644 hardware/pigpiod/package.json create mode 100644 hardware/pigpiod/pi-gpiod.html create mode 100644 hardware/pigpiod/pi-gpiod.js diff --git a/hardware/pigpiod/LICENSE b/hardware/pigpiod/LICENSE new file mode 100644 index 00000000..f433b1a5 --- /dev/null +++ b/hardware/pigpiod/LICENSE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/hardware/pigpiod/README.md b/hardware/pigpiod/README.md new file mode 100644 index 00000000..0c669bf7 --- /dev/null +++ b/hardware/pigpiod/README.md @@ -0,0 +1,69 @@ +node-red-node-pi-gpiod +====================== + +An alternative pair of Node-RED nodes to interact with Pi GPIO using +the PiGPIOd daemon that is now part of Raspbian. + +The advantage is that it also talk to GPIO on a Pi that is remote as long as it is running the daemon, and also sharing pins works more cleanly as contention is handled by the multiple connections. + +The disadvantage is that you must setup and run the PiGPIO daemon first. + +## Requirements + +PiGPIOd must be running on the pi. The easiest way to ensure this is to add the following line to your Pi `/etc/rc.local` file. + + /usr/bin/pigpiod + +**Note**: By default this will expose the daemon on TCP port 8888, which is obviously a **security vulnerability**. If you don't want or need remote access then you can start it in local mode only, (`-l` option), or restrict permissions to certain ip addresses, (`-n {ipaddr}` option). For example: + + /usr/bin/pigpiod -l + /usr/bin/pigpiod -n 192.168.1.10 + +See the instructions for more details. + +## Install + +Run the following command in your Node-RED user directory - typically `~/.node-red` + + npm install node-red-node-pi-gpiod + +## Usage + +**Note:** the pin numbers refer the physical pin numbers on connector P1 as they are easier to locate.

    + +### Input node + +Generates a `msg.payload` with either a 0 or 1 depending on the state of the input pin. + +##### Outputs + + - `msg.payload` - *number* - the level of the pin (0 or 1) + - `msg.topic` - *string* - pi/{the pin number} + +##### Details + +You may also enable the input pullup resistor ↑ or the pulldown resistor ↓. + +### Output node + +Can be used in Digital, PWM or Servo modes. + +###### Input + + - `msg.payload` - *number | string* + - Digital - 0, 1 - set pin low or high + - PWM - 0 to 100 - level from 0 to 100% + - Servo - 0 to 100, 50 is centred. + +*Hint*: The `range` node can be used to scale inputs to the correct range. + +##### Details + +Digital mode expects a `msg.payload` with either a 0 or 1 (or true or false), +and will set the selected physical pin high or low depending on the value passed in. + +The initial value of the pin at deploy time can also be set to 0 or 1. + +When using PWM and Servo modes, the input value should be a number 0 - 100, and can be floating point. + +In servo mode you can also preset the minimum and maximum pulse times as required by your servo in order to reach its full range. Minimum of 5mS, maximum of 25 mS - defaults to 10 and 20 mS respectively. diff --git a/hardware/pigpiod/locales/en-US/pi-gpiod.json b/hardware/pigpiod/locales/en-US/pi-gpiod.json new file mode 100644 index 00000000..ef20b888 --- /dev/null +++ b/hardware/pigpiod/locales/en-US/pi-gpiod.json @@ -0,0 +1,57 @@ +{ + "pi-gpiod": { + "label": { + "gpiopin": "GPIO", + "selectpin": "select pin", + "host": "Host", + "resistor": "Resistor?", + "readinitial": "Read initial state of pin on deploy/restart?", + "type": "Type", + "initpin": "Initialise pin state?", + "debounce": "Debounce", + "limits": "Limits", + "min": "min", + "max": "max" + }, + "place": { + "host": "local or remote ip", + "port": "port" + }, + "resistor": { + "none": "none", + "pullup": "pullup", + "pulldown": "pulldown" + }, + "digout": "Digital output", + "pwmout": "PWM output", + "servo": "Servo output", + "initpin0": "initial level of pin - low (0)", + "initpin1": "initial level of pin - high (1)", + "pinname": "Pin", + "tip": { + "pin": "Pins in Use: ", + "in": "Tip: Only Digital Input is supported - input must be 0 or 1.", + "dig": "Tip: For digital output - input must be 0 or 1.", + "pwm": "Tip: For PWM output - input must be between 0 to 100.", + "ser": "Tip: For Servo output - input must be between 0 to 100. 50 is centre.
    Min must be 5mS or more, Max must be 25mS or less." + }, + "types": { + "digout": "digital output", + "input": "input", + "pullup": "input with pull up", + "pulldown": "input with pull down", + "pwmout": "PWM output", + "servo": "Servo output" + }, + "status": { + "stopped": "stopped", + "closed": "closed", + "not-running": "not running" + }, + "errors": { + "invalidpin": "Invalid GPIO pin", + "invalidinput": "Invalid input", + "error": "error: __error__" + } + } +} diff --git a/hardware/pigpiod/package.json b/hardware/pigpiod/package.json new file mode 100644 index 00000000..3297c775 --- /dev/null +++ b/hardware/pigpiod/package.json @@ -0,0 +1,29 @@ +{ + "name": "node-red-node-pi-gpiod", + "version": "0.0.1", + "description": "A node-red node for PiGPIOd", + "dependencies" : { + "js-pigpio": "^1.0.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/node-red/node-red-nodes/tree/master/hardware/pigpiod" + }, + "keywords": [ + "node-red", "Pi", "GPIO", "PiGPIOd" + ], + "author": { + "name": "Dave Conway-Jones", + "email": "ceejay@vnet.ibm.com", + "url": "http://nodered.org" + }, + "license": "Apache-2.0", + "node-red" : { + "nodes": { + "pi-gpiod": "pi-gpiod.js" + } + } +} diff --git a/hardware/pigpiod/pi-gpiod.html b/hardware/pigpiod/pi-gpiod.html new file mode 100644 index 00000000..a2918300 --- /dev/null +++ b/hardware/pigpiod/pi-gpiod.html @@ -0,0 +1,293 @@ + + + + + + + + + + + + diff --git a/hardware/pigpiod/pi-gpiod.js b/hardware/pigpiod/pi-gpiod.js new file mode 100644 index 00000000..1e747a4e --- /dev/null +++ b/hardware/pigpiod/pi-gpiod.js @@ -0,0 +1,164 @@ + +module.exports = function(RED) { + "use strict"; + var Pigpio = require('js-pigpio'); + + var bcm2pin = { + "2":"3", "3":"5", "4":"7", "14":"8", "15":"10", "17":"11", "18":"12", "27":"13", "22":"15", + "23":"16", "24":"18", "10":"19", "9":"21", "25":"22", "11":"23", "8":"24", "7":"26", + "5":"29", "6":"31", "12":"32", "13":"33", "19":"35", "16":"36", "26":"37", "20":"38", "21":"40" + }; + var pinTypes = { + "PUD_OFF":RED._("pi-gpiod:types.input"), + "PUD_UP":RED._("pi-gpiod:types.pullup"), + "PUD_DOWN":RED._("pi-gpiod:types.pulldown"), + "out":RED._("pi-gpiod:types.digout"), + "pwm":RED._("pi-gpiod:types.pwmout"), + "ser":RED._("pi-gpiod:types.servo") + }; + + function GPioInNode(n) { + RED.nodes.createNode(this,n); + this.host = n.host || "127.0.0.1"; + this.port = n.port || 8888; + this.pin = n.pin; + this.pio = bcm2pin[n.pin]; + this.intype = n.intype; + this.read = n.read || false; + this.debounce = Number(n.debounce || 25); + var node = this; + var PiGPIO; + + if (node.pin !== undefined) { + PiGPIO = new Pigpio(); + var inerror = false; + var doit = function() { + PiGPIO.pi(node.host, node.port, function(err) { + if (err) { + node.status({fill:"red",shape:"ring",text:err.code+" "+node.host+":"+node.port}); + if (!inerror) { node.error(err); inerror = true; } + node.retry = setTimeout(function() { doit(); }, 5000); + } + else { + inerror = false; + PiGPIO.set_mode(node.pin,PiGPIO.INPUT); + PiGPIO.set_pull_up_down(node.pin,PiGPIO[node.intype]); + PiGPIO.set_glitch_filter(node.pin,node.debounce); + node.status({fill:"green",shape:"dot",text:"node-red:common.status.ok"}); + node.cb = PiGPIO.callback(node.pin, PiGPIO.EITHER_EDGE, function(gpio, level, tick) { + node.send({ topic:"pi/"+node.pio, payload:Number(level) }); + node.status({fill:"green",shape:"dot",text:level}); + }); + if (node.read) { + setTimeout(function() { + PiGPIO.read(node.pin, function(err, level) { + node.send({ topic:"pi/"+node.pio, payload:Number(level) }); + node.status({fill:"green",shape:"dot",text:level}); + }); + }, 20); + } + } + }); + } + doit(); + } + else { + node.warn(RED._("pi-gpiod:errors.invalidpin")+": "+node.pio); + } + + node.on("close", function(done) { + if (node.retry) { clearTimeout(node.retry); } + node.status({fill:"grey",shape:"ring",text:"pi-gpiod.status.closed"}); + node.cb.cancel(); + PiGPIO.close(); + done(); + }); + } + RED.nodes.registerType("pi-gpiod in",GPioInNode); + + + function GPioOutNode(n) { + RED.nodes.createNode(this,n); + this.host = n.host || "127.0.0.1"; + this.port = n.port || 8888; + this.pin = n.pin; + this.pio = bcm2pin[n.pin]; + this.set = n.set || false; + this.level = parseInt(n.level || 0); + this.out = n.out || "out"; + this.sermin = Number(n.sermin); + this.sermax = Number(n.sermax); + if (this.sermin > this.sermax) { + var tmp = this.sermin; + this.sermin = this.sermax; + this.sermax = tmp; + } + if (this.sermin < 5) { this.sermin = 5; } + if (this.sermax > 25) { this.sermax = 25; } + var node = this; + var PiGPIO; + + function inputlistener(msg) { + if (msg.payload === "true") { msg.payload = true; } + if (msg.payload === "false") { msg.payload = false; } + var out = Number(msg.payload); + var limit = 1; + if (node.out !== "out") { limit = 100; } + if ((out >= 0) && (out <= limit)) { + if (RED.settings.verbose) { node.log("out: "+msg.payload); } + if (node.out === "out") { + PiGPIO.write(node.pin, msg.payload); + } + if (node.out === "pwm") { + PiGPIO.set_PWM_dutycycle(node.pin, parseInt(msg.payload * 2.55)); + } + if (node.out === "ser") { + var r = (node.sermax - node.sermin) * 100; + PiGPIO.setServoPulsewidth(node.pin, parseInt(1500 - (r/2) + (msg.payload * r / 100))); + } + node.status({fill:"green",shape:"dot",text:msg.payload.toString()}); + } + else { node.warn(RED._("pi-gpiod:errors.invalidinput")+": "+out); } + } + + if (node.pin !== undefined) { + PiGPIO = new Pigpio(); + var inerror = false; + var doit = function() { + PiGPIO.pi(node.host, node.port, function(err) { + if (err) { + node.status({fill:"red",shape:"ring",text:err.code+" "+node.host+":"+node.port}); + if (!inerror) { node.error(err,err); inerror = true; } + node.retry = setTimeout(function() { doit(); }, 5000); + } + else { + PiGPIO.set_mode(node.pin,PiGPIO.OUTPUT); + if (node.set) { + setTimeout(function() { PiGPIO.write(node.pin,node.level); }, 25 ); + node.status({fill:"green",shape:"dot",text:node.level}); + } else { + node.status({fill:"green",shape:"dot",text:"node-red:common.status.ok"}); + } + // if (node.out === "pwm") { + // PiGPIO.set_PWM_frequency(1000); + // PiGPIO.set_PWM_range(1000); + // } + } + }); + } + doit(); + node.on("input", inputlistener); + } + else { + node.warn(RED._("pi-gpiod:errors.invalidpin")+": "+node.pio); + } + + node.on("close", function(done) { + if (node.retry) { clearTimeout(node.retry); } + node.status({fill:"grey",shape:"ring",text:"pi-gpiod.status.closed"}); + PiGPIO.close(); + done(); + }); + } + RED.nodes.registerType("pi-gpiod out",GPioOutNode); +} From 774bc50589b93df04337610f12aa19191c29d751 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 14 Apr 2017 21:38:42 +0100 Subject: [PATCH 051/142] add greater and greater or equal modes to RBE bandgap mode --- function/rbe/locales/en-US/rbe.json | 6 ++- function/rbe/package.json | 2 +- function/rbe/rbe.html | 48 ++++++++++++----- function/rbe/rbe.js | 16 ++++-- test/function/rbe/rbe_spec.js | 84 ++++++++++++++++++++++++----- 5 files changed, 122 insertions(+), 34 deletions(-) diff --git a/function/rbe/locales/en-US/rbe.json b/function/rbe/locales/en-US/rbe.json index 2dc6535b..33690e05 100644 --- a/function/rbe/locales/en-US/rbe.json +++ b/function/rbe/locales/en-US/rbe.json @@ -11,8 +11,10 @@ }, "opts": { "rbe": "block unless value changes", - "deadband": "block unless value changes by more than", - "narrowband": "block if value changes by more than", + "deadband": "block unless value change is greater than", + "deadbandEq": "block unless value change is greater or equal to", + "narrowband": "block if value change is greater than", + "narrowbandEq": "block if value change is greater or equal to", "in": "compared to last input value", "out": "compared to last valid output value" }, diff --git a/function/rbe/package.json b/function/rbe/package.json index 05f16e2e..320a72fd 100644 --- a/function/rbe/package.json +++ b/function/rbe/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-rbe", - "version" : "0.1.6", + "version" : "0.1.8", "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 5717e508..8edd50ec 100644 --- a/function/rbe/rbe.html +++ b/function/rbe/rbe.html @@ -4,14 +4,16 @@
    - - + @@ -27,21 +29,38 @@ @@ -85,6 +87,8 @@ @@ -141,6 +145,8 @@ @@ -199,6 +205,8 @@ diff --git a/io/snmp/snmp.js b/io/snmp/snmp.js index c3e90bf6..a1159ac0 100644 --- a/io/snmp/snmp.js +++ b/io/snmp/snmp.js @@ -12,13 +12,10 @@ module.exports = function(RED) { var node = this; this.on("input",function(msg) { + var host = node.host || msg.host; + var community = node.community || msg.community; var oids = node.oids || msg.oid; if (oids) { - if (msg.host && node.host || msg.community && node.community) { - node.warn(RED._("common.errors.nooverride")); - } - var host = node.host || msg.host; - var community = node.community || msg.community; node.session = snmp.createSession(host, community, {version: node.version}); node.session.get(oids.split(","), function(error, varbinds) { if (error) { @@ -70,18 +67,15 @@ module.exports = function(RED) { } this.on("input",function(msg) { + var host = node.host || msg.host; + var community = node.community || msg.community; var oids = node.oids || msg.oid; if (oids) { msg.oid = oids; - if (msg.host && node.host || msg.community && node.community) { - node.warn(RED._("common.errors.nooverride")); - } - var host = node.host || msg.host; - var community = node.community || msg.community; node.session = snmp.createSession(host, community, {version: node.version}); node.session.table(oids, maxRepetitions, function(error, table) { if (error) { - node.error(error.toString()); + node.error(error.toString(), msg); } else { var indexes = []; @@ -135,7 +129,7 @@ module.exports = function(RED) { function feedCb(varbinds) { for (var i = 0; i < varbinds.length; i++) { if (snmp.isVarbindError(varbinds[i])) { - node.error(snmp.varbindError(varbinds[i])); + node.error(snmp.varbindError(varbinds[i]), msg); } else { //console.log(varbinds[i].oid + "|" + varbinds[i].value); @@ -145,18 +139,15 @@ module.exports = function(RED) { } this.on("input",function(msg) { + var host = node.host || msg.host; + var community = node.community || msg.community; var oids = node.oids || msg.oid; if (oids) { msg.oid = oids; - if (msg.host && node.host || msg.community && node.community) { - node.warn(RED._("common.errors.nooverride")); - } - var host = node.host || msg.host; - var community = node.community || msg.community; node.session = snmp.createSession(host, community, {version: node.version}); node.session.subtree(msg.oid, maxRepetitions, feedCb, function(error) { if (error) { - node.error(error.toString()); + node.error(error.toString(), msg); } else { msg.payload = response; @@ -192,7 +183,7 @@ module.exports = function(RED) { function feedCb(varbinds) { for (var i = 0; i < varbinds.length; i++) { if (snmp.isVarbindError(varbinds[i])) { - node.error(snmp.varbindError(varbinds[i])); + node.error(snmp.varbindError(varbinds[i]), msg); } else { //console.log(varbinds[i].oid + "|" + varbinds[i].value); @@ -204,17 +195,14 @@ module.exports = function(RED) { this.on("input",function(msg) { node.msg = msg; var oids = node.oids || msg.oid; + var host = node.host || msg.host; + var community = node.community || msg.community; if (oids) { msg.oid = oids; - if (msg.host && node.host || msg.community && node.community) { - node.warn(RED._("common.errors.nooverride")); - } - var host = node.host || msg.host; - var community = node.community || msg.community; node.session = snmp.createSession(host, community, {version: node.version}); node.session.walk(msg.oid, maxRepetitions, feedCb, function(error) { if (error) { - node.error(error.toString()); + node.error(error.toString(), msg); } else { msg.payload = response; From 0fb8a1a2a0f3750acd39091e8cbe0cd4500aaf60 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 3 May 2017 17:46:10 +0100 Subject: [PATCH 065/142] add kill and start parameters to daemon node --- utility/daemon/README.md | 9 +++++++-- utility/daemon/daemon.html | 7 ++++--- utility/daemon/daemon.js | 33 ++++++++++++++++++++++----------- utility/daemon/package.json | 2 +- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/utility/daemon/README.md b/utility/daemon/README.md index 2e67a391..2c46037b 100644 --- a/utility/daemon/README.md +++ b/utility/daemon/README.md @@ -31,8 +31,13 @@ The command provides 3 outputs... stdout, stderr, and return code, from the runn If the called program stops (i.e. a return code is produced), this node can attempt to restart the command automatically. -**Note :** when you stop Node-RED running we may not get a chance to kill the -called program so it may remain running. You may have to kill it manually. +Setting `msg.kill` to a signal name (e.g. SIGINT, SIGHUP) will stop the process - but if the restart flag is set it will then auto restart. + +Sending `msg.start` will also re-start the process. + +**Note:** Some applications will automatically buffer lines of output. It is advisable to turn off this behaviour. +For example, if running a Python app, the `-u` parameter will stop the output being buffered. + For example it can be used to run and then monitor the dump1090 plane diff --git a/utility/daemon/daemon.html b/utility/daemon/daemon.html index f9e1547d..6e7a5d8d 100644 --- a/utility/daemon/daemon.html +++ b/utility/daemon/daemon.html @@ -40,9 +40,10 @@

    Calls out to a long running system command. Sends msg.payload to stdin of the process.

    Provides 3 outputs... stdout, stderr, and return code , from the running command.

    If the called program stops (i.e. a return code is produced), this node can attempt to restart the command.

    -

    Note : when you stop Node-RED running we may not get a chance to kill the called program so it may remain - running. You may have to kill it manually.

    -

    If running a Python app you may need to use the -u parameter to stop the output being buffered.

    +

    Setting msg.kill to a signal name (e.g. SIGINT, SIGHUP) will stop the process - but if the + restart flag is set it will then auto restart. Sending msg.start will also re-start the process.

    +

    Note: Some applications will automatically buffer lines of output. It is advisable to turn off this behaviour. + For example, if running a Python app, the -u parameter will stop the output being buffered.

    @@ -188,7 +188,7 @@
    Pins marked with * are dual use. Make sure they are not enabled for - their other use before using as GPIO.
    + their other use before using as GPIO.
    From 8799b1e85bc219f8fa0ff2e9a50f11743c3e5735 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 14 May 2017 23:05:52 +0100 Subject: [PATCH 070/142] Try better pin picker for pigpiod --- hardware/pigpiod/package.json | 2 +- hardware/pigpiod/pi-gpiod.html | 371 ++++++++++++++++++++++++++------- 2 files changed, 302 insertions(+), 71 deletions(-) diff --git a/hardware/pigpiod/package.json b/hardware/pigpiod/package.json index e5880b5b..2b886b8f 100644 --- a/hardware/pigpiod/package.json +++ b/hardware/pigpiod/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-pi-gpiod", - "version": "0.0.5", + "version": "0.0.6", "description": "A node-red node for PiGPIOd", "dependencies" : { "js-pigpio": "*" diff --git a/hardware/pigpiod/pi-gpiod.html b/hardware/pigpiod/pi-gpiod.html index dbee7a1f..71d0515d 100644 --- a/hardware/pigpiod/pi-gpiod.html +++ b/hardware/pigpiod/pi-gpiod.html @@ -1,37 +1,143 @@ @@ -103,53 +208,169 @@ var suf = ""; if (this.intype === "PUD_UP") { suf = "↑ "} if (this.intype === "PUD_DOWN") { suf = "↓ "} - return this.name || "GPIO: "+suf+bcm2pin[this.pin] ; + return this.name || "PIN: "+suf+bcm2pin[this.pin] ; }, labelStyle: function() { return this.name?"node_label_italic":""; }, + outputLabels: function() { return "GPIO"+this.pin; }, palettelabel: "pi gpiod", oneditprepare: function() { var pinnow = this.pin; var pintip = this._("pi-gpiod.tip.pin"); var pinname = this._("pi-gpiod.pinname"); + $('#pinform input').on('change', function() { + this.pin = $("#pinform input[type='radio']:checked").val(); + $("#node-input-pin").val(this.pin); + }); + $("#node-input-pin").change(function () { + if ($("#node-input-pin").val()) { + $("#pinform input[value="+$("#node-input-pin").val()+"]").prop('checked', true); + } + }); } }); From 76e33acae58da47b8bec4f85cfbbd067bd0b1fc0 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 24 May 2017 13:14:55 +0100 Subject: [PATCH 071/142] add ignore first message option to rue node --- function/rbe/locales/en-US/rbe.json | 2 ++ function/rbe/package.json | 2 +- function/rbe/rbe.html | 5 ++-- function/rbe/rbe.js | 8 +++--- test/function/rbe/rbe_spec.js | 40 +++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 6 deletions(-) diff --git a/function/rbe/locales/en-US/rbe.json b/function/rbe/locales/en-US/rbe.json index 33690e05..d0d967bb 100644 --- a/function/rbe/locales/en-US/rbe.json +++ b/function/rbe/locales/en-US/rbe.json @@ -2,6 +2,7 @@ "rbe": { "label": { "func": "Mode", + "init": "Send initial value", "start": "Start value", "name": "Name" }, @@ -11,6 +12,7 @@ }, "opts": { "rbe": "block unless value changes", + "rbei": "block unless value changes (ignore initial value)", "deadband": "block unless value change is greater than", "deadbandEq": "block unless value change is greater or equal to", "narrowband": "block if value change is greater than", diff --git a/function/rbe/package.json b/function/rbe/package.json index 320a72fd..4fb8a5d4 100644 --- a/function/rbe/package.json +++ b/function/rbe/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-rbe", - "version" : "0.1.8", + "version" : "0.1.9", "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 8edd50ec..6839c83f 100644 --- a/function/rbe/rbe.html +++ b/function/rbe/rbe.html @@ -4,6 +4,7 @@ decimal places +
    + + +

    @@ -31,6 +38,7 @@ + + + + + + + \ No newline at end of file diff --git a/io/snmp/snmp.js b/io/snmp/snmp.js index 3bfc25fa..008d5995 100644 --- a/io/snmp/snmp.js +++ b/io/snmp/snmp.js @@ -1,39 +1,39 @@ -module.exports = function(RED) { +module.exports = function (RED) { "use strict"; var snmp = require("net-snmp"); var sessions = {}; - function getSession(host, community, version){ + function getSession(host, community, version) { var sessionKey = host + ":" + community + ":" + version; - if (!(sessionKey in sessions)){ - sessions[sessionKey] = snmp.createSession(host, community, {version: version}); + if (!(sessionKey in sessions)) { + sessions[sessionKey] = snmp.createSession(host, community, { version: version }); } return sessions[sessionKey]; } function SnmpNode(n) { - RED.nodes.createNode(this,n); + RED.nodes.createNode(this, n); this.community = n.community; this.host = n.host; this.version = (n.version === "2c") ? snmp.Version2c : snmp.Version1; - this.oids = n.oids.replace(/\s/g,""); + this.oids = n.oids.replace(/\s/g, ""); var node = this; - this.on("input",function(msg) { + this.on("input", function (msg) { var host = node.host || msg.host; var community = node.community || msg.community; var oids = node.oids || msg.oid; if (oids) { - getSession(host, community, node.version).get(oids.split(","), function(error, varbinds) { + getSession(host, community, node.version).get(oids.split(","), function (error, varbinds) { if (error) { - node.error(error.toString(),msg); + node.error(error.toString(), msg); } else { for (var i = 0; i < varbinds.length; i++) { if (snmp.isVarbindError(varbinds[i])) { - node.error(snmp.varbindError(varbinds[i]),msg); + node.error(snmp.varbindError(varbinds[i]), msg); } else { if (varbinds[i].type == 4) { varbinds[i].value = varbinds[i].value.toString(); } @@ -52,14 +52,55 @@ module.exports = function(RED) { } }); } - RED.nodes.registerType("snmp",SnmpNode); + RED.nodes.registerType("snmp", SnmpNode); - function SnmpTNode(n) { - RED.nodes.createNode(this,n); + + function SnmpSNode(n) { + RED.nodes.createNode(this, n); this.community = n.community; this.host = n.host; this.version = (n.version === "2c") ? snmp.Version2c : snmp.Version1; - this.oids = n.oids.replace(/\s/g,""); + this.varbinds = n.varbinds; + var node = this; + this.on("input", function (msg) { + var host = node.host || msg.host; + var community = node.community || msg.community; + var varbinds = (node.varbinds) ? JSON.parse(node.varbinds) : msg.varbinds; + if (varbinds) { + for (var i = 0; i < varbinds.length; i++) { + varbinds[i].type = snmp.ObjectType[varbinds[i].type]; + } + getSession(host, community, node.version).set(varbinds, function (error, varbinds) { + if (error) { + node.error(error.toString(), msg); + } + else { + for (var i = 0; i < varbinds.length; i++) { + // for version 2c we must check each OID for an error condition + if (snmp.isVarbindError(varbinds[i])) { + node.error(snmp.varbindError(varbinds[i]), msg); + } + } + } + }); + } + else { + node.warn("No varbinds to set"); + } + }); + + } + RED.nodes.registerType("snmp set", SnmpSNode); + + + + + function SnmpTNode(n) { + RED.nodes.createNode(this, n); + this.community = n.community; + this.host = n.host; + this.version = (n.version === "2c") ? snmp.Version2c : snmp.Version1; + this.oids = n.oids.replace(/\s/g, ""); var node = this; var maxRepetitions = 20; @@ -69,13 +110,13 @@ module.exports = function(RED) { else { return 0; } } - this.on("input",function(msg) { + this.on("input", function (msg) { var host = node.host || msg.host; var community = node.community || msg.community; var oids = node.oids || msg.oid; if (oids) { msg.oid = oids; - getSession(host, community, node.version).table(oids, maxRepetitions, function(error, table) { + getSession(host, community, node.version).table(oids, maxRepetitions, function (error, table) { if (error) { node.error(error.toString(), msg); } @@ -110,14 +151,14 @@ module.exports = function(RED) { } }); } - RED.nodes.registerType("snmp table",SnmpTNode); + RED.nodes.registerType("snmp table", SnmpTNode); function SnmpSubtreeNode(n) { - RED.nodes.createNode(this,n); + RED.nodes.createNode(this, n); this.community = n.community; this.host = n.host; this.version = (n.version === "2c") ? snmp.Version2c : snmp.Version1; - this.oids = n.oids.replace(/\s/g,""); + this.oids = n.oids.replace(/\s/g, ""); var node = this; var maxRepetitions = 20; var response = []; @@ -129,18 +170,18 @@ module.exports = function(RED) { } else { //console.log(varbinds[i].oid + "|" + varbinds[i].value); - response.push({oid: varbinds[i].oid, value: varbinds[i].value}); + response.push({ oid: varbinds[i].oid, value: varbinds[i].value }); } } } - this.on("input",function(msg) { + this.on("input", function (msg) { var host = node.host || msg.host; var community = node.community || msg.community; var oids = node.oids || msg.oid; if (oids) { msg.oid = oids; - getSession(host, community, node.version).subtree(msg.oid, maxRepetitions, feedCb, function(error) { + getSession(host, community, node.version).subtree(msg.oid, maxRepetitions, feedCb, function (error) { if (error) { node.error(error.toString(), msg); } @@ -157,14 +198,14 @@ module.exports = function(RED) { } }); } - RED.nodes.registerType("snmp subtree",SnmpSubtreeNode); + RED.nodes.registerType("snmp subtree", SnmpSubtreeNode); function SnmpWalkerNode(n) { - RED.nodes.createNode(this,n); + RED.nodes.createNode(this, n); this.community = n.community; this.host = n.host; this.version = (n.version === "2c") ? snmp.Version2c : snmp.Version1; - this.oids = n.oids.replace(/\s/g,""); + this.oids = n.oids.replace(/\s/g, ""); var node = this; var maxRepetitions = 20; var response = []; @@ -176,19 +217,19 @@ module.exports = function(RED) { } else { //console.log(varbinds[i].oid + "|" + varbinds[i].value); - response.push({oid: varbinds[i].oid, value: varbinds[i].value}); + response.push({ oid: varbinds[i].oid, value: varbinds[i].value }); } } } - this.on("input",function(msg) { + this.on("input", function (msg) { node.msg = msg; var oids = node.oids || msg.oid; var host = node.host || msg.host; var community = node.community || msg.community; if (oids) { msg.oid = oids; - getSession(host, community, node.version).walk(msg.oid, maxRepetitions, feedCb, function(error) { + getSession(host, community, node.version).walk(msg.oid, maxRepetitions, feedCb, function (error) { if (error) { node.error(error.toString(), msg); } @@ -205,5 +246,5 @@ module.exports = function(RED) { } }); } - RED.nodes.registerType("snmp walker",SnmpWalkerNode); + RED.nodes.registerType("snmp walker", SnmpWalkerNode); }; From 0609645375efe2a131c2e8a04adeadd851c717ba Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 26 Jun 2017 23:04:20 +0100 Subject: [PATCH 098/142] bump snap node version for incoming PR --- io/snmp/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/snmp/package.json b/io/snmp/package.json index eae87355..047cff9b 100644 --- a/io/snmp/package.json +++ b/io/snmp/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-snmp", - "version" : "0.0.14", + "version" : "0.0.15", "description" : "A Node-RED node that looks for SNMP oids.", "dependencies" : { "net-snmp" : "^1.1.19" From f6e71bf962dcf8c12b0e0fd9180c48c88fecb386 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 30 Jun 2017 19:52:20 +0100 Subject: [PATCH 099/142] "revert" serial port and base64 nodes forwards.... undo buffer syntax updates --- io/serialport/25-serial.js | 18 +++++++++--------- io/serialport/package.json | 2 +- parsers/base64/70-base64.js | 4 ++-- parsers/base64/package.json | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/io/serialport/25-serial.js b/io/serialport/25-serial.js index 24c11696..0f9a9bc4 100644 --- a/io/serialport/25-serial.js +++ b/io/serialport/25-serial.js @@ -52,7 +52,7 @@ module.exports = function(RED) { payload += node.addCh; } else if (node.addCh !== "") { - payload = Buffer.concat([payload,new Buffer.from(node.addCh)]); + payload = Buffer.concat([payload,new Buffer(node.addCh)]); } node.port.write(payload,function(err,res) { if (err) { @@ -94,8 +94,8 @@ module.exports = function(RED) { var node = this; node.tout = null; var buf; - if (node.serialConfig.out != "count") { buf = new Buffer.alloc(bufMaxSize); } - else { buf = new Buffer.alloc(Number(node.serialConfig.newline)); } + if (node.serialConfig.out != "count") { buf = new Buffer(bufMaxSize); } + else { buf = new Buffer(Number(node.serialConfig.newline)); } var i = 0; node.status({fill:"grey",shape:"dot",text:"node-red:common.status.not-connected"}); node.port = serialPool.get(this.serialConfig.serialport, @@ -108,17 +108,17 @@ module.exports = function(RED) { var splitc; if (node.serialConfig.newline.substr(0,2) == "0x") { - splitc = new Buffer.from([parseInt(node.serialConfig.newline)]); + splitc = new Buffer([parseInt(node.serialConfig.newline)]); } else { - splitc = new Buffer.from(node.serialConfig.newline.replace("\\n","\n").replace("\\r","\r").replace("\\t","\t").replace("\\e","\e").replace("\\f","\f").replace("\\0","\0")); // jshint ignore:line + splitc = new Buffer(node.serialConfig.newline.replace("\\n","\n").replace("\\r","\r").replace("\\t","\t").replace("\\e","\e").replace("\\f","\f").replace("\\0","\0")); // jshint ignore:line } this.port.on('data', function(msg) { // single char buffer if ((node.serialConfig.newline === 0)||(node.serialConfig.newline === "")) { if (node.serialConfig.bin !== "bin") { node.send({"payload": String.fromCharCode(msg)}); } - else { node.send({"payload": new Buffer.from([msg])}); } + else { node.send({"payload": new Buffer([msg])}); } } else { // do the timer thing @@ -130,7 +130,7 @@ module.exports = function(RED) { else { node.tout = setTimeout(function () { node.tout = null; - var m = new Buffer.alloc(i+1); + var m = new Buffer(i+1); buf.copy(m,0,0,i+1); if (node.serialConfig.bin !== "bin") { m = m.toString(); } node.send({"payload": m}); @@ -145,7 +145,7 @@ module.exports = function(RED) { buf[i] = msg; i += 1; if ( i >= parseInt(node.serialConfig.newline)) { - var m = new Buffer.alloc(i); + var m = new Buffer(i); buf.copy(m,0,0,i); if (node.serialConfig.bin !== "bin") { m = m.toString(); } node.send({"payload":m}); @@ -158,7 +158,7 @@ module.exports = function(RED) { buf[i] = msg; i += 1; if ((msg === splitc[0]) || (i === bufMaxSize)) { - var n = new Buffer.alloc(i); + var n = new Buffer(i); buf.copy(n,0,0,i); if (node.serialConfig.bin !== "bin") { n = n.toString(); } node.send({"payload":n}); diff --git a/io/serialport/package.json b/io/serialport/package.json index 3ca3a7aa..ea71a8f9 100644 --- a/io/serialport/package.json +++ b/io/serialport/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-serialport", - "version" : "0.4.3", + "version" : "0.4.4", "description" : "Node-RED nodes to talk to serial ports", "dependencies" : { "serialport" : "~4.0.7" diff --git a/parsers/base64/70-base64.js b/parsers/base64/70-base64.js index 224e9dc9..319f7716 100644 --- a/parsers/base64/70-base64.js +++ b/parsers/base64/70-base64.js @@ -16,12 +16,12 @@ module.exports = function(RED) { // Take base64 string and make into binary buffer var regexp = new RegExp('^[A-Za-z0-9+\/=]*$'); if ( regexp.test(msg.payload) && (msg.payload.length % 4 === 0) ) { - msg.payload = new Buffer.from(msg.payload,'base64'); + msg.payload = new Buffer(msg.payload,'base64'); node.send(msg); } else { //node.log("Not a Base64 string - maybe we should encode it..."); - msg.payload = (new Buffer.from(msg.payload,"binary")).toString('base64'); + msg.payload = (new Buffer(msg.payload,"binary")).toString('base64'); node.send(msg); } } diff --git a/parsers/base64/package.json b/parsers/base64/package.json index bf29e399..204c6a7a 100644 --- a/parsers/base64/package.json +++ b/parsers/base64/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-base64", - "version" : "0.0.5", + "version" : "0.0.6", "description" : "A Node-RED node to pack and unpack objects to base64 format", "dependencies" : { }, From c6f8b7ee76bcd83fed2f97ab8726cba80292b4ac Mon Sep 17 00:00:00 2001 From: Kazuhito Yokoi Date: Thu, 13 Jul 2017 02:16:43 +0900 Subject: [PATCH 100/142] Modify messages in e-mail node to refer to language files (#343) thanks @kazuhitoyokoi --- social/email/61-email.html | 8 ++++---- social/email/locales/en-US/61-email.json | 6 +++++- social/email/locales/ja/61-email.json | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/social/email/61-email.html b/social/email/61-email.html index 9850bcea..c7ddcc8d 100644 --- a/social/email/61-email.html +++ b/social/email/61-email.html @@ -38,7 +38,7 @@ - Use secure connection. +
    @@ -150,9 +150,9 @@

    diff --git a/social/email/locales/en-US/61-email.json b/social/email/locales/en-US/61-email.json index 3bbcf71f..a3d1c318 100644 --- a/social/email/locales/en-US/61-email.json +++ b/social/email/locales/en-US/61-email.json @@ -4,6 +4,7 @@ "to": "To", "server": "Server", "port": "Port", + "useSecureConnection": "Use secure connection.", "userid": "Userid", "password": "Password", "repeat": "Refresh", @@ -11,7 +12,10 @@ "folder": "Folder", "protocol": "Protocol", "useSSL": "Use SSL?", - "disposition": "Disposition" + "disposition": "Disposition", + "none": "None", + "read": "Mark Read", + "delete": "Delete" }, "default-message": "__description__\n\nFile from Node-RED is attached: __filename__", "tip": { diff --git a/social/email/locales/ja/61-email.json b/social/email/locales/ja/61-email.json index 7c7ee4de..db4821b3 100644 --- a/social/email/locales/ja/61-email.json +++ b/social/email/locales/ja/61-email.json @@ -4,6 +4,7 @@ "to": "宛先", "server": "サーバ", "port": "ポート", + "useSecureConnection": "安全な接続を使用", "userid": "ユーザID", "password": "パスワード", "repeat": "更新", @@ -11,7 +12,10 @@ "folder": "フォルダ", "protocol": "プロトコル", "useSSL": "SSLを使用", - "disposition": "受信後の処理" + "disposition": "受信後の処理", + "none": "なし", + "read": "既読", + "delete": "削除" }, "default-message": "__description__\n\nNode-REDからファイルが添付されました: __filename__", "tip": { From dbff575e24883e933be35b051ca1bc83a0f3ad99 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 18 Jul 2017 20:32:50 +0100 Subject: [PATCH 101/142] bump email package.json --- social/email/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/social/email/package.json b/social/email/package.json index bdcff9df..2f90f14f 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-email", - "version": "0.1.23", + "version": "0.1.24", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "nodemailer": "^1.11.0", From 7950b7d39a3a71c1353e0b45cf1db922459fdd0e Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 9 Aug 2017 16:58:15 +0100 Subject: [PATCH 102/142] Move msg pack node to more supported lib msgpack-lite --- package.json | 2 +- parsers/msgpack/70-msgpack.html | 5 ++++- parsers/msgpack/70-msgpack.js | 6 +++--- parsers/msgpack/README.md | 10 +++++++++- parsers/msgpack/package.json | 4 ++-- test/parsers/msgpack/70-msgpack_spec.js | 3 ++- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 86002f5c..00c1a436 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,6 @@ "poplib": "^0.1.7", "mailparser": "^0.6.1", "imap": "^0.8.19", - "msgpack-js": "^0.3.0" + "msgpack-lite": "^0.1.26" } } diff --git a/parsers/msgpack/70-msgpack.html b/parsers/msgpack/70-msgpack.html index c3fc2094..a256c830 100644 --- a/parsers/msgpack/70-msgpack.html +++ b/parsers/msgpack/70-msgpack.html @@ -7,9 +7,12 @@ @@ -31,6 +34,7 @@ defaults: { name: { value:"" }, topic: { value:"SRF" }, + pulse: {value:"0.5" }, pins: { value:"", required:true, validate:RED.validators.regex(/^\d+,\d+$/) } }, inputs:0, diff --git a/hardware/PiSrf/pisrf.js b/hardware/PiSrf/pisrf.js index 61a827be..10a8a9d9 100644 --- a/hardware/PiSrf/pisrf.js +++ b/hardware/PiSrf/pisrf.js @@ -26,12 +26,13 @@ module.exports = function(RED) { RED.nodes.createNode(this, n); this.topic = n.topic; this.pins = n.pins; + this.pins += ","+(n.pulse || 0.5); var node = this; if (node.pins !== undefined) { node.child = spawn(gpioCommand, [node.pins]); node.running = true; - if (RED.settings.verbose) { node.log("pin: " + node.pins + " :"); } + if (RED.settings.verbose) { node.log("parameters: " + node.pins + " :"); } node.child.stdout.on('data', function(data) { if (RED.settings.verbose) { node.log("out: " + data + " :"); } @@ -59,7 +60,7 @@ module.exports = function(RED) { } else { - node.error("Invalid GPIO pins: " + node.pin); + node.error("Invalid Parameters: " + node.pins); } var wfi = function(done) { From 5ac15e620ad09a9832b26b196670cd471a299890 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 22 Aug 2017 15:49:31 +0100 Subject: [PATCH 104/142] ensure daemon node has a command to run in order to prevent crash. --- utility/daemon/daemon.js | 4 ++++ utility/daemon/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/utility/daemon/daemon.js b/utility/daemon/daemon.js index d29ccac8..d2eb6cbc 100644 --- a/utility/daemon/daemon.js +++ b/utility/daemon/daemon.js @@ -36,6 +36,10 @@ module.exports = function(RED) { } function runit() { + if (!node.cmd || (typeof node.cmd !== "string") || (node.cmd.length < 1)) { + node.status({fill:"grey",shape:"ring",text:"no command"}); + return; + } node.child = spawn(node.cmd, node.args); if (RED.settings.verbose) { node.log(node.cmd+" "+JSON.stringify(node.args)); } node.status({fill:"green",shape:"dot",text:"running"}); diff --git a/utility/daemon/package.json b/utility/daemon/package.json index e6f78219..694284d2 100644 --- a/utility/daemon/package.json +++ b/utility/daemon/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-daemon", - "version" : "0.0.14", + "version" : "0.0.15", "description" : "A Node-RED node that runs and monitors a long running system command.", "dependencies" : { }, From 24137380820b2a6a2404ea7c8a4f1583438ad9c4 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 27 Aug 2017 14:00:20 +0100 Subject: [PATCH 105/142] update pusher nodes to later api to close #347 and close #348 --- social/pusher/package.json | 6 +++--- social/pusher/pusher.html | 34 +++++++++++++++++++++++++++------- social/pusher/pusher.js | 37 ++++++++++++++++++++----------------- 3 files changed, 50 insertions(+), 27 deletions(-) diff --git a/social/pusher/package.json b/social/pusher/package.json index 7dfc7900..e2225318 100644 --- a/social/pusher/package.json +++ b/social/pusher/package.json @@ -1,10 +1,10 @@ { "name" : "node-red-node-pusher", - "version" : "0.0.6", + "version" : "0.1.0", "description" : "A Node-RED node to send and receive messages using Pusher.com", "dependencies" : { - "pusher": "1.0.5", - "pusher-client": "0.2.3" + "pusher": "^1.5.1", + "pusher-client": "^1.1.0" }, "repository" : { "type":"git", diff --git a/social/pusher/pusher.html b/social/pusher/pusher.html index f0053fc4..c34e41cf 100644 --- a/social/pusher/pusher.html +++ b/social/pusher/pusher.html @@ -9,8 +9,17 @@
    - - + + +
    +
    + +
    @@ -30,10 +39,11 @@ defaults: { name: {value:""}, channel: {value:"", required:true}, + cluster: {value:"mt1"}, eventname: {value:"", required:true} }, credentials: { - pusherappkey_sub: "text" + pusherappkeysub: {type:"text"} }, inputs:0, outputs:1, @@ -60,27 +70,36 @@
    - +
    - +
    - +
    +
    + + +
    +
    - From 2f14b17948c032624c4e5ac3de35e326a73e95ed Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 10 Oct 2017 23:08:34 +0100 Subject: [PATCH 121/142] bump ledborg node package --- hardware/LEDborg/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/LEDborg/package.json b/hardware/LEDborg/package.json index 3a28ce51..787b388a 100644 --- a/hardware/LEDborg/package.json +++ b/hardware/LEDborg/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-ledborg", - "version" : "0.0.17", + "version" : "0.0.18", "description" : "A Node-RED node to control a PiBorg LedBorg board for a Raspberry Pi.", "dependencies" : { }, From 3e8353fa0e18e4c9ceeaf1f0cdc2c776adbaed6b Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 22 Oct 2017 11:00:48 +0100 Subject: [PATCH 122/142] bump waht3words package add msg.payload{lat:lon} option --- parsers/what3words/README.md | 7 +++++++ parsers/what3words/package.json | 2 +- parsers/what3words/what3words.js | 17 +++++++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/parsers/what3words/README.md b/parsers/what3words/README.md index 45fd9539..6dd9d356 100644 --- a/parsers/what3words/README.md +++ b/parsers/what3words/README.md @@ -27,6 +27,11 @@ To convert position to words it requires - `msg.location.lat` - `msg.location.lon` +or + + - `msg.payload.lat` + - `msg.payload.lon` + or - `msg.payload` containing a string lat,lon @@ -36,6 +41,8 @@ To convert words to position it requires - `msg.payload` containing a string of _unique.three.words_ + A 3 word string separated by dots. + The API-key is stored in a separate credentials file. diff --git a/parsers/what3words/package.json b/parsers/what3words/package.json index 6d50f509..ea996dc7 100644 --- a/parsers/what3words/package.json +++ b/parsers/what3words/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-what3words", - "version" : "0.0.5", + "version" : "0.0.7", "description" : "A Node-RED node to convert locations to/from what3words", "dependencies" : { "geo.what3words" : "^2.0.0" diff --git a/parsers/what3words/what3words.js b/parsers/what3words/what3words.js index ea3c7af1..4d8a2fa3 100644 --- a/parsers/what3words/what3words.js +++ b/parsers/what3words/what3words.js @@ -12,10 +12,19 @@ module.exports = function(RED) { var w1 = /^\*\w{6,31}$/; var w3 = /^\w+\.\w+\.\w+$/; this.on("input", function(msg) { - if (msg.hasOwnProperty("location")) { - var lat = msg.location.lat; - var lon = msg.location.lon; - node.w3w.positionToWords({ position:lat + "," + lon, lang:node.lang }) + if (msg.hasOwnProperty("location") && msg.location.hasOwnProperty("lat") && msg.location.hasOwnProperty("lon")) { + node.w3w.positionToWords({ position:msg.location.lat + "," + msg.location.lon, lang:node.lang }) + .then(function(response) { + msg.payload = response; // prom.cape.pump + if (!msg.hasOwnProperty("topic") || (msg.topic === "")) { msg.topic = "what3words"; } + node.send(msg); + }) + .catch(function(err) { + node.warn(err) + }); + } + else if (msg.hasOwnProperty("payload") && msg.payload.hasOwnProperty("lat") && msg.payload.hasOwnProperty("lon")) { + node.w3w.positionToWords({ position:msg.payload.lat + "," + msg.payload.lon, lang:node.lang }) .then(function(response) { msg.payload = response; // prom.cape.pump if (!msg.hasOwnProperty("topic") || (msg.topic === "")) { msg.topic = "what3words"; } From cabf9ad00cc430c54f189b37d615ec9238ec9482 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sat, 28 Oct 2017 23:12:39 +0100 Subject: [PATCH 123/142] only register input listener once on daemon node to close #365 --- utility/daemon/daemon.js | 4 ++-- utility/daemon/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utility/daemon/daemon.js b/utility/daemon/daemon.js index d2eb6cbc..e3a7111f 100644 --- a/utility/daemon/daemon.js +++ b/utility/daemon/daemon.js @@ -46,8 +46,6 @@ module.exports = function(RED) { node.running = true; var line = ""; - node.on("input", inputlistener); - node.child.stdout.on('data', function (data) { if (node.op === "string") { data = data.toString(); } if (node.op === "number") { data = Number(data); } @@ -111,6 +109,8 @@ module.exports = function(RED) { }); runit(); + + node.on("input", inputlistener); } RED.nodes.registerType("daemon",DaemonNode); } diff --git a/utility/daemon/package.json b/utility/daemon/package.json index 694284d2..4cdc9392 100644 --- a/utility/daemon/package.json +++ b/utility/daemon/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-daemon", - "version" : "0.0.15", + "version" : "0.0.16", "description" : "A Node-RED node that runs and monitors a long running system command.", "dependencies" : { }, From fce96ff1967936163a4b0f3e29cd86c9ab5d4167 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 29 Oct 2017 21:54:01 +0000 Subject: [PATCH 124/142] don't remove daemon input listener on auto restart to re close #365 --- utility/daemon/daemon.js | 1 - utility/daemon/package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/utility/daemon/daemon.js b/utility/daemon/daemon.js index e3a7111f..ee2d045a 100644 --- a/utility/daemon/daemon.js +++ b/utility/daemon/daemon.js @@ -93,7 +93,6 @@ module.exports = function(RED) { if (node.redo === true) { var loop = setInterval( function() { if (!node.running) { - node.removeListener('input', inputlistener); node.warn("Restarting : " + node.cmd); runit(); } diff --git a/utility/daemon/package.json b/utility/daemon/package.json index 4cdc9392..018f0db9 100644 --- a/utility/daemon/package.json +++ b/utility/daemon/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-daemon", - "version" : "0.0.16", + "version" : "0.0.17", "description" : "A Node-RED node that runs and monitors a long running system command.", "dependencies" : { }, From 388ad11b7287d2a8615a85015f0737d77c6cd679 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sat, 4 Nov 2017 17:12:48 +0000 Subject: [PATCH 125/142] Upgrade to latest underlying npm to support node8.x LTS --- io/serialport/25-serial.html | 10 +++++++++- io/serialport/25-serial.js | 14 +++++++------- io/serialport/README.md | 9 ++------- io/serialport/package.json | 6 +++--- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/io/serialport/25-serial.html b/io/serialport/25-serial.html index b1cde5b2..287515bb 100644 --- a/io/serialport/25-serial.html +++ b/io/serialport/25-serial.html @@ -12,7 +12,7 @@ + + diff --git a/io/ping/locales/en-US/88-ping.json b/io/ping/locales/en-US/88-ping.json new file mode 100644 index 00000000..209e9da4 --- /dev/null +++ b/io/ping/locales/en-US/88-ping.json @@ -0,0 +1,8 @@ +{ + "ping": { + "label": { + "target": "Target", + "ping": "Ping (S)" + } + } +} diff --git a/io/ping/locales/ja/88-ping.json b/io/ping/locales/ja/88-ping.json new file mode 100644 index 00000000..46478887 --- /dev/null +++ b/io/ping/locales/ja/88-ping.json @@ -0,0 +1,8 @@ +{ + "ping": { + "label": { + "target": "対象", + "ping": "Ping (秒)" + } + } +} diff --git a/parsers/base64/70-base64.html b/parsers/base64/70-base64.html index c612cb64..e2d3a128 100644 --- a/parsers/base64/70-base64.html +++ b/parsers/base64/70-base64.html @@ -1,8 +1,8 @@ diff --git a/parsers/msgpack/70-msgpack.html b/parsers/msgpack/70-msgpack.html index a256c830..64361fbe 100644 --- a/parsers/msgpack/70-msgpack.html +++ b/parsers/msgpack/70-msgpack.html @@ -1,8 +1,8 @@ From 5018a3625fd5ae68d27472281e56fbed36d6dede Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 10 Nov 2017 15:25:49 +0000 Subject: [PATCH 139/142] bump package versions for ping, msg pack and base64 --- io/ping/package.json | 2 +- parsers/base64/package.json | 2 +- parsers/msgpack/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/io/ping/package.json b/io/ping/package.json index c5a7c17f..6d4ccf1f 100644 --- a/io/ping/package.json +++ b/io/ping/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-ping", - "version" : "0.0.13", + "version" : "0.0.14", "description" : "A Node-RED node to ping a remote server, for use as a keep-alive check.", "dependencies" : { }, diff --git a/parsers/base64/package.json b/parsers/base64/package.json index 83d991e6..99197caf 100644 --- a/parsers/base64/package.json +++ b/parsers/base64/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-base64", - "version" : "0.0.7", + "version" : "0.0.8", "description" : "A Node-RED node to pack and unpack objects to base64 format", "dependencies" : { }, diff --git a/parsers/msgpack/package.json b/parsers/msgpack/package.json index 170bb761..0734f2fa 100644 --- a/parsers/msgpack/package.json +++ b/parsers/msgpack/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-msgpack", - "version" : "1.0.0", + "version" : "1.0.1", "description" : "A Node-RED node to pack and unpack objects to msgpack format", "dependencies" : { "msgpack-lite" : "^0.1.26" From 0f83c8af54cbb22a1a5098acac470ab1e94d76ef Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 15 Nov 2017 10:53:31 +0000 Subject: [PATCH 140/142] update travis.yml to try to resolve grunt --- .travis.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index c74fb0dd..41485f0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,15 +18,10 @@ node_js: - "6" - "4" before_script: - - npm install istanbul + - npm install -g istanbul grunt-cli + - npm install coveralls - npm install git+https://github.com/node-red/node-red.git - export NODE_RED_HOME=`pwd`/node_modules/node-red - - (cd $NODE_RED_HOME ; npm install nock@~0.48.0 coveralls) - - export - - which grunt - - grunt --version - - pwd - - ls -lart node_modules/ - - ls -lart node_modules/.bin + - (cd $NODE_RED_HOME ; npm install nock@~0.48.0) script: - istanbul cover grunt --report lcovonly && istanbul report text && ( cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js || true ) && rm -rf coverage From 72f6c03e00a7b21776d8a1a18f7e43658937fd4e Mon Sep 17 00:00:00 2001 From: 4f96a64d <33788451+4f96a64d@users.noreply.github.com> Date: Sat, 18 Nov 2017 18:33:05 -0500 Subject: [PATCH 141/142] changed nodegroup field validation (#376) Allows letters, numbers, spaces, and ( _ . - ) to more closely align with node names in emoncms. --- io/emoncms/88-emoncms.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/emoncms/88-emoncms.html b/io/emoncms/88-emoncms.html index 76c70a0a..21fe4a9a 100644 --- a/io/emoncms/88-emoncms.html +++ b/io/emoncms/88-emoncms.html @@ -31,7 +31,7 @@ defaults: { name: {value:"Emoncms"}, emonServer: {type:"emoncms-server", required:true}, - nodegroup: {value:"", validate:function(v) {return ((v === "")||(/^\d+$/).test(v));} } + nodegroup: {value:"", validate:function(v) {return ((v === "")||(/^[\d\w\s.-]*$/).test(v));} } }, inputs:1, outputs:0, From ab99139ce3532387ed6fab360e73c1ec7ddb7453 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sat, 18 Nov 2017 23:34:39 +0000 Subject: [PATCH 142/142] bump emoncms version for nom --- io/emoncms/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/emoncms/package.json b/io/emoncms/package.json index a721d023..80355120 100644 --- a/io/emoncms/package.json +++ b/io/emoncms/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-emoncms", - "version" : "0.0.14", + "version" : "0.0.15", "description" : "A Node-RED node to fetch/post data to/from emoncms", "dependencies" : { },