node-red-contrib-boolean-logic-ultimate 1.0.50 → 1.0.51

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,13 @@
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
+ # CHANGELOG
5
+
6
+ <p>
7
+ <b>Version 1.0.51</b> February 2022<br/>
8
+ - Blinker Ultimate: fixed minor problem with an orphan timer.</br>
9
+ - Better scoping of some vars, to leave the memory garbace collector to get rid of unused references.</br>
10
+ </p>
4
11
  <p>
5
12
  <b>Version 1.0.50</b> February 2022<br/>
6
13
  - NEW: Added Youtube example for each node. You can find the link in the config window of each one and hede the playlist https://youtube.com/playlist?list=PL9Yh1bjbLAYoRH4IyQB7EL5srHAihiKpy.</br>
package/README.md CHANGED
@@ -10,10 +10,7 @@
10
10
  [![Donate via PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square)](https://www.paypal.me/techtoday)
11
11
  [![youtube][youtube-image]][youtube-url]
12
12
 
13
- A set of Node-RED enhanced boolean logic, with persisten values after reboot and more.
14
-
15
- > Welcome! First of all thank you for your interest in my nodes. This is a set of logic nodes, to overcome the simplicity of the default node-red boolean logic nodes.
16
- Hope you enjoy that and if you're in trouble, please ask!
13
+ A set of Node-RED enhanced boolean logic and utility nodes, with persistent values after reboot. Compatible also with Homeassistant ON and OFF values.
17
14
 
18
15
  <br/>
19
16
  <br/>
@@ -12,12 +12,13 @@ module.exports = function (RED) {
12
12
  node.stopbehaviorPIN2 = node.stopbehaviorPIN2 == "0" ? false : true;
13
13
 
14
14
  function setNodeStatus({ fill, shape, text }) {
15
- var dDate = new Date();
15
+ let dDate = new Date();
16
16
  node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" })
17
17
  }
18
18
 
19
19
  // 12/04/2021 Autostart blinker?
20
20
  if (config.initializewith !== undefined && config.initializewith === "1") {
21
+ if (node.tBlinker !== null) clearInterval(node.tBlinker);
21
22
  node.tBlinker = setInterval(handleTimer, node.blinkfrequency); // Start the timer that handles the queue of telegrams
22
23
  node.isBlinking = true;
23
24
  setNodeStatus({ fill: "green", shape: "dot", text: "-> Autostarted" });
@@ -68,9 +69,9 @@ module.exports = function (RED) {
68
69
 
69
70
 
70
71
  function ToBoolean(value) {
71
- var res = false;
72
- var decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
73
-
72
+ let res = false;
73
+ let decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
74
+
74
75
  if (typeof value === 'boolean') {
75
76
  res = value;
76
77
  }
@@ -82,8 +83,7 @@ module.exports = function (RED) {
82
83
 
83
84
  // Is it formated as a decimal number?
84
85
  if (decimal.test(value)) {
85
- var v = parseFloat(value);
86
- res = v != 0;
86
+ res = parseFloat(value) != 0;
87
87
  }
88
88
  else {
89
89
  res = value.toLowerCase() === "true";
@@ -39,7 +39,6 @@
39
39
  inputs: 1,
40
40
  outputs: 3,
41
41
  outputLabels: function (i) {
42
- var ret = "";
43
42
  switch (i) {
44
43
  case 0:
45
44
  return "AND";
@@ -17,7 +17,7 @@ module.exports = function (RED) {
17
17
  node.inputMessage = {}; // 26/01/2022 input message is stored here.
18
18
 
19
19
  function setNodeStatus({ fill, shape, text }) {
20
- var dDate = new Date();
20
+ let dDate = new Date();
21
21
  node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" })
22
22
  }
23
23
 
@@ -221,7 +221,7 @@ module.exports = function (RED) {
221
221
  for (let index = 0; index < nTotalDummyToCreate; index++) {
222
222
  node.jSonStates["dummy" + index] = node.sInitializeWith === "false" ? false : true;
223
223
  }
224
- setTimeout(() => { setNodeStatus({ fill: "green", shape: "ring", text: "Initialized " + nTotalDummyToCreate + " undefined inputs with " + node.sInitializeWith }); }, 4000)
224
+ let t = setTimeout(() => { setNodeStatus({ fill: "green", shape: "ring", text: "Initialized " + nTotalDummyToCreate + " undefined inputs with " + node.sInitializeWith }); }, 4000)
225
225
  }
226
226
  }
227
227
  }
@@ -278,8 +278,8 @@ module.exports = function (RED) {
278
278
  }
279
279
 
280
280
  function ToBoolean(value) {
281
- var res = false;
282
- var decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
281
+ let res = false;
282
+ let decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
283
283
 
284
284
  if (typeof value === 'boolean') {
285
285
  res = value;
@@ -291,8 +291,7 @@ module.exports = function (RED) {
291
291
 
292
292
  // Is it formated as a decimal number?
293
293
  if (decimal.test(value)) {
294
- var v = parseFloat(value);
295
- res = v != 0;
294
+ res = parseFloat(value) != 0;
296
295
  }
297
296
  else {
298
297
  res = value.toLowerCase() === "true";
@@ -5,7 +5,7 @@ module.exports = function (RED) {
5
5
  var node = this;
6
6
 
7
7
  function setNodeStatus({ fill, shape, text }) {
8
- var dDate = new Date();
8
+ let dDate = new Date();
9
9
  node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" })
10
10
  }
11
11
 
@@ -47,8 +47,8 @@ module.exports = function (RED) {
47
47
 
48
48
 
49
49
  function ToBoolean(value) {
50
- var res = false;
51
- var decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
50
+ let res = false;
51
+ let decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
52
52
 
53
53
  if (typeof value === 'boolean') {
54
54
  res = value;
@@ -60,8 +60,7 @@ module.exports = function (RED) {
60
60
 
61
61
  // Is it formated as a decimal number?
62
62
  if (decimal.test(value)) {
63
- var v = parseFloat(value);
64
- res = v != 0;
63
+ res = parseFloat(value) != 0;
65
64
  }
66
65
  else {
67
66
  res = value.toLowerCase() === "true";
@@ -12,7 +12,7 @@ module.exports = function (RED) {
12
12
  node.isPlaying = false;
13
13
 
14
14
  node.setNodeStatus = ({ fill, shape, text }) => {
15
- var dDate = new Date();
15
+ let dDate = new Date();
16
16
  node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" })
17
17
  }
18
18
  async function delay(ms) {
@@ -26,15 +26,15 @@ module.exports = function (RED) {
26
26
  // 29/08/2020 triggered by button press
27
27
  node.buttonpressed = () => {
28
28
  setNodeStatus({ fill: "green", shape: "dot", text: "Pin1:true, Pin2:false, Pin3:" + node.curVal.toString() + " (next " + (!node.curVal).toString() + ")" });
29
- var msgTrue = { payload: true, topic: node.topic };
30
- var msgFalse = { payload: false, topic: node.topic };
31
- var msgToggled = { payload: node.curVal, topic: node.topic };
29
+ let msgTrue = { payload: true, topic: node.topic };
30
+ let msgFalse = { payload: false, topic: node.topic };
31
+ let msgToggled = { payload: node.curVal, topic: node.topic };
32
32
  node.curVal = !node.curVal;
33
33
  node.send([msgTrue, msgFalse, msgToggled]);
34
34
  }
35
35
 
36
36
  function setNodeStatus({ fill, shape, text }) {
37
- var dDate = new Date();
37
+ let dDate = new Date();
38
38
  node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" })
39
39
  }
40
40
 
@@ -10,7 +10,7 @@ module.exports = function (RED) {
10
10
  node.timerAutoToggle = null;
11
11
 
12
12
  function setNodeStatus({ fill, shape, text }) {
13
- var dDate = new Date();
13
+ let dDate = new Date();
14
14
  node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" })
15
15
  }
16
16
  setNodeStatus({ fill: "green", shape: "ring", text: "-> pass" });
@@ -59,7 +59,7 @@ module.exports = function (RED) {
59
59
  node.currentMsg.isReplay = true;
60
60
  setNodeStatus({ fill: "yellow", shape: "dot", text: "-> replay" });
61
61
  // Restore previous status
62
- setTimeout(() => {
62
+ let t = setTimeout(() => {
63
63
  if (node.bInviaMessaggio) {
64
64
  setNodeStatus({ fill: "green", shape: "dot", text: "-> pass" });
65
65
  } else {
@@ -96,8 +96,8 @@ module.exports = function (RED) {
96
96
 
97
97
 
98
98
  function ToBoolean(value) {
99
- var res = false;
100
- var decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
99
+ let res = false;
100
+ let decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
101
101
 
102
102
  if (typeof value === 'boolean') {
103
103
  res = value;
@@ -109,8 +109,7 @@ module.exports = function (RED) {
109
109
 
110
110
  // Is it formated as a decimal number?
111
111
  if (decimal.test(value)) {
112
- var v = parseFloat(value);
113
- res = v != 0;
112
+ res = parseFloat(value) != 0;
114
113
  }
115
114
  else {
116
115
  res = value.toLowerCase() === "true";
@@ -6,7 +6,7 @@ module.exports = function (RED) {
6
6
 
7
7
 
8
8
  function setNodeStatus({ fill, shape, text }) {
9
- var dDate = new Date();
9
+ let dDate = new Date();
10
10
  node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" })
11
11
  }
12
12
 
@@ -47,8 +47,8 @@ module.exports = function (RED) {
47
47
 
48
48
 
49
49
  function ToBoolean(value) {
50
- var res = false;
51
- var decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
50
+ let res = false;
51
+ let decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
52
52
 
53
53
  if (typeof value === 'boolean') {
54
54
  res = value;
@@ -60,8 +60,7 @@ module.exports = function (RED) {
60
60
 
61
61
  // Is it formated as a decimal number?
62
62
  if (decimal.test(value)) {
63
- var v = parseFloat(value);
64
- res = v != 0;
63
+ res = parseFloat(value) != 0;
65
64
  }
66
65
  else {
67
66
  res = value.toLowerCase() === "true";
@@ -18,7 +18,7 @@ module.exports = function(RED) {
18
18
 
19
19
  function setNodeStatus({fill, shape, text})
20
20
  {
21
- var dDate = new Date();
21
+ let dDate = new Date();
22
22
  node.status({fill: fill,shape: shape,text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")"})
23
23
  }
24
24
 
@@ -5,7 +5,7 @@ module.exports = function (RED) {
5
5
  var node = this;
6
6
 
7
7
  function setNodeStatus({ fill, shape, text }) {
8
- var dDate = new Date();
8
+ let dDate = new Date();
9
9
  node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" })
10
10
  }
11
11
 
@@ -6,7 +6,7 @@ module.exports = function (RED) {
6
6
  this.topics = {};
7
7
 
8
8
  function setNodeStatus({ fill, shape, text }) {
9
- var dDate = new Date();
9
+ let dDate = new Date();
10
10
  node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" })
11
11
  }
12
12
 
@@ -6,7 +6,7 @@ module.exports = function (RED) {
6
6
  node.valueToToggle = config.valueToToggle === undefined ? true : ToBoolean(config.valueToToggle);
7
7
 
8
8
  function setNodeStatus({ fill, shape, text }) {
9
- var dDate = new Date();
9
+ let dDate = new Date();
10
10
  node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" })
11
11
  }
12
12
 
@@ -23,7 +23,7 @@ module.exports = function (RED) {
23
23
 
24
24
  node.valueToToggle = !node.valueToToggle;
25
25
 
26
- var msgOUT = RED.util.cloneMessage(msg);
26
+ let msgOUT = RED.util.cloneMessage(msg);
27
27
  try {
28
28
  msgOUT.payload = node.valueToToggle;
29
29
  setNodeStatus({ fill: "green", shape: "dot", text: "(Send) " + msgOUT.payload });
@@ -37,8 +37,8 @@ module.exports = function (RED) {
37
37
 
38
38
 
39
39
  function ToBoolean(value) {
40
- var res = false;
41
- var decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
40
+ let res = false;
41
+ let decimal = /^\s*[+-]{0,1}\s*([\d]+(\.[\d]*)*)\s*$/
42
42
 
43
43
  if (typeof value === 'boolean') {
44
44
  res = value;
@@ -50,8 +50,7 @@ module.exports = function (RED) {
50
50
 
51
51
  // Is it formated as a decimal number?
52
52
  if (decimal.test(value)) {
53
- var v = parseFloat(value);
54
- res = v != 0;
53
+ res = parseFloat(value) != 0;
55
54
  }
56
55
  else {
57
56
  res = value.toLowerCase() === "true";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "node-red-contrib-boolean-logic-ultimate",
3
- "version": "1.0.50",
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.",
3
+ "version": "1.0.51",
4
+ "description": "A set of Node-RED enhanced boolean logic and utility nodes, flow interruption, blinker, invert, filter, toggle etc.., with persistent values after reboot. Compatible also with Homeassistant ON and OFF values.",
5
5
  "author": "Supergiovane (https://github.com/Supergiovane)",
6
6
  "dependencies": {
7
7
  "fs": "0.0.1-security",