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;
this.on("input",function(msg) {
if (this.func === "rbe") {
if (msg.payload != previous) {
previous = msg.payload;
node.send(msg);
}
}
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;
if (msg.hasOwnProperty("payload")) {
if (this.func === "rbe") {
if (msg.payload != previous) {
previous = msg.payload;
node.send(msg);
}
}
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);