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

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.45</b> February 2022<br/>
6
+ - NEW: Interrupt Flow: Now you can auto-toggle the startup behavior selection (to stop or to pass telegrams) after some pre-defined delays.</br>
7
+ - Updated the README file with samples.</br>
8
+ </p>
4
9
  <p>
5
10
  <b>Version 1.0.44</b> February 2022<br/>
6
11
  - Boolean Logic Ultimate: Added the "d" indication, in the node's name, when the delay option is enabled.</br>
package/README.md CHANGED
@@ -118,12 +118,14 @@ Resets all inputs to undefined.
118
118
 
119
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/>
120
120
  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>
122
+ See the example below.<br/>
121
123
 
122
124
  <img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-boolean-logic-ultimate/master/img/if0.png' width='60%'>
123
125
 
124
126
  <details><summary>CLICK HERE, copy and paste it into your flow</summary>
125
127
  <code>
126
- [{"id":"1fd91f1f.c1fae9","type":"InterruptFlowUltimate","z":"a76c6a12.37379","name":"Interrupt Flow","triggertopic":"IsNight","x":360,"y":440,"wires":[["b9844c7f.0f306"]]},{"id":"eaa32462.398808","type":"comment","z":"a76c6a12.37379","name":"Pushbutton to switch on stairs light, only if it's night, using flow interruption","info":"","x":300,"y":400,"wires":[]},{"id":"10787f38.edfe81","type":"inject","z":"a76c6a12.37379","name":"","topic":"IsNight","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":540,"wires":[["1fd91f1f.c1fae9"]]},{"id":"a6092a15.1c592","type":"inject","z":"a76c6a12.37379","name":"","topic":"IsNight","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":580,"wires":[["1fd91f1f.c1fae9"]]},{"id":"21ba9c30.02abbc","type":"comment","z":"a76c6a12.37379","name":"Brightness sensor","info":"","x":130,"y":500,"wires":[]},{"id":"af131ae5.a1bfb8","type":"inject","z":"a76c6a12.37379","name":"","topic":"Pushbutton","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":440,"wires":[["1fd91f1f.c1fae9"]]},{"id":"b9844c7f.0f306","type":"debug","z":"a76c6a12.37379","name":"Temporized Stairs Lightbulb","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":600,"y":440,"wires":[]}]
128
+ [{"id":"1fd91f1f.c1fae9","type":"InterruptFlowUltimate","z":"96f56ceb91657677","name":"Interrupt Flow","triggertopic":"IsNight","initializewith":"1","autoToggle":"0","x":420,"y":200,"wires":[["b9844c7f.0f306"]]},{"id":"eaa32462.398808","type":"comment","z":"96f56ceb91657677","name":"Motion sensor to switch on stairs light, only if it's night, using flow interruption","info":"","x":350,"y":160,"wires":[]},{"id":"10787f38.edfe81","type":"inject","z":"96f56ceb91657677","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"IsNight","payload":"true","payloadType":"bool","x":170,"y":300,"wires":[["1fd91f1f.c1fae9"]]},{"id":"a6092a15.1c592","type":"inject","z":"96f56ceb91657677","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"IsNight","payload":"false","payloadType":"bool","x":170,"y":340,"wires":[["1fd91f1f.c1fae9"]]},{"id":"21ba9c30.02abbc","type":"comment","z":"96f56ceb91657677","name":"Brightness sensor","info":"","x":170,"y":260,"wires":[]},{"id":"af131ae5.a1bfb8","type":"inject","z":"96f56ceb91657677","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"MotionSensor","payload":"true","payloadType":"bool","x":190,"y":200,"wires":[["1fd91f1f.c1fae9"]]},{"id":"b9844c7f.0f306","type":"debug","z":"96f56ceb91657677","name":"Temporized Stairs Lightbulb","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":660,"y":200,"wires":[]},{"id":"a5305f8bef578897","type":"comment","z":"96f56ceb91657677","name":"Temporary stop the flow, with Toggle","info":"","x":220,"y":440,"wires":[]},{"id":"ffc9d3b9d17bc07b","type":"InterruptFlowUltimate","z":"96f56ceb91657677","name":"Interrupt Flow with toggle","triggertopic":"trigger","initializewith":"0","autoToggle":"20","x":400,"y":480,"wires":[["14a72f83f29bb347"]]},{"id":"398548646f66c457","type":"inject","z":"96f56ceb91657677","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"date","x":170,"y":480,"wires":[["ffc9d3b9d17bc07b"]]},{"id":"14a72f83f29bb347","type":"debug","z":"96f56ceb91657677","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":480,"wires":[]}]
127
129
  </code>
128
130
  </details>
129
131
 
@@ -136,7 +138,7 @@ This allow to save the state of a node and then replay it back whenever you want
136
138
 
137
139
  <details><summary>CLICK HERE, copy and paste it into your flow</summary>
