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

add rbe to missing payload compatible list.

This commit is contained in:
dceejay 2015-03-31 13:19:02 +01:00
parent 3896a82bd8
commit b112f03a64

View File

@ -25,25 +25,27 @@ module.exports = function(RED) {
var previous = null; var previous = null;
this.on("input",function(msg) { this.on("input",function(msg) {
if (this.func === "rbe") { if (msg.hasOwnProperty("payload")) {
if (msg.payload != previous) { if (this.func === "rbe") {
previous = msg.payload; if (msg.payload != previous) {
node.send(msg); previous = msg.payload;
}
}
else {
var n = parseFloat(msg.payload);
if (!isNaN(n)) {
if (previous == null) { previous = n - node.gap; }
if (Math.abs(n - previous) >= node.gap) {
previous = n;
node.send(msg); node.send(msg);
} }
} }
else { else {
node.warn("no number found in payload"); var n = parseFloat(msg.payload);
if (!isNaN(n)) {
if (previous == null) { previous = n - node.gap; }
if (Math.abs(n - previous) >= node.gap) {
previous = n;
node.send(msg);
}
}
else {
node.warn("no number found in payload");
}
} }
} } // ignore msg with no payload property.
}); });
} }
RED.nodes.registerType("rbe",RbeNode); RED.nodes.registerType("rbe",RbeNode);