mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
add reset capability to rue node
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-rbe",
|
||||
"version" : "0.1.13",
|
||||
"version" : "0.1.14",
|
||||
"description" : "A Node-RED node that provides report-by-exception (RBE) and deadband capability.",
|
||||
"dependencies" : {
|
||||
},
|
||||
|
@@ -41,6 +41,9 @@
|
||||
<dt class="optional">topic <span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>if specified the function will work on a per topic basis.</dd>
|
||||
<dt class="optional">reset<span class="property-type">any</span></dt>
|
||||
<dd>if set clears the stored value for the specified msg.topic, or
|
||||
all topics if msg.topic is not specified.</dd>
|
||||
</dl>
|
||||
<h3>Outputs</h3>
|
||||
<dl class="message-properties">
|
||||
|
@@ -18,6 +18,12 @@ module.exports = function(RED) {
|
||||
|
||||
node.previous = {};
|
||||
this.on("input",function(msg) {
|
||||
if (msg.hasOwnProperty("reset")) {
|
||||
if (msg.hasOwnProperty("topic") && (typeof msg.topic === "string") && (msg.topic !== "")) {
|
||||
delete node.previous[msg.topic];
|
||||
}
|
||||
else { node.previous = {}; }
|
||||
}
|
||||
if (msg.hasOwnProperty("payload")) {
|
||||
var t = msg.topic || "_no_topic";
|
||||
if ((this.func === "rbe") || (this.func === "rbei")) {
|
||||
|
Reference in New Issue
Block a user