138
140
  <code>
139
- [{"id":"9839dd47.81b2c8","type":"InterruptFlowUltimate","z":"1b769f85.fba14","name":"Interrupt Flow","triggertopic":"trigger","x":520,"y":260,"wires":[["d371d690.1e2fe8"]]},{"id":"568deb73.394fb4","type":"comment","z":"1b769f85.fba14","name":"1) Push buttons to change values","info":"","x":130,"y":100,"wires":[]},{"id":"e1c9f10a.0ba518","type":"inject","z":"1b769f85.fba14","name":"ALLOW","topic":"trigger","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":70,"y":320,"wires":[["9839dd47.81b2c8"]]},{"id":"82ba24f9.0f0bd8","type":"inject","z":"1b769f85.fba14","name":"INTERRUPT","topic":"trigger","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":280,"wires":[["9839dd47.81b2c8"]]},{"id":"23ba4f9c.86de9","type":"comment","z":"1b769f85.fba14","name":"2) Push INTERRUPT, then try again to change value (1)","info":"","x":200,"y":240,"wires":[]},{"id":"24671ef2.4519e2","type":"inject","z":"1b769f85.fba14","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":70,"y":140,"wires":[["9839dd47.81b2c8"]]},{"id":"d371d690.1e2fe8","type":"debug","z":"1b769f85.fba14","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":690,"y":260,"wires":[]},{"id":"409ec415.735d74","type":"inject","z":"1b769f85.fba14","name":"REPLAY","topic":"trigger","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":80,"y":420,"wires":[["6653ed0.7186014"]]},{"id":"6653ed0.7186014","type":"change","z":"1b769f85.fba14","name":"Play","rules":[{"t":"set","p":"play","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":210,"y":420,"wires":[["9839dd47.81b2c8"]]},{"id":"e957a069.0ac458","type":"inject","z":"1b769f85.fba14","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":70,"y":180,"wires":[["9839dd47.81b2c8"]]},{"id":"8f0af608.8fb45","type":"comment","z":"1b769f85.fba14","name":"3) Replay last message stored by the node","info":"","x":160,"y":380,"wires":[]},{"id":"46e6f455.0023ac","type":"comment","z":"1b769f85.fba14","name":"You can use Interruptflow, to save the state of a node, and then replay the last state as you want.","info":"","x":330,"y":60,"wires":[]}]
141
+ [{"id":"9839dd47.81b2c8","type":"InterruptFlowUltimate","z":"1337569a6adbb2e3","name":"Interrupt Flow","triggertopic":"trigger","initializewith":"1","autoToggle":"0","x":580,"y":300,"wires":[["d371d690.1e2fe8"]]},{"id":"568deb73.394fb4","type":"comment","z":"1337569a6adbb2e3","name":"1) Push buttons to change values","info":"","x":190,"y":140,"wires":[]},{"id":"e1c9f10a.0ba518","type":"inject","z":"1337569a6adbb2e3","name":"ALLOW","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"trigger","payload":"true","payloadType":"bool","x":130,"y":360,"wires":[["9839dd47.81b2c8"]]},{"id":"82ba24f9.0f0bd8","type":"inject","z":"1337569a6adbb2e3","name":"INTERRUPT","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"trigger","payload":"false","payloadType":"bool","x":150,"y":320,"wires":[["9839dd47.81b2c8"]]},{"id":"23ba4f9c.86de9","type":"comment","z":"1337569a6adbb2e3","name":"2) Push INTERRUPT, then try again to change value (1)","info":"","x":260,"y":280,"wires":[]},{"id":"24671ef2.4519e2","type":"inject","z":"1337569a6adbb2e3","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":130,"y":180,"wires":[["9839dd47.81b2c8"]]},{"id":"d371d690.1e2fe8","type":"debug","z":"1337569a6adbb2e3","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":750,"y":300,"wires":[]},{"id":"409ec415.735d74","type":"inject","z":"1337569a6adbb2e3","name":"REPLAY","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"trigger","payload":"","payloadType":"str","x":140,"y":460,"wires":[["6653ed0.7186014"]]},{"id":"6653ed0.7186014","type":"change","z":"1337569a6adbb2e3","name":"Play","rules":[{"t":"set","p":"play","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":460,"wires":[["9839dd47.81b2c8"]]},{"id":"e957a069.0ac458","type":"inject","z":"1337569a6adbb2e3","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":130,"y":220,"wires":[["9839dd47.81b2c8"]]},{"id":"8f0af608.8fb45","type":"comment","z":"1337569a6adbb2e3","name":"3) Replay last message stored by the node","info":"","x":220,"y":420,"wires":[]},{"id":"46e6f455.0023ac","type":"comment","z":"1337569a6adbb2e3","name":"You can use Interruptflow, to save the state of a node, and then replay the last state as you want.","info":"","x":390,"y":100,"wires":[]}]
140
142
  </code>
141
143
  </details>
142
144
 
@@ -6,6 +6,7 @@
6
6
  name: { value: "Interrupt Flow" },
7
7
  triggertopic: { value: "trigger" },
8
8
  initializewith: { value: "1" },
9
+ autoToggle: { value: "0" }
9
10
  },
10
11
  inputs: 1,
11
12
  outputs: 1,
@@ -53,10 +54,24 @@
53
54
  </div>
54
55
 
55
56
  <div class="form-row">
56
- <label for="node-input-initializewith"><i class="fa fa-home"></i> At node-red start</label>
57
+ <label style="width:160px" for="node-input-initializewith"><i class="fa fa-home"></i> At node-red start</label>
57
58
  <select type="text" id="node-input-initializewith" placeholder="">
58
59
  <option value="1">Pass telegrams</option>
59
60
  <option value="0">Block telegrams</option>
61
+ </select>
62
+ </div>
63
+ <div class="form-row">
64
+ <label style="width:160px" for="node-input-autoToggle"><i class="fa fa-hourglass-o"></i> Then</label>
65
+ <select type="text" id="node-input-autoToggle" placeholder="">
66
+ <option value="0">Nothing</option>
67
+ <option value="10">Toggle above option after 10 seconds</option>
68
+ <option value="20">Toggle above option after 20 seconds</option>
69
+ <option value="30">Toggle above option after 30 seconds</option>
70
+ <option value="40">Toggle above option after 40 seconds</option>
71
+ <option value="50">Toggle above option after 50 seconds</option>
72
+ <option value="60">Toggle above option after 60 seconds</option>
73
+ <option value="90">Toggle above option after 90 seconds</option>
74
+ <option value="120">Toggle above option after 120 seconds</option>
60
75
  </select>
61
76
  </div>
62
77
  </script>
@@ -6,6 +6,8 @@ module.exports = function (RED) {
6
6
  node.currentMsg = {}; // Stores current payload
7
7
  node.sTriggerTopic = node.config.triggertopic.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '') || "trigger"; // Topic controlling the bInviaMessaggio
8
8
  node.bInviaMessaggio = (node.config.initializewith === undefined || node.config.initializewith === "1") ? true : false; // Send the message or not
9
+ node.autoToggle = config.autoToggle === undefined ? 0 : parseInt(config.autoToggle); // Auto toggle the selected "initializewith" after a while (useful for homekit bridged, that sends junk after start)
10
+ node.timerAutoToggle = null;
9
11
 
10
12
  function setNodeStatus({ fill, shape, text }) {
11
13
  var dDate = new Date();
@@ -14,12 +16,25 @@ module.exports = function (RED) {
14
16
  setNodeStatus({ fill: "green", shape: "ring", text: "-> pass" });
15
17
 
16
18
 
17
- if (node.bInviaMessaggio) {
18
- setNodeStatus({ fill: "green", shape: "dot", text: "-> pass" });
19
- } else {
20
- setNodeStatus({ fill: "red", shape: "dot", text: "|| stop" });
19
+ node.alignStatus = () => {
20
+ let sAutoToggle = node.autoToggle > 0 ? " (Autotoggle in " + node.autoToggle + "s)" : "";
21
+ if (node.bInviaMessaggio) {
22
+ setNodeStatus({ fill: "green", shape: "dot", text: "-> pass" + sAutoToggle });
23
+ } else {
24
+ setNodeStatus({ fill: "red", shape: "dot", text: "|| stop" + sAutoToggle });
25
+ }
21
26
  }
22
27
 
28
+ if (node.autoToggle > 0) {
29
+ node.timerAutoToggle = setTimeout(() => {
30
+ node.autoToggle = 0;
31
+ node.bInviaMessaggio = !node.bInviaMessaggio;
32
+ node.alignStatus();
33
+ }, node.autoToggle * 1000);
34
+ }
35
+
36
+ node.alignStatus();
37
+
23
38
  this.on('input', function (msg) {
24
39
  var sIncomingTopic = "";
25
40
  if (msg.hasOwnProperty("topic")) {
@@ -36,10 +51,8 @@ module.exports = function (RED) {
36
51
 
37
52
  msg.payload = ToBoolean(msg.payload); // 15/11/2021 Convert input to boolean.
38
53
 
39
- // if (msg.payload !== true && msg.payload !== false) {
40
- // setNodeStatus({ fill: "red", shape: "dot", text: "Received non boolean value from " + sIncomingTopic });
41
- // return;
42
- // }
54
+ // 28/01/2022 Stop autotoggle
55
+ if (node.timerAutoToggle !== null) clearInterval(node.timerAutoToggle);
43
56
 
44
57
  if (msg.hasOwnProperty("play")) {
45
58
  node.currentMsg.isReplay = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-boolean-logic-ultimate",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
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": {