2015-01-23 14:34:10 +01:00
|
|
|
<!--
|
2015-07-15 00:03:46 +02:00
|
|
|
Copyright 2014, 2015 IBM Corp.
|
2015-01-23 14:34:10 +01:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<script type="text/x-red" data-template-name="rbe">
|
|
|
|
<div class="form-row">
|
2015-07-14 22:03:07 +02:00
|
|
|
<label for="node-input-func"><i class="fa fa-wrench"></i> <span data-i18n="rbe.label.func"></span></label>
|
2015-01-23 14:34:10 +01:00
|
|
|
<select type="text" id="node-input-func" style="width:74%;">
|
2015-07-14 22:03:07 +02:00
|
|
|
<option value="rbe" data-i18n="rbe.opts.rbe"></option>
|
2015-07-14 23:01:08 +02:00
|
|
|
<option value="deadband" data-i18n="rbe.opts.deadband"></option>
|
2016-02-02 14:39:37 +01:00
|
|
|
<option value="narrowband" data-i18n="rbe.opts.narrowband"></option>
|
2015-01-23 14:34:10 +01:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="form-row" id="node-bandgap">
|
2015-07-14 23:01:08 +02:00
|
|
|
<label for="node-input-gap"> </label>
|
|
|
|
<input type="text" id="node-input-gap" data-i18n="[placeholder]rbe.placeholder.bandgap" style="width:71%;">
|
2015-01-23 14:34:10 +01:00
|
|
|
</div>
|
2016-02-02 14:39:37 +01:00
|
|
|
<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>
|
2015-01-23 14:34:10 +01:00
|
|
|
<div class="form-row">
|
2015-07-14 22:03:07 +02:00
|
|
|
<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%;">
|
2015-01-23 14:34:10 +01:00
|
|
|
</div>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/x-red" data-help-name="rbe">
|
|
|
|
<p>Report by Exception node - only passes on data if it has changed.</p>
|
2015-07-15 00:03:46 +02:00
|
|
|
<p>The node can either block until the <b>msg.payload</b> is
|
2016-02-02 14:39:37 +01:00
|
|
|
different to the previous one - <b>rbe</b> mode. This works on numbers, strings, and simple objects.</p>
|
2015-07-15 00:03:46 +02:00
|
|
|
<p>Or it can block until the value changes by a specified amount - <b>deadband</b> mode.</p>
|
2016-02-02 14:39:37 +01:00
|
|
|
<p>In deadband mode the incoming payload must contain a parseable <i>number</i> and is
|
2015-01-23 14:34:10 +01:00
|
|
|
output only if greater than + or - the <i>band gap</i> away from the previous output.</p>
|
2015-07-14 22:03:07 +02:00
|
|
|
<p>Deadband also supports % - only sends if the input differs by more than x% of the original value.</p>
|
2016-02-02 14:39:37 +01:00
|
|
|
<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>
|
2015-07-14 22:03:07 +02:00
|
|
|
<p><b>Note:</b> This works on a per <b>msg.topic</b> basis. This means that a single rbe node can
|
2015-07-15 00:03:46 +02:00
|
|
|
handle multiple topics at the same time.</p>
|
2015-01-23 14:34:10 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2015-07-14 22:03:07 +02:00
|
|
|
RED.nodes.registerType("rbe", {
|
2015-01-23 14:34:10 +01:00
|
|
|
color:"#E2D96E",
|
|
|
|
category: 'function',
|
|
|
|
defaults: {
|
|
|
|
name: {value:""},
|
|
|
|
func: {value:"rbe"},
|
2016-02-02 14:39:37 +01:00
|
|
|
gap: {value:"",validate:RED.validators.regex(/^(\d*[.]*\d*|)(%|)$/)},
|
|
|
|
start: {value:""}
|
2015-01-23 14:34:10 +01:00
|
|
|
},
|
|
|
|
inputs:1,
|
|
|
|
outputs:1,
|
2015-07-14 23:10:18 +02:00
|
|
|
icon: "rbe.png",
|
2015-01-23 14:34:10 +01:00
|
|
|
label: function() {
|
|
|
|
return this.name||this.func||"rbe";
|
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
|
|
|
//$( "#node-input-gap" ).spinner({min:0});
|
|
|
|
$("#node-input-func").on("change",function() {
|
|
|
|
if ($("#node-input-func").val() === "rbe") {
|
|
|
|
$("#node-bandgap").hide();
|
|
|
|
} else {
|
|
|
|
$("#node-bandgap").show();
|
|
|
|
}
|
2016-02-02 14:39:37 +01:00
|
|
|
if ($("#node-input-func").val() === "narrowband") {
|
|
|
|
$("#node-startvalue").show();
|
|
|
|
} else {
|
|
|
|
$("#node-startvalue").hide();
|
|
|
|
}
|
2015-01-23 14:34:10 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|