Update RBE to add object compare

and narrowband mode (thanks @nlecaude for the idea)
This commit is contained in:
Dave Conway-Jones
2016-02-02 13:39:37 +00:00
parent ed4b6b18ec
commit 6c3dbbbfbb
5 changed files with 101 additions and 22 deletions

View File

@@ -20,12 +20,17 @@
<select type="text" id="node-input-func" style="width:74%;">
<option value="rbe" data-i18n="rbe.opts.rbe"></option>
<option value="deadband" data-i18n="rbe.opts.deadband"></option>
<option value="narrowband" data-i18n="rbe.opts.narrowband"></option>
</select>
</div>
<div class="form-row" id="node-bandgap">
<label for="node-input-gap">&nbsp;</label>
<input type="text" id="node-input-gap" data-i18n="[placeholder]rbe.placeholder.bandgap" style="width:71%;">
</div>
<div class="form-row" id="node-startvalue">
<label for="node-input-start"><i class="fa fa-thumb-tack"/> <span data-i18n="rbe.label.start"></span></label>
<input type="text" id="node-input-start" data-i18n="[placeholder]rbe.placeholder.start" style="width:71%;">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"/> <span data-i18n="rbe.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]rbe.label.name" style="width:71%;">
@@ -35,11 +40,14 @@
<script type="text/x-red" data-help-name="rbe">
<p>Report by Exception node - only passes on data if it has changed.</p>
<p>The node can either block until the <b>msg.payload</b> is
different to the previous one - <b>rbe</b> mode. Works on numbers and strings.</p>
different to the previous one - <b>rbe</b> mode. This works on numbers, strings, and simple objects.</p>
<p>Or it can block until the value changes by a specified amount - <b>deadband</b> mode.</p>
<p>In deadband mode the incoming payload should contain a parseable <i>number</i> and is
<p>In deadband mode the incoming payload must 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>
<p>Deadband also supports % - only sends if the input differs by more than x% of the original value.</p>
<p>It can also ignore outlier values - <b>narrowband</b> mode.</p>
<p>In narrowband mode the incoming payload is blocked if it is more than + or - the band gap
away from the previous value. Useful for ignoring outliers from a faulty sensor for example.</p>
<p><b>Note:</b> This works on a per <b>msg.topic</b> basis. This means that a single rbe node can
handle multiple topics at the same time.</p>
</script>
@@ -51,7 +59,8 @@
defaults: {
name: {value:""},
func: {value:"rbe"},
gap: {value:"",validate:RED.validators.regex(/^(\d*[.]*\d*|)(%|)$/)}
gap: {value:"",validate:RED.validators.regex(/^(\d*[.]*\d*|)(%|)$/)},
start: {value:""}
},
inputs:1,
outputs:1,
@@ -70,6 +79,11 @@
} else {
$("#node-bandgap").show();
}
if ($("#node-input-func").val() === "narrowband") {
$("#node-startvalue").show();
} else {
$("#node-startvalue").hide();
}
});
}
});