@mschaeffler/node-red-logic 0.1.0 → 0.2.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 +3 -0
- package/logic_and.html +8 -1
- package/logic_and.js +2 -0
- package/logic_or.html +8 -1
- package/logic_or.js +2 -0
- package/math_reduce.html +8 -1
- package/math_reduce.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -87,6 +87,7 @@ The message property to be used as payload can be defined with the `Property` pr
|
|
|
87
87
|
|
|
88
88
|
|config| type | description |
|
|
89
89
|
|:-----|:-------|:----------------------------------|
|
|
90
|
+
|Topic | string | defines the topic for the output message.|
|
|
90
91
|
|Property| string | defines the message property to be used as payload.|
|
|
91
92
|
|min. Data|number|min. amount of topics to generate an output.|
|
|
92
93
|
|
|
@@ -118,6 +119,7 @@ The message property to be used as payload can be defined with the `Property` pr
|
|
|
118
119
|
|
|
119
120
|
|config| type | description |
|
|
120
121
|
|:-----|:-------|:----------------------------------|
|
|
122
|
+
|Topic | string | defines the topic for the output message.|
|
|
121
123
|
|Property| string | defines the message property to be used as payload.|
|
|
122
124
|
|min. Data|number|min. amount of topics to generate an output.|
|
|
123
125
|
|
|
@@ -173,6 +175,7 @@ The message property to be used as payload can be defined with the `Property` pr
|
|
|
173
175
|
|
|
174
176
|
|config| type | description |
|
|
175
177
|
|:-----|:-------|:----------------------------------|
|
|
178
|
+
|Topic | string | defines the topic for the output message.|
|
|
176
179
|
|Property| string | defines the message property to be used as payload.|
|
|
177
180
|
|min. Mean|number|min. amount of values for the arithmatic mean of one topic.|
|
|
178
181
|
|max. Mean|number|max. amount of values for the arithmatic mean of one topic.|
|
package/logic_and.html
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
color: "#C0DEED",
|
|
5
5
|
defaults: {
|
|
6
6
|
name:{value:""},
|
|
7
|
+
topic:{value:""},
|
|
7
8
|
property:{value:"payload", required:true},
|
|
8
9
|
minData:{value:"1", required:true, validate:function(v){
|
|
9
10
|
return v!=='' && !isNaN(v) && Number(v)>0;
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
outputs:1,
|
|
14
15
|
icon: "font-awesome/fa-chevron-up",
|
|
15
16
|
label: function() {
|
|
16
|
-
return this.name||"and";
|
|
17
|
+
return this.name||this.topic||"and";
|
|
17
18
|
},
|
|
18
19
|
inputLabels: 'input',
|
|
19
20
|
outputLabels: 'and',
|
|
@@ -32,6 +33,10 @@
|
|
|
32
33
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
33
34
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
34
35
|
</div>
|
|
36
|
+
<div class="form-row">
|
|
37
|
+
<label for="node-input-topic"><i class="fa fa-envelope-o"></i> Topic</label>
|
|
38
|
+
<input type="text" id="node-input-topic" placeholder="Topic">
|
|
39
|
+
</div>
|
|
35
40
|
<div class="form-row">
|
|
36
41
|
<label for="node-input-input"><i class="fa fa-ellipsis-h"></i> Eigenschaft</label>
|
|
37
42
|
<input type="text" id="node-input-property">
|
|
@@ -72,6 +77,8 @@
|
|
|
72
77
|
<h3>Parameter</h3>
|
|
73
78
|
|
|
74
79
|
<dl class="message-properties">
|
|
80
|
+
<dt>Topic <span class="property-type">string</span></dt>
|
|
81
|
+
<dd> defines the topic for the output message.</dd>
|
|
75
82
|
<dt>Property <span class="property-type">string</span></dt>
|
|
76
83
|
<dd> defines the message property to be used as payload.</dd>
|
|
77
84
|
<dt>min. Data <span class="property-type">number</span></dt>
|
package/logic_and.js
CHANGED
|
@@ -6,6 +6,7 @@ module.exports = function(RED) {
|
|
|
6
6
|
//this.config = config;
|
|
7
7
|
var node = this;
|
|
8
8
|
var context = this.context();
|
|
9
|
+
this.topic = config.topic;
|
|
9
10
|
this.property = config.property || "payload";
|
|
10
11
|
this.minData = Number( config.minData );
|
|
11
12
|
|
|
@@ -18,6 +19,7 @@ module.exports = function(RED) {
|
|
|
18
19
|
data[msg.topic] = payload;
|
|
19
20
|
context.set( "data", data );
|
|
20
21
|
|
|
22
|
+
msg.topic = node.topic;
|
|
21
23
|
msg.payload = true;
|
|
22
24
|
msg.count = 0;
|
|
23
25
|
for( const item in data )
|
package/logic_or.html
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
color: "#C0DEED",
|
|
5
5
|
defaults: {
|
|
6
6
|
name:{value:""},
|
|
7
|
+
topic:{value:""},
|
|
7
8
|
property:{value:"payload", required:true},
|
|
8
9
|
minData:{value:"1", required:true, validate:function(v){
|
|
9
10
|
return v!=='' && !isNaN(v) && Number(v)>0;
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
outputs:1,
|
|
14
15
|
icon: "font-awesome/fa-chevron-down",
|
|
15
16
|
label: function() {
|
|
16
|
-
return this.name||"or";
|
|
17
|
+
return this.name||this.topic||"or";
|
|
17
18
|
},
|
|
18
19
|
inputLabels: 'input',
|
|
19
20
|
outputLabels: 'or',
|
|
@@ -32,6 +33,10 @@
|
|
|
32
33
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
33
34
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
34
35
|
</div>
|
|
36
|
+
<div class="form-row">
|
|
37
|
+
<label for="node-input-topic"><i class="fa fa-envelope-o"></i> Topic</label>
|
|
38
|
+
<input type="text" id="node-input-topic" placeholder="Topic">
|
|
39
|
+
</div>
|
|
35
40
|
<div class="form-row">
|
|
36
41
|
<label for="node-input-input"><i class="fa fa-ellipsis-h"></i> Eigenschaft</label>
|
|
37
42
|
<input type="text" id="node-input-property">
|
|
@@ -72,6 +77,8 @@
|
|
|
72
77
|
<h3>Parameter</h3>
|
|
73
78
|
|
|
74
79
|
<dl class="message-properties">
|
|
80
|
+
<dt>Topic <span class="property-type">string</span></dt>
|
|
81
|
+
<dd> defines the topic for the output message.</dd>
|
|
75
82
|
<dt>Property <span class="property-type">string</span></dt>
|
|
76
83
|
<dd> defines the message property to be used as payload.</dd>
|
|
77
84
|
<dt>min. Data <span class="property-type">number</span></dt>
|
package/logic_or.js
CHANGED
|
@@ -6,6 +6,7 @@ module.exports = function(RED) {
|
|
|
6
6
|
//this.config = config;
|
|
7
7
|
var node = this;
|
|
8
8
|
var context = this.context();
|
|
9
|
+
this.topic = config.topic;
|
|
9
10
|
this.property = config.property || "payload";
|
|
10
11
|
this.minData = Number( config.minData );
|
|
11
12
|
|
|
@@ -18,6 +19,7 @@ module.exports = function(RED) {
|
|
|
18
19
|
data[msg.topic] = payload;
|
|
19
20
|
context.set( "data", data );
|
|
20
21
|
|
|
22
|
+
msg.topic = node.topic;
|
|
21
23
|
msg.payload = false;
|
|
22
24
|
msg.count = 0;
|
|
23
25
|
for( const item in data )
|
package/math_reduce.html
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
color: "#C0DEED",
|
|
5
5
|
defaults: {
|
|
6
6
|
name:{value:""},
|
|
7
|
+
topic:{value:""},
|
|
7
8
|
property:{value:"payload", required:true},
|
|
8
9
|
minMean:{value:"1", required:true, validate:function(v){
|
|
9
10
|
return v!=='' && !isNaN(v) && Number(v)>0;}
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
34
|
label: function() {
|
|
34
|
-
return this.name||this.algo||"reduce";
|
|
35
|
+
return this.name||this.topic||this.algo||"reduce";
|
|
35
36
|
},
|
|
36
37
|
inputLabels: 'input',
|
|
37
38
|
outputLabels: 'output',
|
|
@@ -62,6 +63,10 @@
|
|
|
62
63
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
63
64
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
64
65
|
</div>
|
|
66
|
+
<div class="form-row">
|
|
67
|
+
<label for="node-input-topic"><i class="fa fa-envelope-o"></i> Topic</label>
|
|
68
|
+
<input type="text" id="node-input-topic" placeholder="Topic">
|
|
69
|
+
</div>
|
|
65
70
|
<div class="form-row">
|
|
66
71
|
<label for="node-input-input"><i class="fa fa-ellipsis-h"></i> Eigenschaft</label>
|
|
67
72
|
<input type="text" id="node-input-property">
|
|
@@ -114,6 +119,8 @@
|
|
|
114
119
|
<h3>Parameter</h3>
|
|
115
120
|
|
|
116
121
|
<dl class="message-properties">
|
|
122
|
+
<dt>Topic <span class="property-type">string</span></dt>
|
|
123
|
+
<dd> defines the topic for the output message.</dd>
|
|
117
124
|
<dt>Property <span class="property-type">string</span></dt>
|
|
118
125
|
<dd> defines the message property to be used as payload.</dd>
|
|
119
126
|
<dt>min. Mean <span class="property-type">number</span></dt>
|
package/math_reduce.js
CHANGED
|
@@ -5,6 +5,7 @@ module.exports = function(RED) {
|
|
|
5
5
|
//this.config = config;
|
|
6
6
|
var node = this;
|
|
7
7
|
var context = this.context();
|
|
8
|
+
this.topic = config.topic;
|
|
8
9
|
this.property = config.property || "payload";
|
|
9
10
|
this.minMean = Number( config.minMean );
|
|
10
11
|
this.maxMean = Number( config.maxMean );
|
|
@@ -27,6 +28,7 @@ module.exports = function(RED) {
|
|
|
27
28
|
item.push( payload )
|
|
28
29
|
data[msg.topic] = item;
|
|
29
30
|
|
|
31
|
+
msg.topic = node.topic;
|
|
30
32
|
msg.count = 0;
|
|
31
33
|
switch( node.algo )
|
|
32
34
|
{
|
package/package.json
CHANGED