mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Tiny tidy up of RBE node
This commit is contained in:
parent
ba557b93c1
commit
7338a17991
@ -1,7 +1,8 @@
|
||||
node-red-node-rbe
|
||||
=================
|
||||
|
||||
A <a href="http://nodered.org" target="_new">Node-RED</a> node that provides provides report-by-exception (RBE) and deadband capability.
|
||||
A <a href="http://nodered.org" target="_new">Node-RED</a> node that provides
|
||||
provides report-by-exception (RBE) and deadband capability.
|
||||
|
||||
Install
|
||||
-------
|
||||
@ -14,15 +15,18 @@ Run the following command in the root directory of your Node-RED install
|
||||
Usage
|
||||
-----
|
||||
|
||||
A simple node to provide report by exception (RBE) and deadband function - only passes on data if it has changed.
|
||||
A simple node to provide report by exception (RBE) and deadband function
|
||||
- only passes on data if it has changed.
|
||||
|
||||
###RBE mode
|
||||
|
||||
Outputs the **msg** if the **msg.payload** is different to the previous one. Works on numbers and strings. Useful for filtering out repeated messages of the same value. Saves bandwidth, etc...
|
||||
Outputs the **msg** if the **msg.payload** is different to the previous one.
|
||||
Works on numbers and strings. Useful for filtering out repeated messages of the
|
||||
same value. Saves bandwidth, etc...
|
||||
|
||||
###Deadband mode
|
||||
|
||||
In deadband mode the incoming payload should contain a parseable *number* and is
|
||||
output only if greater than + or - the *band gap* away from the previous output.
|
||||
output only if greater than + or - the *band gap* away from the previous output.
|
||||
|
||||
Will accept numbers, or strings like "18.4 C" or "$500"
|
||||
Will accept numbers, or parseable strings like "18.4 C" or "$500"
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-rbe",
|
||||
"version" : "0.0.1",
|
||||
"version" : "0.0.2",
|
||||
"description" : "A Node-RED node that provides report-by-exception (RBE) and deadband capability.",
|
||||
"dependencies" : {
|
||||
},
|
||||
|
@ -34,9 +34,9 @@
|
||||
|
||||
<script type="text/x-red" data-help-name="rbe">
|
||||
<p>Report by Exception node - only passes on data if it has changed.</p>
|
||||
<p>In RBE mode this node only outputs the msg if the <b>msg.payload</b> is
|
||||
<p>In <b>RBE</b> mode this node only outputs the msg if the <b>msg.payload</b> is
|
||||
different to the previous one. Works on numbers and strings.</p>
|
||||
<p>In deadband mode the incoming payload should contain a parseable <i>number</i> and is
|
||||
<p>In <b>deadband</b> mode the incoming payload should contain a parseable <i>number</i> and is
|
||||
output only if greater than + or - the <i>band gap</i> away from the previous output.</p>
|
||||
</script>
|
||||
|
||||
|
@ -33,8 +33,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
else {
|
||||
var n = parseFloat(msg.payload);
|
||||
if (previous == null) { previous = n - node.gap; }
|
||||
if (!isNaN(n)) {
|
||||
if (previous == null) { previous = n - node.gap; }
|
||||
if (Math.abs(n - previous) >= node.gap) {
|
||||
previous = n;
|
||||
node.send(msg);
|
||||
|
Loading…
Reference in New Issue
Block a user