node-red-contrib-boolean-logic-ultimate 1.0.57 → 1.0.59

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
@@ -3,6 +3,16 @@
3
3
 
4
4
  # CHANGELOG
5
5
 
6
+ <p>
7
+ <b>Version 1.0.59</b> January 2023<br/>
8
+ - NEW: added msg.gatecount property, to dinamically change the gate input count.</br>
9
+ - Updated the README</br>
10
+ </p>
11
+ <p>
12
+ <b>Version 1.0.58</b> December 2022<br/>
13
+ - NEW: added string conversion from "home", "not_home" to boolean.</br>
14
+ - Updated the README</br>
15
+ </p>
6
16
  <p>
7
17
  <b>Version 1.0.57</b> September 2022<br/>
8
18
  - Added node help in the node-red help tab.</br>
package/README.md CHANGED
@@ -35,6 +35,8 @@ Other than true/false, all nodes accepts these strings and convert it to true/fa
35
35
  | "false" | false |
36
36
  | "1" | true |
37
37
  | "0" | false |
38
+ | "home" | true |
39
+ | "not_home" | false |
38
40
 
39
41
 
40
42
  <br/>
@@ -94,10 +96,12 @@ The node can convert arbitrary input values to true/false. It supports Homeassis
94
96
 
95
97
  **INPUT MSG TO THE NODE**
96
98
 
97
- <code>
98
- msg.reset = true;
99
- </code>
100
- Resets all inputs to undefined.
99
+ |Input msg|Description|
100
+ |--|--|
101
+ | msg.reset = true | Resets all saved input values to undefined |
102
+ | msg.inputcount | Changes the inputs count property. For example, <b>msg.inputcount = 3</b> Whenever you lower the inputcount from a higher number to a lower one, for example from 3 to 2, it's suggested to do a <b>msg.reset=true</b> to reset all stored input values. |
103
+
104
+
101
105
 
102
106
  <br/>
103
107
  <br/>
@@ -200,8 +204,8 @@ The input message is preserved and passed to the output, changing only the topic
200
204
  # FILTER ULTIMATE
201
205
 
202
206
  This node has 2 outputs.<br />
203
- If the input payload is true, the node will send <code>true</code> on output 1 and nothing on oputput 2<br />
204
- If the input payload is false, the node will send nothing on output 1 and <code>false</code> on oputput 2<br />
207
+ If the input payload is true, the node will send <code>true</code> on output 1 and nothing on output 2<br />
208
+ If the input payload is false, the node will send nothing on output 1 and <code>false</code> on output 2<br />
205
209
  The input message is preserved and passed to the output, changing only the topic and the payload. If the input message has it's own topic, it'll be preserved as well.<br/>
206
210
 
207
211
  ### NODE CONFIGURATION
@@ -207,4 +207,11 @@
207
207
  | Reject non boolean (true/false) input values | If checked, the node will accept only boolean true/false values. Otherwise, it will try to convert the payload value to a logic true/false boolean. |
208
208
  | Delay evaluation (ms) | Delays the evaluation until this time (in milliseconds) is elapsed. Each time a message or "topic trigger message" (see **Trigger mode**) arrives, the delay is restarted. This option is useful for debouncing pourposes or simply for adding some delay. For example, you can turn on a light if the room is occupied for a long time, allowing people to fast transit repeatedly, without the need of turning the light on. Another example, if you have many sensors changing state rapidly, you can wait until these sensor reach a quiet state, then evaluate the inputs.|
209
209
 
210
+ <br/>
211
+
212
+ |Input msg|Description|
213
+ |--|--|
214
+ | msg.reset = true | Resets all saved input values to undefined |
215
+ | msg.inputcount | Changes the inputs count property. For example, <b>msg.inputcount = 3</b> Whenever you lower the inputcount from a higher number to a lower one, for example from 3 to 2, it's suggested to do a <b>msg.reset=true</b> to reset all stored input values.|
216
+
210
217
  </script>
@@ -89,13 +89,24 @@ module.exports = function (RED) {
89
89
  return;
90
90
  }
91
91
 
92
+ // 26/01/2023 you can change the input count from msg
93
+ if (msg.hasOwnProperty("inputcount")) {
94
+ setTimeout(() => {
95
+ setNodeStatus({ fill: "grey", shape: "dot", text: "Input count changed to " + msg.inputcount });
96
+ }, 500);
97
+ try {
98
+ node.config.inputCount = Number(msg.inputcount);
99
+ } catch (error) {
100
+ }
101
+
102
+ }
103
+
92
104
  // 15/11/2021 inform user about undefined topic or payload
93
105
  if (!msg.hasOwnProperty("topic") || msg.topic === undefined || msg.topic === null) {
94
106
  setNodeStatus({ fill: "red", shape: "dot", text: "Received invalid topic!" });
95
107
  return;
96
108
  }
97
109
 
98
-
99
110
  var topic = msg.topic;
100
111
  const utils = require("./utils.js");
101
112
  let sPayload = utils.fetchFromObject(msg, config.payloadPropName || "payload");
@@ -61,8 +61,8 @@
61
61
  [Find it useful?](https://www.paypal.me/techtoday)
62
62
 
63
63
  This node has 2 outputs.<br />
64
- If the input payload is true, the node will send <code>true</code> on output 1 and nothing on oputput 2<br />
65
- If the input payload is false, the node will send nothing on output 1 and <code>false</code> on oputput 2<br />
64
+ If the input payload is true, the node will send <code>true</code> on output 1 and nothing on output 2<br />
65
+ If the input payload is false, the node will send nothing on output 1 and <code>false</code> on output 2<br />
66
66
  The input message is preserved and passed to the output, changing only the topic and the payload. If the input message has it's own topic, it'll be preserved as well.<br/>
67
67
 
68
68
  |Property|Description|
@@ -22,6 +22,9 @@ module.exports.ToBoolean = function ToBoolean(value) {
22
22
  if (value.toLowerCase() === "true") return true;
23
23
  if (value.toLowerCase() === "false") return false;
24
24
 
25
+ if (value.toLowerCase() === "home") return true;
26
+ if (value.toLowerCase() === "not_home") return false;
27
+
25
28
  } else if (typeof value === 'number') {
26
29
  // Is it formated as a decimal number?
27
30
  if (decimal.test(value)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-boolean-logic-ultimate",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
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 values.",
5
5
  "author": "Supergiovane (https://github.com/Supergiovane)",
6
6
  "dependencies": {