mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
A whole bunch of whitespace linting - no functional changes
This commit is contained in:
parent
8e2352b08a
commit
e20cf97fce
@ -92,7 +92,7 @@ module.exports = function(RED) {
|
|||||||
var val;
|
var val;
|
||||||
if (node.intype == "up") { val = 1; }
|
if (node.intype == "up") { val = 1; }
|
||||||
if (node.intype == "down") { val = 0; }
|
if (node.intype == "down") { val = 0; }
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
node.send({ topic:"pi/"+node.pin, payload:val });
|
node.send({ topic:"pi/"+node.pin, payload:val });
|
||||||
node.status({fill:"grey",shape:"dot",text:RED._("rpi-gpio.status.na",{value:val})});
|
node.status({fill:"grey",shape:"dot",text:RED._("rpi-gpio.status.na",{value:val})});
|
||||||
},250);
|
},250);
|
||||||
@ -194,7 +194,7 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
node.status({fill:"grey",shape:"dot",text:"node-red:rpi-gpio.status.not-available"});
|
node.status({fill:"grey",shape:"dot",text:"node-red:rpi-gpio.status.not-available"});
|
||||||
node.on("input", function(msg){
|
node.on("input", function(msg) {
|
||||||
node.status({fill:"grey",shape:"dot",text:RED._("rpi-gpio.status.na",{value:msg.payload.toString()})});
|
node.status({fill:"grey",shape:"dot",text:RED._("rpi-gpio.status.na",{value:msg.payload.toString()})});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
node.status({fill:"grey",shape:"dot",text:"node-red:rpi-gpio.status.not-available"});
|
node.status({fill:"grey",shape:"dot",text:"node-red:rpi-gpio.status.not-available"});
|
||||||
node.on("input", function(msg){
|
node.on("input", function(msg) {
|
||||||
node.status({fill:"grey",shape:"dot",text:RED._("node-red:rpi-gpio.status.na",{value:msg.payload.toString()})});
|
node.status({fill:"grey",shape:"dot",text:RED._("node-red:rpi-gpio.status.na",{value:msg.payload.toString()})});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -145,43 +145,6 @@ module.exports = function(RED) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//case "holiday" : {
|
|
||||||
//if (DEBUG) {
|
|
||||||
//hminnode.log("Hit the holiday case");
|
|
||||||
//}
|
|
||||||
//if (!('enabled' in message.payload[key]) && !('time' in message.payload[key])) {
|
|
||||||
//hminnode.log("Warning: Unsupported 'holiday' value passed!");
|
|
||||||
//eturn;
|
|
||||||
//}
|
|
||||||
//var time = message.payload[key].time;
|
|
||||||
//// Ensure hminnode time is a date
|
|
||||||
//if (typeof(time) == "string") {
|
|
||||||
//hminnode.log("Typeof time was " +typeof(message.payload[key].time));
|
|
||||||
//// message.payload[key].time = new Date(message.payload[key].time);
|
|
||||||
//message.payload[key].time = new Date(2014, 02, 15, 12, 0, 0);
|
|
||||||
//hminnode.log("Typeof time is now " +typeof(message.payload[key].time));
|
|
||||||
//}
|
|
||||||
//// Also add in away mode (for hot water) if we're on hols
|
|
||||||
//if (message.payload[key].time) {
|
|
||||||
//message.payload.away_mode = 1;
|
|
||||||
//}
|
|
||||||
//else {
|
|
||||||
//message.payload.away_mode = 0;
|
|
||||||
//}
|
|
||||||
//break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//case "hotwater" : {
|
|
||||||
//if (DEBUG) {
|
|
||||||
//hminnode.log("Hit the hotwater case");
|
|
||||||
//}
|
|
||||||
//if (message.payload[key] !== "on" && message.payload[key] !== "boost" && message.payload[key] !== "off") {
|
|
||||||
//hminnode.log("Warning: Unsupported 'hotwater' value passed!");
|
|
||||||
//return;
|
|
||||||
//}
|
|
||||||
//break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
case "heating" : {
|
case "heating" : {
|
||||||
// Ensure heating stays last! It's got a multi write scenario
|
// Ensure heating stays last! It's got a multi write scenario
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
module.exports = function(RED) {
|
module.exports = function(RED) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
//import noble
|
//import noble
|
||||||
|
@ -44,10 +44,13 @@ module.exports = function(RED) {
|
|||||||
sensorTag.enableIrTemperature(function() {});
|
sensorTag.enableIrTemperature(function() {});
|
||||||
sensorTag.on('irTemperatureChange',
|
sensorTag.on('irTemperatureChange',
|
||||||
function(objectTemperature, ambientTemperature) {
|
function(objectTemperature, ambientTemperature) {
|
||||||
var msg = {'topic': node.topic + '/temperature'};
|
var msg = {
|
||||||
msg.payload = {'object': +objectTemperature.toFixed(1),
|
'topic': node.topic + '/temperature',
|
||||||
|
'payload': {
|
||||||
|
'object': +objectTemperature.toFixed(1),
|
||||||
'ambient': +ambientTemperature.toFixed(1)
|
'ambient': +ambientTemperature.toFixed(1)
|
||||||
};
|
}
|
||||||
|
}
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
sensorTag.enableBarometricPressure(function() {});
|
sensorTag.enableBarometricPressure(function() {});
|
||||||
@ -59,7 +62,8 @@ module.exports = function(RED) {
|
|||||||
sensorTag.enableHumidity(function() {});
|
sensorTag.enableHumidity(function() {});
|
||||||
sensorTag.on('humidityChange', function(temp, humidity) {
|
sensorTag.on('humidityChange', function(temp, humidity) {
|
||||||
var msg = {'topic': node.topic + '/humidity'};
|
var msg = {'topic': node.topic + '/humidity'};
|
||||||
msg.payload = {'temperature': +temp.toFixed(1),
|
msg.payload = {
|
||||||
|
'temperature': +temp.toFixed(1),
|
||||||
'humidity': +humidity.toFixed(1)
|
'humidity': +humidity.toFixed(1)
|
||||||
};
|
};
|
||||||
if ((temp !== -40) || (humidity !== 100)) {
|
if ((temp !== -40) || (humidity !== 100)) {
|
||||||
|
@ -30,7 +30,7 @@ module.exports = function(RED) {
|
|||||||
this.on("input", function(msg) {
|
this.on("input", function(msg) {
|
||||||
|
|
||||||
// setup the data for the URI
|
// setup the data for the URI
|
||||||
if (this.datatype == "legacy"){
|
if (this.datatype == "legacy") {
|
||||||
this.url = this.baseurl + '/input/post.json?';
|
this.url = this.baseurl + '/input/post.json?';
|
||||||
if (typeof(msg.payload) !== "string") {
|
if (typeof(msg.payload) !== "string") {
|
||||||
this.url += 'json=' + JSON.stringify(msg.payload);
|
this.url += 'json=' + JSON.stringify(msg.payload);
|
||||||
@ -44,15 +44,15 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.datatype == "fulljson"){
|
else if (this.datatype == "fulljson") {
|
||||||
this.url = this.baseurl + '/input/post?';
|
this.url = this.baseurl + '/input/post?';
|
||||||
this.url += 'fulljson=' + encodeURIComponent(JSON.stringify(msg.payload));
|
this.url += 'fulljson=' + encodeURIComponent(JSON.stringify(msg.payload));
|
||||||
}
|
}
|
||||||
else if (this.datatype == "json"){
|
else if (this.datatype == "json") {
|
||||||
this.url = this.baseurl + '/input/post?';
|
this.url = this.baseurl + '/input/post?';
|
||||||
this.url += 'json={' + encodeURIComponent(msg.payload) + '}';
|
this.url += 'json={' + encodeURIComponent(msg.payload) + '}';
|
||||||
}
|
}
|
||||||
else if (this.datatype == "CSV"){
|
else if (this.datatype == "CSV") {
|
||||||
this.url = this.baseurl + '/input/post?';
|
this.url = this.baseurl + '/input/post?';
|
||||||
this.url += 'csv=' + msg.payload;
|
this.url += 'csv=' + msg.payload;
|
||||||
}
|
}
|
||||||
|
@ -320,6 +320,7 @@ module.exports = function(RED) {
|
|||||||
obj.serial.on('error', function(err) {
|
obj.serial.on('error', function(err) {
|
||||||
RED.log.error(RED._("serial.errors.error",{port:port,error:err.toString()}));
|
RED.log.error(RED._("serial.errors.error",{port:port,error:err.toString()}));
|
||||||
obj._emitter.emit('closed');
|
obj._emitter.emit('closed');
|
||||||
|
if (obj.tout) { clearTimeout(obj.tout); }
|
||||||
obj.tout = setTimeout(function() {
|
obj.tout = setTimeout(function() {
|
||||||
setupSerial();
|
setupSerial();
|
||||||
}, settings.serialReconnectTime);
|
}, settings.serialReconnectTime);
|
||||||
@ -328,6 +329,7 @@ module.exports = function(RED) {
|
|||||||
if (!obj._closing) {
|
if (!obj._closing) {
|
||||||
RED.log.error(RED._("serial.errors.unexpected-close",{port:port}));
|
RED.log.error(RED._("serial.errors.unexpected-close",{port:port}));
|
||||||
obj._emitter.emit('closed');
|
obj._emitter.emit('closed');
|
||||||
|
if (obj.tout) { clearTimeout(obj.tout); }
|
||||||
obj.tout = setTimeout(function() {
|
obj.tout = setTimeout(function() {
|
||||||
setupSerial();
|
setupSerial();
|
||||||
}, settings.serialReconnectTime);
|
}, settings.serialReconnectTime);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-serialport",
|
"name" : "node-red-node-serialport",
|
||||||
"version" : "0.8.3",
|
"version" : "0.8.4",
|
||||||
"description" : "Node-RED nodes to talk to serial ports",
|
"description" : "Node-RED nodes to talk to serial ports",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"serialport" : "^7.1.5"
|
"serialport" : "^7.1.5"
|
||||||
|
@ -67,7 +67,6 @@ module.exports = function(RED) {
|
|||||||
node.log('subscribing to: '+node.topic);
|
node.log('subscribing to: '+node.topic);
|
||||||
node.client.subscribe(node.topic, function(body, headers) {
|
node.client.subscribe(node.topic, function(body, headers) {
|
||||||
var newmsg={"headers":headers,"topic":node.topic}
|
var newmsg={"headers":headers,"topic":node.topic}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
newmsg.payload = JSON.parse(body);
|
newmsg.payload = JSON.parse(body);
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,19 @@
|
|||||||
|
|
||||||
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
// Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
// Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
// * Neither the name of Smaz nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
// Neither the name of Smaz nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||||
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Our compression codebook
|
// Our compression codebook
|
||||||
var rc = [
|
var rc = [
|
||||||
" ", "the", "e", "t", "a", "of", "o", "and", "i", "n", "s", "e ", "r", " th", " t", "in", "he", "th", "h", "he ", "to", "\r\n", "l", "s ", "d", " a", "an","er", "c", " o", "d ", "on", " of", "re", "of ", "t ", ", ", "is", "u", "at", " ", "n ", "or", "which", "f", "m", "as", "it", "that", "\n", "was", "en", " ", " w", "es", " an", " i", "\r", "f ", "g", "p", "nd", " s", "nd ", "ed ", "w", "ed", "http://", "for", "te", "ing", "y ", "The", " c", "ti", "r ", "his", "st", " in", "ar", "nt", ",", " to", "y", "ng", " h", "with", "le", "al", "to ", "b", "ou", "be", "were", " b", "se", "o ", "ent", "ha", "ng ", "their", "\"", "hi", "from", " f", "in ", "de", "ion", "me", "v", ".", "ve", "all", "re ", "ri", "ro", "is ", "co", "f t", "are", "ea", ". ", "her", " m", "er ", " p", "es ", "by", "they", "di", "ra", "ic", "not", "s, ", "d t", "at ", "ce", "la", "h ", "ne", "as ", "tio", "on ", "n t", "io", "we", " a ", "om", ", a", "s o", "ur", "li", "ll", "ch", "had", "this", "e t", "g ", "e\r\n", " wh", "ere", " co", "e o", "a ", "us", " d", "ss", "\n\r\n", "\r\n\r", "=\"", " be", " e", "s a", "ma", "one", "t t", "or ", "but", "el", "so", "l ", "e s", "s,", "no", "ter", " wa", "iv", "ho", "e a", " r", "hat", "s t", "ns", "ch ", "wh", "tr", "ut", "/", "have", "ly ", "ta", " ha", " on", "tha", "-", " l", "ati", "en ", "pe", " re", "there", "ass", "si", " fo", "wa", "ec", "our", "who", "its", "z", "fo", "rs", ">", "ot", "un", "<", "im", "th ", "nc", "ate", "><", "ver", "ad", " we", "ly", "ee", " n", "id", " cl", "ac", "il", "</", "rt", " wi", "div", "e, ", " it", "whi", " ma", "ge", "x", "�", "\'>", "=\'"];
|
" ", "the", "e", "t", "a", "of", "o", "and", "i", "n", "s", "e ", "r", " th", " t", "in", "he", "th", "h", "he ", "to", "\r\n", "l", "s ", "d", " a", "an","er", "c", " o", "d ", "on", " of", "re", "of ", "t ", ", ", "is", "u", "at", " ", "n ", "or", "which", "f", "m", "as", "it", "that", "\n", "was", "en", " ", " w", "es", " an", " i", "\r", "f ", "g", "p", "nd", " s", "nd ", "ed ", "w", "ed", "http://", "for", "te", "ing", "y ", "The", " c", "ti", "r ", "his", "st", " in", "ar", "nt", ",", " to", "y", "ng", " h", "with", "le", "al", "to ", "b", "ou", "be", "were", " b", "se", "o ", "ent", "ha", "ng ", "their", "\"", "hi", "from", " f", "in ", "de", "ion", "me", "v", ".", "ve", "all", "re ", "ri", "ro", "is ", "co", "f t", "are", "ea", ". ", "her", " m", "er ", " p", "es ", "by", "they", "di", "ra", "ic", "not", "s, ", "d t", "at ", "ce", "la", "h ", "ne", "as ", "tio", "on ", "n t", "io", "we", " a ", "om", ", a", "s o", "ur", "li", "ll", "ch", "had", "this", "e t", "g ", "e\r\n", " wh", "ere", " co", "e o", "a ", "us", " d", "ss", "\n\r\n", "\r\n\r", "=\"", " be", " e", "s a", "ma", "one", "t t", "or ", "but", "el", "so", "l ", "e s", "s,", "no", "ter", " wa", "iv", "ho", "e a", " r", "hat", "s t", "ns", "ch ", "wh", "tr", "ut", "/", "have", "ly ", "ta", " ha", " on", "tha", "-", " l", "ati", "en ", "pe", " re", "there", "ass", "si", " fo", "wa", "ec", "our", "who", "its", "z", "fo", "rs", ">", "ot", "un", "<", "im", "th ", "nc", "ate", "><", "ver", "ad", " we", "ly", "ee", " n", "id", " cl", "ac", "il", "</", "rt", " wi", "div", "e, ", " it", "whi", " ma", "ge", "x", "�", "\'>", "=\'"];
|
||||||
|
|
||||||
var cb = rc.reduce(function(result, item, index, array) {
|
var cb = rc.reduce(function(result, item, index, array) {
|
||||||
@ -63,9 +68,7 @@ var smaz = module.exports = {
|
|||||||
}
|
}
|
||||||
// Emit the byte
|
// Emit the byte
|
||||||
output.push(code);
|
output.push(code);
|
||||||
|
|
||||||
input_index += j;
|
input_index += j;
|
||||||
|
|
||||||
encoded = true;
|
encoded = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -74,7 +77,6 @@ var smaz = module.exports = {
|
|||||||
// Match not found - add the byte to the verbatim buffer
|
// Match not found - add the byte to the verbatim buffer
|
||||||
verbatim += input[input_index];
|
verbatim += input[input_index];
|
||||||
input_index++;
|
input_index++;
|
||||||
|
|
||||||
// Flush if we reached the verbatim bytes length limit
|
// Flush if we reached the verbatim bytes length limit
|
||||||
if (verbatim.length == 256) {
|
if (verbatim.length == 256) {
|
||||||
output = output.concat(smaz.flush_verbatim(verbatim));
|
output = output.concat(smaz.flush_verbatim(verbatim));
|
||||||
@ -101,7 +103,7 @@ var smaz = module.exports = {
|
|||||||
}
|
}
|
||||||
output += String.fromCharCode(input[i+1]);
|
output += String.fromCharCode(input[i+1]);
|
||||||
i += 2;
|
i += 2;
|
||||||
} else if(input[i] === 255) {
|
} else if (input[i] === 255) {
|
||||||
// Verbatim string
|
// Verbatim string
|
||||||
var j;
|
var j;
|
||||||
if (i+input[i+1]+2 >= input.length) {
|
if (i+input[i+1]+2 >= input.length) {
|
||||||
|
@ -55,7 +55,7 @@ module.exports = function(RED) {
|
|||||||
if (flag) {
|
if (flag) {
|
||||||
RED.nodes.addCredentials(n.id,{userid:this.userid, password:this.password, global:true});
|
RED.nodes.addCredentials(n.id,{userid:this.userid, password:this.password, global:true});
|
||||||
}
|
}
|
||||||
if (n.tls === false){
|
if (n.tls === false) {
|
||||||
this.tls = false;
|
this.tls = false;
|
||||||
}
|
}
|
||||||
var node = this;
|
var node = this;
|
||||||
@ -289,7 +289,7 @@ module.exports = function(RED) {
|
|||||||
// and pass in the email message. The parser will signal when it has parsed the message.
|
// and pass in the email message. The parser will signal when it has parsed the message.
|
||||||
SimpleParser(data, {}, function(err, parsed) {
|
SimpleParser(data, {}, function(err, parsed) {
|
||||||
//node.log(util.format("SimpleParser: on(end): %j", mailObject));
|
//node.log(util.format("SimpleParser: on(end): %j", mailObject));
|
||||||
if (err){
|
if (err) {
|
||||||
node.status({fill:"red", shape:"ring", text:"email.status.parseerror"});
|
node.status({fill:"red", shape:"ring", text:"email.status.parseerror"});
|
||||||
node.error(RED._("email.errors.parsefail", {folder:node.box}), err);
|
node.error(RED._("email.errors.parsefail", {folder:node.box}), err);
|
||||||
}
|
}
|
||||||
@ -391,7 +391,7 @@ module.exports = function(RED) {
|
|||||||
imapMessage.on('body', function(stream, info) {
|
imapMessage.on('body', function(stream, info) {
|
||||||
//console.log("> message - body - stream=?, info=%j", info);
|
//console.log("> message - body - stream=?, info=%j", info);
|
||||||
SimpleParser(stream, {}, function(err, parsed) {
|
SimpleParser(stream, {}, function(err, parsed) {
|
||||||
if (err){
|
if (err) {
|
||||||
node.status({fill:"red", shape:"ring", text:"email.status.parseerror"});
|
node.status({fill:"red", shape:"ring", text:"email.status.parseerror"});
|
||||||
node.error(RED._("email.errors.parsefail", {folder:node.box}),err);
|
node.error(RED._("email.errors.parsefail", {folder:node.box}),err);
|
||||||
}
|
}
|
||||||
|
@ -519,10 +519,10 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function filterdActiveDevices(devices){
|
function filterdActiveDevices(devices) {
|
||||||
var activeDevices = [];
|
var activeDevices = [];
|
||||||
for(var i=0;i<devices.length;i++){
|
for (var i=0; i<devices.length; i++) {
|
||||||
if(devices[i].active){
|
if (devices[i].active) {
|
||||||
activeDevices.push(devices[i]);
|
activeDevices.push(devices[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ module.exports = function(RED) {
|
|||||||
// Is it base64 encoded or binary?
|
// Is it base64 encoded or binary?
|
||||||
var attachmentString = attachment.toString();
|
var attachmentString = attachment.toString();
|
||||||
var attachmentBuffer = Buffer.from(attachmentString,'base64');
|
var attachmentBuffer = Buffer.from(attachmentString,'base64');
|
||||||
if(attachmentString === attachmentBuffer.toString('base64')) {
|
if (attachmentString === attachmentBuffer.toString('base64')) {
|
||||||
// If converts back to same, then it was base64 so set to binary
|
// If converts back to same, then it was base64 so set to binary
|
||||||
// https://stackoverflow.com/a/48770228
|
// https://stackoverflow.com/a/48770228
|
||||||
attachment = attachmentBuffer;
|
attachment = attachmentBuffer;
|
||||||
|
@ -505,7 +505,7 @@ module.exports = function(RED) {
|
|||||||
var missingUsernames = Object.keys(missingUsers).join(",");
|
var missingUsernames = Object.keys(missingUsers).join(",");
|
||||||
return node.twitterConfig.getUsers(missingUsernames).then(function() {
|
return node.twitterConfig.getUsers(missingUsernames).then(function() {
|
||||||
var len = tweets.length;
|
var len = tweets.length;
|
||||||
for (var i = 0;i < len; i++) {
|
for (var i = 0; i < len; i++) {
|
||||||
var tweet = messages[i];
|
var tweet = messages[i];
|
||||||
var output = tweets[i];
|
var output = tweets[i];
|
||||||
output.sender = userObjectCache[tweet.message_create.sender_id];
|
output.sender = userObjectCache[tweet.message_create.sender_id];
|
||||||
|
@ -49,7 +49,7 @@ module.exports = function(RED) {
|
|||||||
var bind = [];
|
var bind = [];
|
||||||
|
|
||||||
var doQuery = function(msg) {
|
var doQuery = function(msg) {
|
||||||
if (node.sqlquery == "msg.topic"){
|
if (node.sqlquery == "msg.topic") {
|
||||||
if (typeof msg.topic === 'string') {
|
if (typeof msg.topic === 'string') {
|
||||||
if (msg.topic.length > 0) {
|
if (msg.topic.length > 0) {
|
||||||
bind = Array.isArray(msg.payload) ? msg.payload : [];
|
bind = Array.isArray(msg.payload) ? msg.payload : [];
|
||||||
@ -84,7 +84,7 @@ module.exports = function(RED) {
|
|||||||
node.status({fill:"red", shape:"dot",text:"msg.topic error"});
|
node.status({fill:"red", shape:"dot",text:"msg.topic error"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node.sqlquery == "fixed"){
|
if (node.sqlquery == "fixed") {
|
||||||
if (typeof node.sql === 'string') {
|
if (typeof node.sql === 'string') {
|
||||||
if (node.sql.length > 0) {
|
if (node.sql.length > 0) {
|
||||||
node.mydbConfig.db.all(node.sql, bind, function(err, row) {
|
node.mydbConfig.db.all(node.sql, bind, function(err, row) {
|
||||||
@ -96,14 +96,14 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
if (node.sql === null || node.sql == "") {
|
if (node.sql === null || node.sql == "") {
|
||||||
node.error("SQL statement config not set up",msg);
|
node.error("SQL statement config not set up",msg);
|
||||||
node.status({fill:"red",shape:"dot",text:"SQL config not set up"});
|
node.status({fill:"red",shape:"dot",text:"SQL config not set up"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node.sqlquery == "prepared"){
|
if (node.sqlquery == "prepared") {
|
||||||
if (typeof node.sql === 'string' && typeof msg.params !== "undefined" && typeof msg.params === "object") {
|
if (typeof node.sql === 'string' && typeof msg.params !== "undefined" && typeof msg.params === "object") {
|
||||||
if (node.sql.length > 0) {
|
if (node.sql.length > 0) {
|
||||||
node.mydbConfig.db.all(node.sql, msg.params, function(err, row) {
|
node.mydbConfig.db.all(node.sql, msg.params, function(err, row) {
|
||||||
|
@ -75,7 +75,7 @@ module.exports = function(RED) {
|
|||||||
else {
|
else {
|
||||||
if (exifData) {
|
if (exifData) {
|
||||||
msg.exif = exifData;
|
msg.exif = exifData;
|
||||||
if((exifData.hasOwnProperty("gps")) && (Object.keys(exifData.gps).length !== 0)) {
|
if ((exifData.hasOwnProperty("gps")) && (Object.keys(exifData.gps).length !== 0)) {
|
||||||
addMsgLocationDataFromExifGPSData(msg);
|
addMsgLocationDataFromExifGPSData(msg);
|
||||||
}
|
}
|
||||||
//else { node.log("The incoming image did not contain Exif GPS data."); }
|
//else { node.log("The incoming image did not contain Exif GPS data."); }
|
||||||
|
Loading…
Reference in New Issue
Block a user