diff --git a/.travis.yml b/.travis.yml index 00382962..dc63b2e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,8 @@ before_install: before_script: - npm install -g istanbul - npm install coveralls -- npm install git+https://github.com/node-red/node-red.git +- npm install node-red +#- 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 ) script: diff --git a/README.md b/README.md index 1823e4d4..15eb25ee 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,16 @@ A collection of nodes for [Node-RED](http://nodered.org). See below for a list. ## Installation -Most of these nodes are available as npm packages. See the list below for the npm package names, or [search npm](https://www.npmjs.org/search?q=node-red-node). +Most of these nodes are available as npm packages. See the list below for the npm p +ackage names, or [search npm](https://www.npmjs.org/search?q=node-red-node-). To install cd node-red npm install node-red-node-{*filename*} -This repository acts as an overall store for these nodes - and is no longer intended as a way to install them - unless you really do want some bloat. +This repository acts as an overall store for these nodes - and is no longer +intended as a way to install them - unless you really do want some bloat. To manually install using this repo: @@ -23,9 +25,12 @@ To manually install using this repo: ## Contributing -Now that we support npm installaton of nodes we recommend people post their own via [npm](https://www.npmjs.org/). Please read the [packaging guide notes](http://nodered.org/docs/creating-nodes/packaging.html). +Now that we support npm installaton of nodes we recommend people post their own +via [npm](https://www.npmjs.org/). Please read +the [packaging guide notes](http://nodered.org/docs/creating-nodes/packaging.html). -If you are an IBMer, please contact us directly as the contribution process is slightly different. +If you are an IBMer, please contact us directly as the contribution process +is slightly different. ## Copyright and license @@ -40,7 +45,7 @@ NPM name - File-link - Description **node-red-node-wordpos** - *[72-wordpos](analysis/wordpos)* - Analyses the payload and classifies the part-of-speech of each word. The resulting message has msg.pos added with the results. A word may appear in multiple categories (eg, 'great' is both a noun and an adjective). -**node-red-node-wordpos** - *[74-swearfilter](analysis/swearfilter)* - Analyses the payload and tries to filter out any messages containing bad swear words. This only operates on payloads of type string. Everything else is blocked. +**node-red-node-badwords** - *[74-swearfilter](analysis/swearfilter)* - Analyses the payload and tries to filter out any messages containing bad swear words. This only operates on payloads of type string. Everything else is blocked. ### Function @@ -66,9 +71,9 @@ NPM name - File-link - Description **node-red-node-wemo** - *[60-wemo](hardware/wemo)* - Basic node to drive a [WeMo](http://www.belkin.com/us/Products/home-automation/c/wemo-home-automation/) socket and switch. Does not use discovery. -**N/A** - *[42-makey](hardware/makey)* - A Node-RED node to read from a [MakeyMakey](http://www.makeymakey.com/) input device. +**node-red-node-makeymakey** - *[42-makey](hardware/makey)* - A Node-RED node to read from a [MakeyMakey](http://www.makeymakey.com/) input device. -**N/A** - *[79-sensorTag](hardware/sensorTag)* - Reads data from the Ti Bluetooh Low Energy (BLE) SensorTag device. +**node-red-node-sensortag** - *[79-sensorTag](hardware/sensorTag)* - Reads data from the Ti Bluetooh Low Energy (BLE) SensorTag device. **N/A** - *[100-heatmiser-in](hardware/heatmiser)* - Writes settings for temperature and frost protection to Heatmiser thermostats. @@ -90,9 +95,6 @@ NPM name - File-link - Description **N/A** - *[88-emoncms](io/emoncms)* - Adds node to post to an [Emoncms](http://emoncms.org/) server. -**N/A** - *[26-rawserial](io/rawserial)* - Only really needed for Windows boxes without serialport npm module installed. -Uses a simple read of the serial port as a file to input data. You **must** set the baud rate etc externally *before* starting Node-RED. This node does not implement pooling of connections so only one instance of each port may be used - so in **or** out but **not** both. - ### Social **node-red-node-twilio** - *[56-twilio](social/twilio)* - Uses [Twilio](https://www.twilio.com/) service to send/receive text messages. @@ -111,8 +113,6 @@ Uses a simple read of the serial port as a file to input data. You **must** set **node-red-node-xmpp** - *[92-xmpp](social/xmpp)* - Connects to an XMPP server to send and receive messages. -**N/A** - *[69-mpd](social/music)* - MPD music control nodes. Output node expects payload to be a valid mpc command. Currently only simple commands that expect no reply are supported. Input node creates a payload object with Artist, Album, Title, Genre and Date. - **N/A** - *[79-snapchat](social/snapchat)* - Downloads [SnapChat](https://www.snapchat.com/) images from the account specified. **N/A** - *[114-pusher](social/pusher)* - Publish-Subscribe to a [Pusher](http://pusher.com/) channel/event. @@ -125,13 +125,17 @@ Uses a simple read of the serial port as a file to input data. You **must** set **node-red-node-sqlite** - *[sqlite](storage/sqlite)* - Supports read and write to a local sqlite database. -**node-red-node-ddb** - *[69-ddbout](https://github.com/wnagele/node-red-node-ddb)* - Support output to Amazon DynamoDB. This version deprecated - now moved to it's own npm. **Note:** you cannot have both version installed - if you do install from npm then please manually delete the version from your node-red-nodes/storage/ddb directory. - -**N/A** - *[110-postgres](storage/postgres)* - PostgreSql I/O node. - ### Time -**node-red-node-suncalc** - *[79-suncalc](time)* - Uses the suncalc module to generate an output at sunrise and sunset based on a specified location. Several choices of definition of sunrise and sunset are available, +**node-red-node-suncalc** - *[79-suncalc](time/suncalc)* - Uses the suncalc module to generate an output at sunrise and sunset based on a specified location. Several choices of definition of sunrise and sunset are available, + +### Utility + +**node-red-node-exif** - *[94-exif](utility/exif)* - Extracts GPS and other EXIF information from a passed in jpeg image, + +**node-red-node-daemon** - *[daemon](utility/daemon)* - starts up (calls) a long running system program and pipes STDIN, STDOUT and STDERR to and from that process. Good for monitoring long running command line applications, + + ### Misc diff --git a/io/mdns/mdns.js b/io/mdns/mdns.js index 8972aec3..e2964287 100644 --- a/io/mdns/mdns.js +++ b/io/mdns/mdns.js @@ -43,7 +43,7 @@ module.exports = function(RED) { browser.start(); node.on("close", function () { - browser.stop(); + if (browser) { browser.stop(); } }); } diff --git a/io/rawserial/26-rawserial.html b/io/rawserial/26-rawserial.html deleted file mode 100644 index 040bad96..00000000 --- a/io/rawserial/26-rawserial.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - diff --git a/io/rawserial/26-rawserial.js b/io/rawserial/26-rawserial.js deleted file mode 100644 index 5f25ecd2..00000000 --- a/io/rawserial/26-rawserial.js +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Copyright 2013 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -module.exports = function(RED) { - "use strict"; - var settings = RED.settings; - var util = require("util"); - var fs = require('fs'); - var plat = require('os').platform(); - var pre = "\\\\.\\"; - - if (!plat.match(/^win/)) { - pre = ""; - throw "Info : only needed for Windows boxes without serialport npm module installed."; - //util.log("[26-rawserial.js] Info : only really needed for Windows boxes without serialport npm module installed."); - } - - function RawSerialInNode(n) { - RED.nodes.createNode(this,n); - this.port = n.port; - this.splitc = n.splitc||null; - this.out = n.out||"char"; - this.bin = n.bin||false; - if (this.splitc == '\\n') { this.splitc = "\n"; } - if (this.splitc == '\\r') { this.splitc = "\r"; } - if (!isNaN(parseInt(this.splitc))) { this.splitc = parseInt(this.splitc); } - var node = this; - - var setupSerial = function() { - node.inp = fs.createReadStream(pre+node.port); - node.log("open "+pre+node.port); - node.tout = null; - var line = ""; - var buf = new Buffer(32768); - var i = 0; - node.inp.on('data', function (data) { - for (var z = 0; z < data.length; z++) { - if ((node.out === "time") && (node.splitc !== 0)) { - if (node.tout) { - i += 1; - buf[i] = data[z]; - } - else { - node.tout = setTimeout(function () { - node.tout = null; - var m = new Buffer(i+1); - buf.copy(m,0,0,i+1); - if (node.bin !== "true") { m = m.toString(); } - node.send({"payload": m}); - m = null; - }, node.splitc); - i = 0; - buf[0] = data[z]; - } - } - else if ((node.out == "char") && (node.splitc != null)) { - buf[i] = data[z]; - i += 1; - if ((data[z] === node.splitc.charCodeAt(0)) || (i === 32768)) { - var m = new Buffer(i); - buf.copy(m,0,0,i); - if (node.bin !== "true") { m = m.toString(); } - node.send({"payload":m}); - m = null; - i = 0; - } - } - else { - if (node.bin !== "true") { node.send({"payload": String.fromCharCode(data[z])}); } - else { node.send({"payload": new Buffer([data[z]])});} - } - } - }); - //node.inp.on('end', function (error) {console.log("End", error);}); - node.inp.on('close', function (error) { - node.log(node.port+" closed"); - node.tout = setTimeout(function() { - setupSerial(); - },settings.serialReconnectTime); - }); - node.inp.on('error', function(error) { - if (error.code == "ENOENT") { node.log(node.port+" not found"); } - else { node.log(node.port+" error "+error); } - node.tout = setTimeout(function() { - setupSerial(); - },settings.serialReconnectTime); - }); - } - setupSerial(); - - node.on('close', function() { - if (node.tout) { clearTimeout(node.tout); } - if (node.inp) { node.inp.pause(); } - }); - - } - RED.nodes.registerType("rawserial in",RawSerialInNode); - - - function RawSerialOutNode(n) { - RED.nodes.createNode(this,n); - this.port = n.port; - var node = this; - - var setupSerial = function() { - node.oup = fs.createWriteStream(pre+node.port,{ flags:'w', encoding:'utf8', mode:'0666' }); - node.on("input", function(msg) { - if (msg.payload != null) { - node.oup.write(msg.payload); - } - }); - node.oup.on('open', function (error) { node.log("opened "+node.port); }); - node.oup.on('end', function (error) { node.log("end :"+error); }); - node.oup.on('close', function (error) { - node.log(node.port+" closed"); - node.tout = setTimeout(function() { - setupSerial(); - },settings.serialReconnectTime); - }); - node.oup.on('error', function(error) { - if (error.code == "EACCES") { node.log("can't access port "+node.port); } - else if (error.code == "EIO") { node.log("can't write to port "+node.port); } - else { node.log(node.port+" error "+error); } - node.tout = setTimeout(function() { - setupSerial(); - },settings.serialReconnectTime); - }); - } - setupSerial(); - - node.on('close', function() { - if (node.tout) { clearTimeout(node.tout); } - }); - } - RED.nodes.registerType("rawserial out",RawSerialOutNode); -} diff --git a/social/music/69-mpd.html b/social/music/69-mpd.html deleted file mode 100644 index bfa11854..00000000 --- a/social/music/69-mpd.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - diff --git a/social/music/69-mpd.js b/social/music/69-mpd.js deleted file mode 100644 index 13711775..00000000 --- a/social/music/69-mpd.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright 2013 IBM Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -module.exports = function(RED) { - "use strict"; - var util = require("util"); - var exec = require('child_process').exec; - var komponist = require('komponist'); - var mpc = null; - exec("which mpd",function(err,stdout,stderr) { - if (stdout.indexOf('mpd') == -1) { - throw 'Error: Cannot find "mpd" command. Please install MPD.'; - } - }); - - exec("netstat -an | grep LISTEN | grep 6600",function(err,stdout,stderr) { - if (stdout.indexOf('6600') == -1) { - throw '[69-mpd.js] Error: MPD daemon not listening on port 6600. Please start MPD.'; - } - komponist.createConnection(6600, 'localhost', function(err, client) { - if (err) { node.error("MPD: Failed to connect to MPD server"); } - mpc = client; - }); - }); - - - function MPDOut(n) { - RED.nodes.createNode(this,n); - var node = this; - node.mpc = mpc; - - if (mpc != null) { - this.on("input", function(msg) { - try { - //node.mpc.command(msg.payload); - node.mpc.command(msg.payload, msg.param, function(err, results) { - if (err) { node.log("error: "+err); } - //else { console.log(results); } - }); - } catch (err) { node.log("error: "+err); } - }); - - node.mpc.on('error', function(err) { - node.log("error: "+err); - }); - } - else { node.warn("MPD not running"); } - } - RED.nodes.registerType("mpd out",MPDOut); - - function MPDIn(n) { - RED.nodes.createNode(this,n); - var node = this; - node.mpc = mpc; - var oldMsg = ""; - - if (mpc != null) { - getSong(); - - var getSong = function() { - node.mpc.currentsong(function(err, info) { - if (err) { node.log(err); } - else { - var msg = {payload:{},topic:"music"}; - msg.payload.Artist = info.Artist; - msg.payload.Album = info.Album; - msg.payload.Title = info.Title; - msg.payload.Genre = info.Genre; - msg.payload.Date = info.Date; - if (JSON.stringify(msg) != oldMsg) { - node.send(msg); - oldMsg = JSON.stringify(msg); - } - } - }); - } - - node.mpc.on('changed', function(system) { - getSong(); - }); - - this.on("close", function() { - // node.mpc.command("stop"); - }); - } - else { node.warn("MPD not running"); } - } - RED.nodes.registerType("mpd in",MPDIn); -} diff --git a/social/music/icons/music.png b/social/music/icons/music.png deleted file mode 100644 index 4e99a1bf..00000000 Binary files a/social/music/icons/music.png and /dev/null differ diff --git a/storage/ddb/README.md b/storage/ddb/README.md deleted file mode 100644 index 61032d2a..00000000 --- a/storage/ddb/README.md +++ /dev/null @@ -1,3 +0,0 @@ -node-red-node-ddb -================= -Moved to: https://github.com/wnagele/node-red-node-ddb diff --git a/storage/postgres/README.md b/storage/postgres/README.md deleted file mode 100644 index 09be7ba6..00000000 --- a/storage/postgres/README.md +++ /dev/null @@ -1,4 +0,0 @@ -node-red-node-postgres -====================== - -Moved to: https://www.npmjs.com/package/node-red-contrib-postgres