1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

load of tiny listing fixes, undef, unused, etc

This commit is contained in:
Dave Conway-Jones 2016-04-09 18:00:14 +01:00
parent 37ba29484a
commit 48bcd3c7df
22 changed files with 532 additions and 535 deletions

View File

@ -7,10 +7,10 @@
"disallowMultipleSpaces": {"allowEOLComments": true},
"disallowKeywordsOnNewLine": [],
"requireSpaceBeforeBlockStatements": 1,
"requireSpaceBeforeObjectValues": false,
//"requireSpaceBeforeObjectValues": false,
//"requireSemicolons": true,
//"validateParameterSeparator": ", ",
//"validateQuoteMarks": false,
"requireSpaceAfterKeywords": ["do","for","if","else","switch","case","try","while"],
"maximumLineLength": 255,
"validateQuoteMarks": false
"maximumLineLength": 255
}

View File

@ -1,4 +1,8 @@
{
"predef": [ "RED" ],
"node": true,
"browser": true,
"jquery": true,
"asi": true, // allow missing semicolons
"curly": true, // require braces
"eqnull": true, // ignore ==null
@ -9,5 +13,6 @@
//"unused": true, // Check for unused functions and variables
"loopfunc": true, // allow functions to be defined in loops
//"expr": true, // allow ternery operator syntax...
"sub": true // don't warn that foo['bar'] should be written as foo.bar
"sub": true, // don't warn that foo['bar'] should be written as foo.bar
"undef": true // warn about undefined variables
}

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-pilcd",
"version" : "0.0.4",
"version" : "0.0.5",
"description" : "A Node-RED node for Raspberry Pi to write to HD44780 style LCD panels.",
"dependencies" : {
},

View File

