@mschaeffler/node-red-logic 0.4.3 → 0.5.1
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 +30 -11
- package/counter.html +2 -0
- package/counter.js +4 -0
- package/examples/bool.json +289 -0
- package/examples/bool.png +0 -0
- package/examples/logic.png +0 -0
- package/examples/math.json +328 -0
- package/examples/math.png +0 -0
- package/logic_and.html +1 -0
- package/logic_and.js +4 -0
- package/logic_bool.html +1 -0
- package/logic_bool.js +4 -1
- package/logic_or.html +1 -0
- package/logic_or.js +4 -0
- package/math_falling.html +2 -1
- package/math_falling.js +4 -0
- package/math_hysteresis.html +1 -0
- package/math_hysteresis.js +6 -3
- package/math_number.html +1 -0
- package/math_number.js +4 -1
- package/math_raising.html +2 -1
- package/math_raising.js +4 -0
- package/math_reduce.html +11 -0
- package/math_reduce.js +4 -0
- package/package.json +5 -5
- package/examples/logic.json +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Nodes to perform boolean and arithmetic operations on input signals.
|
|
4
4
|
|
|
5
|
-

|
|
6
|
+
|
|
7
|
+
If the msg property `invalid` is present in the message, all nodes ignore the message.
|
|
6
8
|
|
|
7
9
|
## Install
|
|
8
10
|
|
|
@@ -10,17 +12,9 @@ Nodes to perform boolean and arithmetic operations on input signals.
|
|
|
10
12
|
$ npm install @mschaeffler/node-red-logic
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
## Nodes
|
|
14
|
-
|
|
15
|
-
### counter
|
|
16
|
-
|
|
17
|
-
A node that just count the messages.
|
|
18
|
-
|
|
19
|
-
#### Output
|
|
15
|
+
## Boolean Nodes
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|:-------|:-------|:----------------------------------|
|
|
23
|
-
|count | number | number of messages.|
|
|
17
|
+

|
|
24
18
|
|
|
25
19
|
### to bool
|
|
26
20
|
|
|
@@ -124,6 +118,20 @@ The message property to be used as payload can be defined with the `Property` pr
|
|
|
124
118
|
|Property| string | defines the message property to be used as payload.|
|
|
125
119
|
|min. Data|number|min. amount of topics to generate an output.|
|
|
126
120
|
|
|
121
|
+
## Integer Nodes
|
|
122
|
+
|
|
123
|
+

|
|
124
|
+
|
|
125
|
+
### counter
|
|
126
|
+
|
|
127
|
+
A node that just count the messages.
|
|
128
|
+
|
|
129
|
+
#### Output
|
|
130
|
+
|
|
131
|
+
|msg. | type | description |
|
|
132
|
+
|:-------|:-------|:----------------------------------|
|
|
133
|
+
|count | number | number of messages.|
|
|
134
|
+
|
|
127
135
|
### to number
|
|
128
136
|
|
|
129
137
|
Converts payload to a number.
|
|
@@ -186,6 +194,13 @@ The message property to be used as payload can be defined with the `Property` pr
|
|
|
186
194
|
|
|
187
195
|
#### Algorithms
|
|
188
196
|
|
|
197
|
+
|algorithm|description|
|
|
198
|
+
|:--------|:----------|
|
|
199
|
+
|add |ads up the `topic` channels|
|
|
200
|
+
|mean |averages the `topic` channels|
|
|
201
|
+
|prod |multiplies the `topic` channels|
|
|
202
|
+
|min |gets the minimal value of the `topic` channels|
|
|
203
|
+
|max |gets the maximal value of the `topic` channels|
|
|
189
204
|
|
|
190
205
|
## Edge Nodes
|
|
191
206
|
|
|
@@ -276,6 +291,10 @@ Trigger message, in case an edge is detected.
|
|
|
276
291
|
|
|
277
292
|
## Example Flows
|
|
278
293
|
|
|
294
|
+
[boolean nodes](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/bool.json)
|
|
295
|
+
|
|
296
|
+
[integer nodes](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/math.json)
|
|
297
|
+
|
|
279
298
|
[edge nodes](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/edge.json)
|
|
280
299
|
|
|
281
300
|
## Author
|
package/counter.html
CHANGED
package/counter.js
CHANGED
|
@@ -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/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
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
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',
|
|
@@ -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
package/math_hysteresis.html
CHANGED
|
@@ -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
|
|
package/math_hysteresis.js
CHANGED
|
@@ -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(
|
|
56
|
+
if( ['any','rising'].includes(this.initial) && msg.payload > this.threshold_raise )
|
|
54
57
|
{
|
|
55
58
|
sendMsg( 'rising' );
|
|
56
59
|
}
|
|
57
|
-
else if(
|
|
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
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
|
@@ -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',
|
|
@@ -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
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
|
|
|
@@ -142,4 +143,14 @@
|
|
|
142
143
|
|
|
143
144
|
<h3>Algorithms</h3>
|
|
144
145
|
|
|
146
|
+
<dl class="message-properties">
|
|
147
|
+
<table>
|
|
148
|
+
<tr><th>algorithm</th><th>description</th></tr>
|
|
149
|
+
<tr><td>add</td><td>ads up the <code>topic</code> channels</td></tr>
|
|
150
|
+
<tr><td>mean</td><td>averages the <code>topic</code> channels</td></tr>
|
|
151
|
+
<tr><td>prod</td><td>multiplies the <code>topic</code> channels</td></tr>
|
|
152
|
+
<tr><td>min</td><td>gets the minimal value of the <code>topic</code> channels</td></tr>
|
|
153
|
+
<tr><td>max</td><td>gets the maximal value of the <code>topic</code> channels</td></tr>
|
|
154
|
+
</table>
|
|
155
|
+
|
|
145
156
|
</script>
|
package/math_reduce.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mschaeffler/node-red-logic",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "nodes for simple
|
|
3
|
+
"version": "0.5.1",
|
|
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": {
|
package/examples/logic.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[]
|