@mschaeffler/node-red-logic 0.4.4 → 0.6.0

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/README.md CHANGED
@@ -4,6 +4,8 @@ Nodes to perform boolean and arithmetic operations on input signals.
4
4
 
5
5
  ![image of nodes](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/logic.png)
6
6
 
7
+ If the msg property `invalid` is present in the message, all nodes ignore the message.
8
+
7
9
  ## Install
8
10
 
9
11
  ```
package/counter.html CHANGED
@@ -26,6 +26,8 @@
26
26
  <script type="text/html" data-help-name="counter">
27
27
 
28
28
  <p>A node that just count the messages.</p>
29
+ <p>If the msg property <code>invalid</code> is present in the message, all nodes ignore the message.</p>
30
+
29
31
 
30
32
  <h3>Output</h3>
31
33
 
package/counter.js CHANGED
@@ -7,6 +7,10 @@ module.exports = function(RED) {
7
7
  var context = this.context();
8
8
 
9
9
  node.on('input', function(msg,send,done) {
10
+ if( msg.invalid )
11
+ {
12
+ return null;
13
+ }
10
14
  msg.count = context.get( "count" ) ?? 0;
11
15
  if( msg.reset || msg.topic==="init" )
12
16
  {
package/logic_and.html CHANGED
@@ -52,6 +52,7 @@
52
52
 
53
53
  <p>.Combines two or more boolean vales with the <code>and</code> operator.</p>
54
54
  <p>The input values are converted as described in the <code>to bool</code> node.</p>
55
+ <p>If the msg property <code>invalid</code> is present in the message, all nodes ignore the message.</p>
55
56
 
56
57
  <h3>Input</h3>
57
58
 
package/logic_and.js CHANGED
@@ -11,6 +11,10 @@ module.exports = function(RED) {
11
11
  this.minData = Number( config.minData );
12
12
 
13
13
  node.on('input', function(msg,send,done) {
14
+ if( msg.invalid )
15
+ {
16
+ return null;
17
+ }
14
18
  if( msg.reset || msg.topic==="init" )
15
19
  {
16
20
  context.set( "data", {} );
package/logic_bool.html CHANGED
@@ -45,6 +45,7 @@
45
45
  <script type="text/html" data-help-name="tobool">
46
46
 
47
47
  <p>Converts payload to a bool value:</p>
48
+ <p>If the msg property <code>invalid</code> is present in the message, all nodes ignore the message.</p>
48
49
 
49
50
  <table>
50
51
  <tr> <th>type</th> <th>input</th> <th>output</th> </tr>
package/logic_bool.js CHANGED
@@ -9,8 +9,11 @@ module.exports = function(RED) {
9
9
  this.showState = config.showState;
10
10
 
11
11
  node.on('input', function(msg,send,done) {
12
+ if( msg.invalid )
13
+ {
14
+ return null;
15
+ }
12
16
  msg.payload = tools.property2boolean( RED.util.getMessageProperty( msg, node.property ) );
13
-
14
17
  if( msg.payload !== null )
15
18
  {
16
19
  if( node.showState )
package/logic_or.html CHANGED
@@ -52,6 +52,7 @@
52
52
 
53
53
  <p>Combines two or more boolean vales with the <code>or</code> operator.</p>
54
54
  <p>The input values are converted as described in the <code>to bool</code> node.</p>
55
+ <p>If the msg property <code>invalid</code> is present in the message, all nodes ignore the message.</p>
55
56
 
56
57
  <h3>Input</h3>
57
58
 
package/logic_or.js CHANGED
@@ -11,6 +11,10 @@ module.exports = function(RED) {
11
11
  this.minData = Number( config.minData );
12
12
 
13
13
  node.on('input', function(msg,send,done) {
14
+ if( msg.invalid )
15
+ {
16
+ return null;
17
+ }
14
18
  if( msg.reset || msg.topic==="init" )
15
19
  {
16
20
  context.set( "data", {} );
package/math_falling.html CHANGED
@@ -51,6 +51,7 @@
51
51
 
52
52
  <p>Message is only forwarded, if the payload falls below a threshold value.</p>
53
53
  <p>Each <code>topic</code> is treated seperatly.</p>
54
+ <p>If the msg property <code>invalid</code> is present in the message, all nodes ignore the message.</p>
54
55
 
55
56
  <h3>Input</h3>
56
57
 
package/math_falling.js CHANGED
@@ -10,6 +10,10 @@ module.exports = function(RED) {
10
10
  this.showState = config.showState;
11
11
 
12
12
  node.on('input', function(msg,send,done) {
13
+ if( msg.invalid )
14
+ {
15
+ return null;
16
+ }
13
17
  if( msg.reset || msg.topic==="init" )
14
18
  {
15
19
  context.set( "data", {} );
@@ -69,6 +69,7 @@
69
69
 
70
70
  <p>Message is only forwarded, if the payload raises above an upper limit or falls below a lower limit.</p>
71
71
  <p>Each <code>topic</code> is treated seperatly.</p>
72
+ <p>If the msg property <code>invalid</code> is present in the message, all nodes ignore the message.</p>
72
73
 
73
74
  <h3>Input</h3>
74
75
 
@@ -12,7 +12,10 @@ module.exports = function(RED) {
12
12
  this.showState = config.showState;
13
13
 
14
14
  node.on('input', function(msg,send,done) {
15
-
15
+ if( msg.invalid )
16
+ {
17
+ return null;
18
+ }
16
19
  if( msg.reset || msg.topic==="init" )
17
20
  {
18
21
  context.set( "data", {} );
@@ -50,11 +53,11 @@ module.exports = function(RED) {
50
53
  else
51
54
  {
52
55
  data[msg.topic] = {};
53
- if( this.initial in ['any','rising'] && msg.payload > this.threshold_raise )
56
+ if( ['any','rising'].includes(this.initial) && msg.payload > this.threshold_raise )
54
57
  {
55
58
  sendMsg( 'rising' );
56
59
  }
57
- else if( this.initial in ['any','falling'] && msg.payload < this.threshold_fall )
60
+ else if( ['any','falling'].includes(this.initial) && msg.payload < this.threshold_fall )
58
61
  {
59
62
  sendMsg( 'falling' );
60
63
  }
package/math_number.html CHANGED
@@ -45,6 +45,7 @@
45
45
  <script type="text/html" data-help-name="tonumber">
46
46
 
47
47
  <p>Converts payload to a number.</p>
48
+ <p>If the msg property <code>invalid</code> is present in the message, all nodes ignore the message.</p>
48
49
 
49
50
  <h3>Input</h3>
50
51
 
package/math_number.js CHANGED
@@ -8,8 +8,11 @@ module.exports = function(RED) {
8
8
  this.showState = config.showState;
9
9
 
10
10
  node.on('input', function(msg,send,done) {
11
+ if( msg.invalid )
12
+ {
13
+ return null;
14
+ }
11
15
  msg.payload = Number( RED.util.getMessageProperty( msg, node.property ) );
12
-
13
16
  if( ! isNaN( msg.payload ) )
14
17
  {
15
18
  if( node.showState )
package/math_raising.html CHANGED
@@ -51,6 +51,7 @@
51
51
 
52
52
  <p>Message is only forwarded, if the payload raises above a threshold value.</p>
53
53
  <p>Each <code>topic</code> is treated seperatly.</p>
54
+ <p>If the msg property <code>invalid</code> is present in the message, all nodes ignore the message.</p>
54
55
 
55
56
  <h3>Input</h3>
56
57
 
package/math_raising.js CHANGED
@@ -10,6 +10,10 @@ module.exports = function(RED) {
10
10
  this.showState = config.showState;
11
11
 
12
12
  node.on('input', function(msg,send,done) {
13
+ if( msg.invalid )
14
+ {
15
+ return null;
16
+ }
13
17
  if( msg.reset || msg.topic==="init" )
14
18
  {
15
19
  context.set( "data", {} );
package/math_reduce.html CHANGED
@@ -101,6 +101,7 @@
101
101
 
102
102
  <p>Combines two or more streams of data (topics) into one single value.</p>
103
103
  <p>Each stream can be debounced by arithmatic mean.</p>
104
+ <p>If the msg property <code>invalid</code> is present in the message, all nodes ignore the message.</p>
104
105
 
105
106
  <h3>Input</h3>
106
107
 
@@ -121,6 +122,8 @@
121
122
  <dd> result of combining of all input topics.</dd>
122
123
  <dt>count <span class="property-type">number</span></dt>
123
124
  <dd> number of data elements.</dd>
125
+ <dt>data <span class="property-type">object</span></dt>
126
+ <dd> actual input data.</dd>
124
127
  </dl>
125
128
 
126
129
  <h3>Parameter</h3>
package/math_reduce.js CHANGED
@@ -13,6 +13,10 @@ module.exports = function(RED) {
13
13
  this.algo = config.algo;
14
14
 
15
15
  node.on('input', function(msg,send,done) {
16
+ if( msg.invalid )
17
+ {
18
+ return null;
19
+ }
16
20
  if( msg.reset || msg.topic==="init" )
17
21
  {
18
22
  context.set( "data", {} );
@@ -30,6 +34,7 @@ module.exports = function(RED) {
30
34
 
31
35
  msg.topic = node.topic;
32
36
  msg.count = 0;
37
+ msg.data = data;
33
38
  switch( node.algo )
34
39
  {
35
40
  case "add":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-logic",
3
- "version": "0.4.4",
3
+ "version": "0.6.0",
4
4
  "description": "nodes for simple operations.",
5
5
  "license": "LGPL-2.1",
6
6
  "homepage": "https://github.com/m-schaeffler/node-red-my-nodes/tree/main/node-red-logic",