@ -43,7 +43,6 @@ module.exports = function(RED) {
var node = this;
function inputlistener(msg) {
var out = msg.payload.toString();
if (RED.settings.verbose) { node.log("inp: " + msg.payload); }
if (node.child !== null) { node.child.stdin.write(msg.payload + "\n"); }
else { node.warn("Command not running"); }
@ -90,7 +89,6 @@ module.exports = function(RED) {
}
node.on("close", function(done) {
delete pinsInUse[node.pin];
if (node.child != null) {
node.child.stdin.write("c:lose" + node.pin);
node.child.kill('SIGKILL');

View File

@ -27,8 +27,7 @@ module.exports = function(RED) {
var devices = HID.devices(0x16c0,0x05df);
for (var i=0; i< devices.length; i++) {
if (devices[i].product == 'DigiUSB') {
path = devices[i].path;
node.log("found: " + path);
node.log("found: " + devices[i].path);
try {
device = new HID.HID(devices[i].path);
break;

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-digirgb",
"version" : "0.0.5",
"version" : "0.0.6",
"description" : "A Node-RED node to control a Digispark RGB LED",
"dependencies" : {
"node-hid" : "0.4.*"

View File

@ -167,7 +167,8 @@ var colours = {
'amber':'#FFD200'
};
var p1 = /^\#[A-Fa-f0-9]{6}$/
var p1 = /^\#[A-Fa-f0-9]{6}$/;
var r, g, b;
module.exports.getRGB = function(col,rgb) {
col = col.toString().toLowerCase();

View File

@ -51,7 +51,7 @@ module.exports = function(RED) {
if (this.wipe < 0) { this.wipe = 0; }
var node = this;
var needle = "255,255,255";
var p1 = /^\#[A-Fa-f0-9]{6}$/
//var p1 = /^\#[A-Fa-f0-9]{6}$/
var p2 = /^[0-9]+,[0-9]+,[0-9]+$/
var p3 = /^[0-9]+,[0-9]+,[0-9]+,[0-9]+$/
var p4 = /^[0-9]+,[0-9]+,[0-9]+,[0-9]+,[0-9]+$/
@ -125,7 +125,7 @@ module.exports = function(RED) {
if (RED.settings.verbose) { node.log("err: "+data+" :"); }
});
node.child.on('close', function (code) {
node.child.on('close', function () {
node.child = null;
if (RED.settings.verbose) { node.log(RED._("rpi-gpio.status.closed")); }
if (node.done) {

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-pi-neopixel",
"version" : "0.0.11",
"version" : "0.0.12",
"description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.",
"dependencies" : {
},

View File

@ -18,14 +18,14 @@
* limitations under the License.
**/
//might need to modify accordingly
var RED = require(process.env.NODE_RED_HOME+"/red/red");
module.exports = function(RED) {
"use strict";
//import noble
var noble = require('noble');
//import noble
var noble = require('noble');
// The main node definition - most things happen in here
function BleScan(n) {
// The main node definition - most things happen in here
function BleScan(n) {
// Create a RED node
RED.nodes.createNode(this,n);
@ -66,8 +66,8 @@ function BleScan(n) {
try { noble.stopScanning(); }
catch (err) { console.log(err); }
});
}
// Register the node by name. This must be called before overriding any of the
// Node functions.
RED.nodes.registerType("scanBLE", BleScan);
}
// Register the node by name. This must be called before overriding any of the
// Node functions.
RED.nodes.registerType("scanBLE", BleScan);

View File

@ -168,6 +168,7 @@ var colours = {
};
var hexColour = /^#([0-9A-F][0-9A-F][0-9A-F]){1,2}$/i;
var r, g, b;
module.exports.getRGB = function(col,rgb) {
if (!col) {

View File

@ -168,6 +168,7 @@ var colours = {
};
var hexColour = /^#([0-9A-F][0-9A-F][0-9A-F]){1,2}$/i;
var r, g, b;
module.exports.getRGB = function(col,rgb) {
if (!col) {

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-pi-unicorn-hat",
"version" : "0.0.12",
"version" : "0.0.13",
"description" : "A Node-RED node to output to a Raspberry Pi Unicorn HAT from Pimorini.",
"dependencies" : {
"pngjs": "2.2.*"

View File

@ -93,7 +93,7 @@ module.exports = function(RED) {
function inputlistener(msg) {
if (typeof msg.payload === "string") {
var a,b,c,d,e,i,j,x,y;
var a,b,i,j,x,y;
msg.payload = msg.payload.replace('"','');
var s = msg.payload.toUpperCase().split(",");
var doDraw = true;
@ -235,7 +235,7 @@ module.exports = function(RED) {
if (RED.settings.verbose) { node.log("err: "+data+" :"); }
});
node.child.on('close', function (code) {
node.child.on('close', function () {
node.child = null;
if (RED.settings.verbose) { node.log(RED._("rpi-gpio.status.closed")); }
if (node.done) {
@ -253,7 +253,7 @@ module.exports = function(RED) {
node.on("close", function(done) {
node.status({fill:"grey",shape:"ring",text:"closed"});
if (node.tout) { clearTimeout(tout); }
if (node.tout) { clearTimeout(node.tout); }
if (node.child != null) {
node.done = done;
node.child.kill('SIGKILL');

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-snmp",
"version" : "0.0.5",
"version" : "0.0.6",
"description" : "A Node-RED node that looks for SNMP oids.",
"dependencies" : {
"net-snmp" : "1.1.13"

View File

@ -65,6 +65,7 @@ module.exports = function(RED) {
this.oids = n.oids.replace(/\s/g,"");
this.session = snmp.createSession (this.host, this.community, {version: this.version});
var node = this;
var msg;
var maxRepetitions = 20;
function sortInt (a, b) {
@ -101,7 +102,8 @@ module.exports = function(RED) {
node.send(msg);
}
}
this.on("input",function(msg) {
this.on("input",function(m) {
msg = m;
var oids = node.oids || msg.oid;
if (oids) {
msg.oid = oids;

View File

@ -23,8 +23,8 @@ module.exports = function(RED) {
RED.nodes.createNode(this,n);
this.title = n.title;
var node = this;
this.on("input",function(msg) {
var titl = this.title || msg.topic;
node.on("input",function(msg) {
var titl = node.title || msg.topic;
if (typeof(msg.payload) == 'object') {
msg.payload = JSON.stringify(msg.payload);
}

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-notify",
"version" : "0.0.3",
"version" : "0.0.4",
"description" : "A Node-RED node to send local popup Notify alerts",
"dependencies" : {
"growl" : "1.8.1"

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-pusher",
"version" : "0.0.4",
"version" : "0.0.5",
"description" : "A Node-RED node to send and receive messages using Pusher.com",
"dependencies" : {
"pusher": "1.0.5",

View File

@ -39,7 +39,7 @@ module.exports = function(RED) {
//create a subscription to the channel and event defined by user
var socket = new PusherClient(''+this.appkey);
var my_channel = socket.subscribe(''+this.channel);
node.channel = socket.subscribe(''+this.channel);
socket.bind(''+this.eventname,
function(data) {
var msg = {topic:this.eventname};
@ -60,7 +60,6 @@ module.exports = function(RED) {
RED.nodes.createNode(this,n);
var node = this;
var credentials = this.credentials;
if ((credentials) && (credentials.hasOwnProperty("pusherappid"))) { this.appid = credentials.pusherappid; }
@ -80,25 +79,16 @@ module.exports = function(RED) {
secret: this.appsecret
});
this.on("input", function(msg) {
node.on("input", function(msg) {
pusher.trigger(this.channel, this.eventname, {
"payload": msg.payload
});
});
this.on("close", function() {
node.on("close", function() {
});
}
//debugging on the output:
var displayResult = function(result) {
node.log(result);
};
var displayError = function(err) {
node.log("Error: "+err);
};
RED.nodes.registerType("pusher in",PusherNode,{
credentials: {
pusherappkey_sub: "text"

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-timeswitch",
"version" : "0.0.4",
"version" : "0.0.5",
"description" : "A Node-RED node to provide a simple timeswitch to schedule daily on/off events.",
"dependencies" : {
"suncalc": "1.6.0"

View File

@ -370,7 +370,7 @@
url: "timeswitch/"+this.id,
type:"POST",
success: function(resp) {
RED.notify("Successfully injected: "+label,"success");
RED.notify("Successfully injected: ","success");
},
error: function(jqXHR,textStatus,errorThrown) {
if (jqXHR.status === 404) {