node-red-contrib-boolean-logic-ultimate 1.0.45 → 1.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # node-red-contrib-boolean-logic-ultimate
2
2
  [![Donate via PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square)](https://www.paypal.me/techtoday)
3
3
 
4
+ <p>
5
+ <b>Version 1.0.46</b> February 2022<br/>
6
+ - NEW: Interrupt Flow: msg.reset will delete the stored message.</br>
7
+ - Updated the README file with samples.</br>
8
+ </p>
4
9
  <p>
5
10
  <b>Version 1.0.45</b> February 2022<br/>
6
11
  - NEW: Interrupt Flow: Now you can auto-toggle the startup behavior selection (to stop or to pass telegrams) after some pre-defined delays.</br>
package/README.md CHANGED
@@ -116,9 +116,41 @@ Resets all inputs to undefined.
116
116
 
117
117
  # INTERRUPT FLOWS ULTIMATE
118
118
 
119
- Whenever this node receives a payload = false from a specific topic, it stops output messages to the flow. As soon it receives payload = true from this topic, the output messages start to flow out again.<br/>
119
+ **Trigger by topic**
120
+
121
+ Whenever the node receives a payload = false from this topic,it stops output messages to the flow.<br/>
122
+ As soon it receives payload = true from this topic, the output messages start to flow out again. <br/>
123
+ The node will output the current stored message plus an added property "isReplay = true", as soon as it receives a ***msg.play = true*** from this topic.<br/>
124
+ The node will clear the current stored message, as soon as it receives a ***msg.reset = true*** from this topic.<br/>
120
125
  The node tries to convert any arbitrary input value to a valid boolean value. It converts Homeassistant ***"on"*** and ***"off"*** to true/false values as well.<br/>
121
- The *Then* option, allow you to auto toggle the selected start state (pass or block) after a timer has elapsed. You can choose from some pre-defined delays. If you have, for example, an Homekit-Bridged nodeset with a thermostat node or security system node in your flow, once node-red restarts, these homekit nodes output a default message to the flow. Just put an InterruptFlow node with a "block at start" behaviour and a toggle delay enabled behind homekit nodes, to temporary stop the chained nodes to receive the unwanted startup message.</br>
126
+
127
+ **Then**
128
+ This property, allow you to auto toggle the selected start state (pass or block) after a timer has elapsed. You can choose from some pre-defined delays. If you have, for example, an Homekit-Bridged nodeset with a thermostat node or security system node in your flow, once node-red restarts, these homekit nodes output a default message to the flow. Just put an InterruptFlow node with a "block at start" behaviour and a toggle delay enabled behind homekit nodes, to temporary stop the chained nodes to receive the unwanted startup message.</br>
129
+ </br>
130
+
131
+ **INPUT MSG HWITH "TRIGGER" TOPIC**
132
+
133
+ Pass <code>msg.payload = true</code> to allow messages to pass through</br>
134
+ Pass <code>msg.payload = false</code> to prevent messages from passing through</br>
135
+ Pass <code>msg.play = true</code> from a message having the "trigger" topic, to replay the last stored message</br>
136
+ Pass <code>msg.reset = true</code> from a message having the "trigger" topic, to clear the last stored message</br>
137
+
138
+ <code>
139
+ // Assume you set the "trigger by topic" field to "trigger"
140
+ // This code replays the last message and adds the property msg.isReplay = true to the output message.
141
+ msg.topic = "trigger"
142
+ msg.play = true;
143
+ </code>
144
+
145
+ <code>
146
+ // Assume you set the "trigger by topic" field to "trigger"
147
+ // This code clears the last stored message
148
+ msg.topic = "trigger"
149
+ msg.reset = true;
150
+ </code>
151
+
152
+ </br>
153
+
122
154
  See the example below.<br/>
123
155
 
124
156
  <img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-boolean-logic-ultimate/master/img/if0.png' width='60%'>
@@ -49,7 +49,8 @@
49
49
  <label for="node-input-triggertopic"><i class="icon-tag"></i> Trigger by topic</label>
50
50
  <input type="text" id="node-input-triggertopic" placeholder="Name">
51
51
  <div><i>Whenever the node receives a payload = false from this topic,<br/> it stops output messages to the flow.<br/>As soon it receives payload = true from this topic,<br/>the output messages start to flow out again.
52
- <br/>The node will output the current stored message<br/>plus an added property "isReplay = true",<br/>as soon as it receives a "play" = true from this topic.
52
+ <br/>The node will output the current stored message<br/>plus an added property "isReplay = true",<br/>as soon as it receives a "play" = true from this topic.</br>
53
+ The node will clear the current stored message, as soon as it receives a "msg.reset = true" from this topic.
53
54
  </i></div>
54
55
  </div>
55
56
 
@@ -55,17 +55,25 @@ module.exports = function (RED) {
55
55
  if (node.timerAutoToggle !== null) clearInterval(node.timerAutoToggle);
56
56
 
57
57
  if (msg.hasOwnProperty("play")) {
58
- node.currentMsg.isReplay = true;
59
- setNodeStatus({ fill: "yellow", shape: "dot", text: "-> replay" });
60
- // Restore previous status
61
- setTimeout(() => {
62
- if (node.bInviaMessaggio) {
63
- setNodeStatus({ fill: "green", shape: "dot", text: "-> pass" });
64
- } else {
65
- setNodeStatus({ fill: "red", shape: "dot", text: "|| stop (stored last msg)" });
66
- }
67
- }, 1000)
68
- node.send(node.currentMsg);
58
+ if (node.currentMsg.payload !== undefined) {
59
+ node.currentMsg.isReplay = true;
60
+ setNodeStatus({ fill: "yellow", shape: "dot", text: "-> replay" });
61
+ // Restore previous status
62
+ setTimeout(() => {
63
+ if (node.bInviaMessaggio) {
64
+ setNodeStatus({ fill: "green", shape: "dot", text: "-> pass" });
65
+ } else {
66
+ setNodeStatus({ fill: "red", shape: "dot", text: "|| stop (stored last msg)" });
67
+ }
68
+ }, 1000)
69
+ node.send(node.currentMsg);
70
+ } else {
71
+ setNodeStatus({ fill: "grey", shape: "dot", text: "Nothing to replay" });
72
+ }
73
+ return;
74
+ } else if (msg.hasOwnProperty("reset")) {
75
+ node.currentMsg = {};
76
+ setNodeStatus({ fill: "yellow", shape: "dot", text: "Deleted stored msg" });
69
77
  return;
70
78
  } else if (msg.payload === true) {
71
79
  node.bInviaMessaggio = true;
@@ -79,7 +87,7 @@ module.exports = function (RED) {
79
87
  }
80
88
  }
81
89
  if (node.bInviaMessaggio) {
82
- node.currentMsg = msg;
90
+ node.currentMsg = RED.util.cloneMessage(msg);
83
91
  node.send(msg);
84
92
  }
85
93
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-boolean-logic-ultimate",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "A set of Node-RED enhanced boolean logic node, flow interruption node, blinker node, invert node, filter node, with persisten values after reboot and more.",
5
5
  "author": "Supergiovane (https://github.com/Supergiovane)",
6
6
  "dependencies": {