@mschaeffler/node-red-logic 0.7.0 → 0.7.2

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
@@ -202,6 +202,45 @@ The message property to be used as payload can be defined with the `Property` pr
202
202
  |min |gets the minimal value of the `topic` channels|
203
203
  |max |gets the maximal value of the `topic` channels|
204
204
 
205
+ ### statistics
206
+
207
+ Calculate statistical values of one or more data streams.
208
+
209
+ Each stream can be debounced by arithmatic mean.
210
+
211
+ If the msg property `invalid` is present in the message, all nodes ignore the message.
212
+
213
+ #### Input
214
+
215
+ The different inputs are differentiated by topics.
216
+
217
+ The message property to be used as payload can be defined with the `Property` property.
218
+
219
+ |msg. | type | description |
220
+ |:-------|:-------|:----------------------------------|
221
+ |topic | string | name of the input channel. |
222
+ |payload | number | input value for `topic`. |
223
+
224
+ #### Output
225
+
226
+ |msg. | type | description |
227
+ |:-------|:-------|:----------------------------------|
228
+ |payload | | same as in input message.|
229
+ |stats.count | number | number of data elements.|
230
+ |stats.min number | number | minimal value.|
231
+ |stats.max number | number | maximal value.|
232
+ |stats.average number | number | average value.|
233
+ |stats.deviation number | number | standard deviation.|
234
+ |stats.variation number | number | coefficient of variation.|
235
+
236
+ #### Parameters
237
+
238
+ |config| type | description |
239
+ |:-----|:-------|:----------------------------------|
240
+ |Property| string | defines the message property to be used as payload.|
241
+ |delta time|number|time frame to collect the data for the analysis.|
242
+ |min. Data|number|min. amount of data points to generate an output.|
243
+
205
244
  ## Edge Nodes
206
245
 
207
246
  ![image of example flow](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/edge.png)
package/counter.js CHANGED
@@ -9,6 +9,7 @@ module.exports = function(RED) {
9
9
  node.on('input', function(msg,send,done) {
10
10
  if( msg.invalid )
11
11
  {
12
+ done();
12
13
  return null;
13
14
  }
14
15
  msg.count = context.get( "count" ) ?? 0;
@@ -0,0 +1,64 @@
1
+ [
2
+ {
3
+ "id": "8b8b9dd67621a97e",
4
+ "type": "statistics",
5
+ "z": "3c59326457645408",
6
+ "name": "",
7
+ "property": "payload",
8
+ "deltaTime": "10",
9
+ "minData": "2",
10
+ "x": 360,
11
+ "y": 2100,
12
+ "wires": [
13
+ [
14
+ "1a6086132fd93e1a"
15
+ ]
16
+ ]
17
+ },
18
+ {
19
+ "id": "1a6086132fd93e1a",
20
+ "type": "debug",
21
+ "z": "3c59326457645408",
22
+ "name": "debug 15",
23
+ "active": true,
24
+ "tosidebar": true,
25
+ "console": false,
26
+ "tostatus": false,
27
+ "complete": "true",
28
+ "targetType": "full",
29
+ "statusVal": "",
30
+ "statusType": "auto",
31
+ "x": 540,
32
+ "y": 2100,
33
+ "wires": []
34
+ },
35
+ {
36
+ "id": "40735ba7d52d0d38",
37
+ "type": "inject",
38
+ "z": "3c59326457645408",
39
+ "name": "",
40
+ "props": [
41
+ {
42
+ "p": "payload"
43
+ },
44
+ {
45
+ "p": "topic",
46
+ "vt": "str"
47
+ }
48
+ ],
49
+ "repeat": "1",
50
+ "crontab": "",
51
+ "once": true,
52
+ "onceDelay": 0.1,
53
+ "topic": "random",
54
+ "payload": "$random()*100",
55
+ "payloadType": "jsonata",
56
+ "x": 190,
57
+ "y": 2100,
58
+ "wires": [
59
+ [
60
+ "8b8b9dd67621a97e"
61
+ ]
62
+ ]
63
+ }
64
+ ]
Binary file
package/logic_and.js CHANGED
@@ -13,6 +13,7 @@ module.exports = function(RED) {
13
13
  node.on('input', function(msg,send,done) {
14
14
  if( msg.invalid )
15
15
  {
16
+ done();
16
17
  return null;
17
18
  }
18
19
  if( msg.reset || msg.topic==="init" )
package/logic_bool.js CHANGED
@@ -11,6 +11,7 @@ module.exports = function(RED) {
11
11
  node.on('input', function(msg,send,done) {
12
12
  if( msg.invalid )
13
13
  {
14
+ done();
14
15
  return null;
15
16
  }
16
17
  msg.payload = tools.property2boolean( RED.util.getMessageProperty( msg, node.property ) );
package/logic_or.js CHANGED
@@ -13,6 +13,7 @@ module.exports = function(RED) {
13
13
  node.on('input', function(msg,send,done) {
14
14
  if( msg.invalid )
15
15
  {
16
+ done();
16
17
  return null;
17
18
  }
18
19
  if( msg.reset || msg.topic==="init" )
package/math_falling.js CHANGED
@@ -12,6 +12,7 @@ module.exports = function(RED) {
12
12
  node.on('input', function(msg,send,done) {
13
13
  if( msg.invalid )
14
14
  {
15
+ done();
15
16
  return null;
16
17
  }
17
18
  if( msg.reset || msg.topic==="init" )
@@ -14,6 +14,7 @@ module.exports = function(RED) {
14
14
  node.on('input', function(msg,send,done) {
15
15
  if( msg.invalid )
16
16
  {
17
+ done();
17
18
  return null;
18
19
  }
19
20
  if( msg.reset || msg.topic==="init" )
package/math_number.js CHANGED
@@ -10,6 +10,7 @@ module.exports = function(RED) {
10
10
  node.on('input', function(msg,send,done) {
11
11
  if( msg.invalid )
12
12
  {
13
+ done();
13
14
  return null;
14
15
  }
15
16
  msg.payload = Number( RED.util.getMessageProperty( msg, node.property ) );
package/math_raising.js CHANGED
@@ -12,6 +12,7 @@ module.exports = function(RED) {
12
12
  node.on('input', function(msg,send,done) {
13
13
  if( msg.invalid )
14
14
  {
15
+ done();
15
16
  return null;
16
17
  }
17
18
  if( msg.reset || msg.topic==="init" )
package/math_reduce.js CHANGED
@@ -15,6 +15,7 @@ module.exports = function(RED) {
15
15
  node.on('input', function(msg,send,done) {
16
16
  if( msg.invalid )
17
17
  {
18
+ done();
18
19
  return null;
19
20
  }
20
21
  if( msg.reset || msg.topic==="init" )
@@ -75,7 +75,7 @@
75
75
 
76
76
  <dl class="message-properties">
77
77
  <dt>payload <span class="property-type">number</span></dt>
78
- <dd> result of combining of all input topics.</dd>
78
+ <dd> same as in input message.</dd>
79
79
  <dt>stats.count <span class="property-type">number</span></dt>
80
80
  <dd> number of data elements.</dd>
81
81
  <dt>stats.min <span class="property-type">number</span></dt>
@@ -12,6 +12,7 @@ module.exports = function(RED) {
12
12
  node.on('input', function(msg,send,done) {
13
13
  if( msg.invalid )
14
14
  {
15
+ done();
15
16
  return null;
16
17
  }
17
18
  if( msg.reset || msg.topic==="init" )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-logic",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
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",