@mschaeffler/node-red-logic 0.4.3 → 0.4.4

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Nodes to perform boolean and arithmetic operations on input signals.
4
4
 
5
- ![image of example flow](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/logic.png)
5
+ ![image of nodes](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/logic.png)
6
6
 
7
7
  ## Install
8
8
 
@@ -10,17 +10,9 @@ Nodes to perform boolean and arithmetic operations on input signals.
10
10
  $ npm install @mschaeffler/node-red-logic
11
11
  ```
12
12
 
13
- ## Nodes
13
+ ## Boolean Nodes
14
14
 
15
- ### counter
16
-
17
- A node that just count the messages.
18
-
19
- #### Output
20
-
21
- |msg. | type | description |
22
- |:-------|:-------|:----------------------------------|
23
- |count | number | number of messages.|
15
+ ![image of example flow](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/bool.png)
24
16
 
25
17
  ### to bool
26
18
 
@@ -124,6 +116,20 @@ The message property to be used as payload can be defined with the `Property` pr
124
116
  |Property| string | defines the message property to be used as payload.|
125
117
  |min. Data|number|min. amount of topics to generate an output.|
126
118
 
119
+ ## Integer Nodes
120
+
121
+ ![image of example flow](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/math.png)
122
+
123
+ ### counter
124
+
125
+ A node that just count the messages.
126
+
127
+ #### Output
128
+
129
+ |msg. | type | description |
130
+ |:-------|:-------|:----------------------------------|
131
+ |count | number | number of messages.|
132
+
127
133
  ### to number
128
134
 
129
135
  Converts payload to a number.
@@ -186,6 +192,13 @@ The message property to be used as payload can be defined with the `Property` pr
186
192
 
187
193
  #### Algorithms
188
194
 
195
+ |algorithm|description|
196
+ |:--------|:----------|
197
+ |add |ads up the `topic` channels|
198
+ |mean |averages the `topic` channels|
199
+ |prod |multiplies the `topic` channels|
200
+ |min |gets the minimal value of the `topic` channels|
201
+ |max |gets the maximal value of the `topic` channels|
189
202
 
190
203
  ## Edge Nodes
191
204
 
@@ -276,6 +289,10 @@ Trigger message, in case an edge is detected.
276
289
 
277
290
  ## Example Flows
278
291
 
292
+ [boolean nodes](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/bool.json)
293
+
294
+ [integer nodes](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/math.json)
295
+
279
296
  [edge nodes](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/edge.json)
280
297
 
281
298
  ## Author
@@ -0,0 +1,289 @@
1
+ [
2
+ {
3
+ "id": "874e3c59e7510080",
4
+ "type": "tab",
5
+ "label": "Flow 2",
6
+ "disabled": false,
7
+ "info": "",
8
+ "env": []
9
+ },
10
+ {
11
+ "id": "3638e932e6cd704e",
12
+ "type": "tobool",
13
+ "z": "874e3c59e7510080",
14
+ "name": "",
15
+ "property": "payload",
16
+ "showState": false,
17
+ "x": 310,
18
+ "y": 120,
19
+ "wires": [
20
+ [
21
+ "59187eb10a59d119"
22
+ ]
23
+ ]
24
+ },
25
+ {
26
+ "id": "7d8ce3c91fad2f4c",
27
+ "type": "or",
28
+ "z": "874e3c59e7510080",
29
+ "name": "",
30
+ "topic": "",
31
+ "property": "payload",
32
+ "minData": "1",
33
+ "x": 310,
34
+ "y": 200,
35
+ "wires": [
36
+ [
37
+ "c9d4c13317184fd5"
38
+ ]
39
+ ]
40
+ },
41
+ {
42
+ "id": "59a5371d04a4ad46",
43
+ "type": "and",
44
+ "z": "874e3c59e7510080",
45
+ "name": "",
46
+ "topic": "",
47
+ "property": "payload",
48
+ "minData": "1",
49
+ "x": 310,
50
+ "y": 280,
51
+ "wires": [
52
+ [
53
+ "1b5361bc5d9fa406"
54
+ ]
55
+ ]
56
+ },
57
+ {
58
+ "id": "59187eb10a59d119",
59
+ "type": "debug",
60
+ "z": "874e3c59e7510080",
61
+ "name": "",
62
+ "active": true,
63
+ "tosidebar": true,
64
+ "console": false,
65
+ "tostatus": true,
66
+ "complete": "payload",
67
+ "targetType": "msg",
68
+ "statusVal": "payload",
69
+ "statusType": "auto",
70
+ "x": 490,
71
+ "y": 120,
72
+ "wires": []
73
+ },
74
+ {
75
+ "id": "71b5ad607d2a4667",
76
+ "type": "inject",
77
+ "z": "874e3c59e7510080",
78
+ "name": "reset",
79
+ "props": [
80
+ {
81
+ "p": "reset",
82
+ "v": "true",
83
+ "vt": "bool"
84
+ },
85
+ {
86
+ "p": "topic",
87
+ "vt": "str"
88
+ }
89
+ ],
90
+ "repeat": "",
91
+ "crontab": "",
92
+ "once": false,
93
+ "onceDelay": 0.1,
94
+ "topic": "",
95
+ "x": 150,
96
+ "y": 320,
97
+ "wires": [
98
+ [
99
+ "59a5371d04a4ad46",
100
+ "7d8ce3c91fad2f4c"
101
+ ]
102
+ ]
103
+ },
104
+ {
105
+ "id": "308f4479c5fe35b5",
106
+ "type": "inject",
107
+ "z": "874e3c59e7510080",
108
+ "name": "",
109
+ "props": [
110
+ {
111
+ "p": "topic",
112
+ "vt": "str"
113
+ },
114
+ {
115
+ "p": "payload"
116
+ }
117
+ ],
118
+ "repeat": "",
119
+ "crontab": "",
120
+ "once": false,
121
+ "onceDelay": 0.1,
122
+ "topic": "A",
123
+ "payload": "invalid",
124
+ "payloadType": "str",
125
+ "x": 140,
126
+ "y": 80,
127
+ "wires": [
128
+ [
129
+ "3638e932e6cd704e"
130
+ ]
131
+ ]
132
+ },
133
+ {
134
+ "id": "93b191eedfb167ba",
135
+ "type": "inject",
136
+ "z": "874e3c59e7510080",
137
+ "name": "",
138
+ "props": [
139
+ {
140
+ "p": "topic",
141
+ "vt": "str"
142
+ },
143
+ {
144
+ "p": "payload"
145
+ }
146
+ ],
147
+ "repeat": "",
148
+ "crontab": "",
149
+ "once": false,
150
+ "onceDelay": 0.1,
151
+ "topic": "A",
152
+ "payload": "on",
153
+ "payloadType": "str",
154
+ "x": 150,
155
+ "y": 120,
156
+ "wires": [
157
+ [
158
+ "3638e932e6cd704e",
159
+ "7d8ce3c91fad2f4c",
160
+ "59a5371d04a4ad46"
161
+ ]
162
+ ]
163
+ },
164
+ {
165
+ "id": "bc22906368cc9ebd",
166
+ "type": "inject",
167
+ "z": "874e3c59e7510080",
168
+ "name": "",
169
+ "props": [
170
+ {
171
+ "p": "topic",
172
+ "vt": "str"
173
+ },
174
+ {
175
+ "p": "payload"
176
+ }
177
+ ],
178
+ "repeat": "",
179
+ "crontab": "",
180
+ "once": false,
181
+ "onceDelay": 0.1,
182
+ "topic": "A",
183
+ "payload": "off",
184
+ "payloadType": "str",
185
+ "x": 150,
186
+ "y": 160,
187
+ "wires": [
188
+ [
189
+ "3638e932e6cd704e",
190
+ "7d8ce3c91fad2f4c",
191
+ "59a5371d04a4ad46"
192
+ ]
193
+ ]
194
+ },
195
+ {
196
+ "id": "c9d4c13317184fd5",
197
+ "type": "debug",
198
+ "z": "874e3c59e7510080",
199
+ "name": "",
200
+ "active": true,
201
+ "tosidebar": true,
202
+ "console": false,
203
+ "tostatus": true,
204
+ "complete": "payload",
205
+ "targetType": "msg",
206
+ "statusVal": "payload",
207
+ "statusType": "auto",
208
+ "x": 490,
209
+ "y": 200,
210
+ "wires": []
211
+ },
212
+ {
213
+ "id": "1b5361bc5d9fa406",
214
+ "type": "debug",
215
+ "z": "874e3c59e7510080",
216
+ "name": "",
217
+ "active": true,
218
+ "tosidebar": true,
219
+ "console": false,
220
+ "tostatus": true,
221
+ "complete": "payload",
222
+ "targetType": "msg",
223
+ "statusVal": "payload",
224
+ "statusType": "auto",
225
+ "x": 490,
226
+ "y": 280,
227
+ "wires": []
228
+ },
229
+ {
230
+ "id": "49a9351d2c03c622",
231
+ "type": "inject",
232
+ "z": "874e3c59e7510080",
233
+ "name": "",
234
+ "props": [
235
+ {
236
+ "p": "topic",
237
+ "vt": "str"
238
+ },
239
+ {
240
+ "p": "payload"
241
+ }
242
+ ],
243
+ "repeat": "",
244
+ "crontab": "",
245
+ "once": false,
246
+ "onceDelay": 0.1,
247
+ "topic": "B",
248
+ "payload": "0",
249
+ "payloadType": "num",
250
+ "x": 150,
251
+ "y": 260,
252
+ "wires": [
253
+ [
254
+ "59a5371d04a4ad46",
255
+ "7d8ce3c91fad2f4c"
256
+ ]
257
+ ]
258
+ },
259
+ {
260
+ "id": "2b32172c0bd9fa07",
261
+ "type": "inject",
262
+ "z": "874e3c59e7510080",
263
+ "name": "",
264
+ "props": [
265
+ {
266
+ "p": "topic",
267
+ "vt": "str"
268
+ },
269
+ {
270
+ "p": "payload"
271
+ }
272
+ ],
273
+ "repeat": "",
274
+ "crontab": "",
275
+ "once": false,
276
+ "onceDelay": 0.1,
277
+ "topic": "B",
278
+ "payload": "5",
279
+ "payloadType": "num",
280
+ "x": 150,
281
+ "y": 220,
282
+ "wires": [
283
+ [
284
+ "7d8ce3c91fad2f4c",
285
+ "59a5371d04a4ad46"
286
+ ]
287
+ ]
288
+ }
289
+ ]
Binary file
Binary file
@@ -0,0 +1,328 @@
1
+ [
2
+ {
3
+ "id": "e7a1598e6f6358b9",
4
+ "type": "tab",
5
+ "label": "Flow 3",
6
+ "disabled": false,
7
+ "info": "",
8
+ "env": []
9
+ },
10
+ {
11
+ "id": "b387e894bd2d43ef",
12
+ "type": "reduce",
13
+ "z": "e7a1598e6f6358b9",
14
+ "name": "",
15
+ "topic": "",
16
+ "property": "payload",
17
+ "minMean": "1",
18
+ "maxMean": "1",
19
+ "minData": "2",
20
+ "algo": "add",
21
+ "x": 350,
22
+ "y": 260,
23
+ "wires": [
24
+ [
25
+ "ae068d25a90dae25"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "b3daecdca91d5857",
31
+ "type": "counter",
32
+ "z": "e7a1598e6f6358b9",
33
+ "name": "",
34
+ "x": 360,
35
+ "y": 120,
36
+ "wires": [
37
+ [
38
+ "8d3bba1d6e5cb22f"
39
+ ]
40
+ ]
41
+ },
42
+ {
43
+ "id": "244e769e05d8b030",
44
+ "type": "tonumber",
45
+ "z": "e7a1598e6f6358b9",
46
+ "name": "",
47
+ "property": "payload",
48
+ "showState": true,
49
+ "x": 360,
50
+ "y": 200,
51
+ "wires": [
52
+ [
53
+ "5a783605c2561d00"
54
+ ]
55
+ ]
56
+ },
57
+ {
58
+ "id": "8d3bba1d6e5cb22f",
59
+ "type": "debug",
60
+ "z": "e7a1598e6f6358b9",
61
+ "name": "",
62
+ "active": true,
63
+ "tosidebar": true,
64
+ "console": false,
65
+ "tostatus": true,
66
+ "complete": "payload",
67
+ "targetType": "msg",
68
+ "statusVal": "payload",
69
+ "statusType": "auto",
70
+ "x": 550,
71
+ "y": 120,
72
+ "wires": []
73
+ },
74
+ {
75
+ "id": "5a783605c2561d00",
76
+ "type": "debug",
77
+ "z": "e7a1598e6f6358b9",
78
+ "name": "",
79
+ "active": true,
80
+ "tosidebar": true,
81
+ "console": false,
82
+ "tostatus": true,
83
+ "complete": "payload",
84
+ "targetType": "msg",
85
+ "statusVal": "payload",
86
+ "statusType": "auto",
87
+ "x": 550,
88
+ "y": 200,
89
+ "wires": []
90
+ },
91
+ {
92
+ "id": "ae068d25a90dae25",
93
+ "type": "debug",
94
+ "z": "e7a1598e6f6358b9",
95
+ "name": "",
96
+ "active": true,
97
+ "tosidebar": true,
98
+ "console": false,
99
+ "tostatus": true,
100
+ "complete": "payload",
101
+ "targetType": "msg",
102
+ "statusVal": "payload",
103
+ "statusType": "auto",
104
+ "x": 550,
105
+ "y": 260,
106
+ "wires": []
107
+ },
108
+ {
109
+ "id": "b7f75f4a22ecd0ee",
110
+ "type": "inject",
111
+ "z": "e7a1598e6f6358b9",
112
+ "name": "",
113
+ "props": [
114
+ {
115
+ "p": "topic",
116
+ "vt": "str"
117
+ },
118
+ {
119
+ "p": "payload"
120
+ }
121
+ ],
122
+ "repeat": "",
123
+ "crontab": "",
124
+ "once": false,
125
+ "onceDelay": 0.1,
126
+ "topic": "A",
127
+ "payload": "5",
128
+ "payloadType": "str",
129
+ "x": 190,
130
+ "y": 120,
131
+ "wires": [
132
+ [
133
+ "b3daecdca91d5857",
134
+ "244e769e05d8b030",
135
+ "b387e894bd2d43ef",
136
+ "3c37bb4e8785f015"
137
+ ]
138
+ ]
139
+ },
140
+ {
141
+ "id": "19ad2b1afbfee8cf",
142
+ "type": "inject",
143
+ "z": "e7a1598e6f6358b9",
144
+ "name": "",
145
+ "props": [
146
+ {
147
+ "p": "topic",
148
+ "vt": "str"
149
+ },
150
+ {
151
+ "p": "payload"
152
+ }
153
+ ],
154
+ "repeat": "",
155
+ "crontab": "",
156
+ "once": false,
157
+ "onceDelay": 0.1,
158
+ "topic": "A",
159
+ "payload": "-5",
160
+ "payloadType": "num",
161
+ "x": 190,
162
+ "y": 200,
163
+ "wires": [
164
+ [
165
+ "244e769e05d8b030",
166
+ "b387e894bd2d43ef",
167
+ "3c37bb4e8785f015"
168
+ ]
169
+ ]
170
+ },
171
+ {
172
+ "id": "ac9dd1323d3d60ae",
173
+ "type": "inject",
174
+ "z": "e7a1598e6f6358b9",
175
+ "name": "",
176
+ "props": [
177
+ {
178
+ "p": "topic",
179
+ "vt": "str"
180
+ },
181
+ {
182
+ "p": "payload"
183
+ }
184
+ ],
185
+ "repeat": "",
186
+ "crontab": "",
187
+ "once": false,
188
+ "onceDelay": 0.1,
189
+ "topic": "A",
190
+ "payload": "0",
191
+ "payloadType": "str",
192
+ "x": 190,
193
+ "y": 160,
194
+ "wires": [
195
+ [
196
+ "244e769e05d8b030",
197
+ "b387e894bd2d43ef",
198
+ "3c37bb4e8785f015"
199
+ ]
200
+ ]
201
+ },
202
+ {
203
+ "id": "144150b47c7b7f5e",
204
+ "type": "inject",
205
+ "z": "e7a1598e6f6358b9",
206
+ "name": "",
207
+ "props": [
208
+ {
209
+ "p": "topic",
210
+ "vt": "str"
211
+ },
212
+ {
213
+ "p": "payload"
214
+ }
215
+ ],
216
+ "repeat": "",
217
+ "crontab": "",
218
+ "once": false,
219
+ "onceDelay": 0.1,
220
+ "topic": "B",
221
+ "payload": "2",
222
+ "payloadType": "num",
223
+ "x": 190,
224
+ "y": 260,
225
+ "wires": [
226
+ [
227
+ "b387e894bd2d43ef",
228
+ "3c37bb4e8785f015"
229
+ ]
230
+ ]
231
+ },
232
+ {
233
+ "id": "424f044c65f13d95",
234
+ "type": "inject",
235
+ "z": "e7a1598e6f6358b9",
236
+ "name": "",
237
+ "props": [
238
+ {
239
+ "p": "topic",
240
+ "vt": "str"
241
+ },
242
+ {
243
+ "p": "payload"
244
+ }
245
+ ],
246
+ "repeat": "",
247
+ "crontab": "",
248
+ "once": false,
249
+ "onceDelay": 0.1,
250
+ "topic": "B",
251
+ "payload": "-2",
252
+ "payloadType": "num",
253
+ "x": 190,
254
+ "y": 340,
255
+ "wires": [
256
+ [
257
+ "b387e894bd2d43ef",
258
+ "3c37bb4e8785f015"
259
+ ]
260
+ ]
261
+ },
262
+ {
263
+ "id": "5fa26abfa096ab15",
264
+ "type": "inject",
265
+ "z": "e7a1598e6f6358b9",
266
+ "name": "",
267
+ "props": [
268
+ {
269
+ "p": "topic",
270
+ "vt": "str"
271
+ },
272
+ {
273
+ "p": "payload"
274
+ }
275
+ ],
276
+ "repeat": "",
277
+ "crontab": "",
278
+ "once": false,
279
+ "onceDelay": 0.1,
280
+ "topic": "B",
281
+ "payload": "0",
282
+ "payloadType": "num",
283
+ "x": 190,
284
+ "y": 300,
285
+ "wires": [
286
+ [
287
+ "b387e894bd2d43ef",
288
+ "3c37bb4e8785f015"
289
+ ]
290
+ ]
291
+ },
292
+ {
293
+ "id": "3c37bb4e8785f015",
294
+ "type": "reduce",
295
+ "z": "e7a1598e6f6358b9",
296
+ "name": "",
297
+ "topic": "",
298
+ "property": "payload",
299
+ "minMean": "1",
300
+ "maxMean": "3",
301
+ "minData": "2",
302
+ "algo": "mean",
303
+ "x": 350,
304
+ "y": 340,
305
+ "wires": [
306
+ [
307
+ "e48c5acab52f93e3"
308
+ ]
309
+ ]
310
+ },
311
+ {
312
+ "id": "e48c5acab52f93e3",
313
+ "type": "debug",
314
+ "z": "e7a1598e6f6358b9",
315
+ "name": "",
316
+ "active": true,
317
+ "tosidebar": true,
318
+ "console": false,
319
+ "tostatus": true,
320
+ "complete": "payload",
321
+ "targetType": "msg",
322
+ "statusVal": "payload",
323
+ "statusType": "auto",
324
+ "x": 550,
325
+ "y": 340,
326
+ "wires": []
327
+ }
328
+ ]
Binary file
package/math_falling.html CHANGED
@@ -12,7 +12,7 @@
12
12
  outputs:1,
13
13
  icon: "falling-edge.png",
14
14
  label: function() {
15
- return this.name||"falling";
15
+ return this.name||"falling edge";
16
16
  },
17
17
  paletteLabel: "falling edge",
18
18
  inputLabels: 'input',
package/math_raising.html CHANGED
@@ -12,7 +12,7 @@
12
12
  outputs:1,
13
13
  icon: "raising-edge.png",
14
14
  label: function() {
15
- return this.name||"raising";
15
+ return this.name||"raising edge";
16
16
  },
17
17
  paletteLabel: "raising edge",
18
18
  inputLabels: 'input',
package/math_reduce.html CHANGED
@@ -142,4 +142,14 @@
142
142
 
143
143
  <h3>Algorithms</h3>
144
144
 
145
+ <dl class="message-properties">
146
+ <table>
147
+ <tr><th>algorithm</th><th>description</th></tr>
148
+ <tr><td>add</td><td>ads up the <code>topic</code> channels</td></tr>
149
+ <tr><td>mean</td><td>averages the <code>topic</code> channels</td></tr>
150
+ <tr><td>prod</td><td>multiplies the <code>topic</code> channels</td></tr>
151
+ <tr><td>min</td><td>gets the minimal value of the <code>topic</code> channels</td></tr>
152
+ <tr><td>max</td><td>gets the maximal value of the <code>topic</code> channels</td></tr>
153
+ </table>
154
+
145
155
  </script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-logic",
3
- "version": "0.4.3",
4
- "description": "nodes for simple mathematical operations.",
3
+ "version": "0.4.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",
7
7
  "repository": {
@@ -19,13 +19,13 @@
19
19
  "nodes": {
20
20
  "counter":"counter.js",
21
21
  "tobool":"logic_bool.js",
22
- "tonumber":"math_number.js",
23
22
  "or":"logic_or.js",
24
23
  "and":"logic_and.js",
24
+ "tonumber":"math_number.js",
25
+ "reduce":"math_reduce.js",
25
26
  "fallingEdge":"math_falling.js",
26
27
  "raisingEdge":"math_raising.js",
27
- "hysteresisEdge":"math_hysteresis.js",
28
- "reduce":"math_reduce.js"
28
+ "hysteresisEdge":"math_hysteresis.js"
29
29
  }
30
30
  },
31
31
  "author": {
@@ -1 +0,0 @@
1
- []