@mschaeffler/node-red-logic 0.0.7 → 0.1.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
@@ -12,9 +12,20 @@ $ npm install @mschaeffler/node-red-logic
12
12
 
13
13
  ## Usage
14
14
 
15
- ### bool
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.|
24
+
25
+ ### to bool
16
26
 
17
27
  Converts payload to a bool value:
28
+
18
29
  |type|value|is converted to|
19
30
  |:---|:----|:--------------|
20
31
  |bool|false|false|
@@ -50,41 +61,126 @@ The message property to be used as payload can be defined with the `Property` pr
50
61
 
51
62
  ### or
52
63
 
53
- .
64
+ Combines two or more boolean vales with the `or` operator.
65
+
66
+ The input values are converted as described in the `to bool` node.
54
67
 
55
68
  #### Input
56
69
 
57
- .
70
+ The different inputs are differentiated by topics.
71
+
72
+ The message property to be used as payload can be defined with the `Property` property.
58
73
 
59
74
  |msg. | type | description |
60
75
  |:-------|:-------|:----------------------------------|
61
- |topic | string | .|
76
+ |topic | string | name of the input channel. |
62
77
  |payload | boolean| input value for `topic`. |
63
78
 
64
79
  #### Output
65
80
 
66
- .
67
-
68
81
  |msg. | type | description |
69
82
  |:-------|:-------|:----------------------------------|
70
83
  |payload | boolean | result of `or` of all input topics.|
84
+ |count | number | number of data elements.|
71
85
 
72
86
  #### Parameters
73
87
 
74
88
  |config| type | description |
75
89
  |:-----|:-------|:----------------------------------|
76
- | | string | . |
90
+ |Property| string | defines the message property to be used as payload.|
91
+ |min. Data|number|min. amount of topics to generate an output.|
77
92
 
78
93
  ### and
79
94
 
80
- .
95
+ Combines two or more boolean vales with the `and` operator.
96
+
97
+ The input values are converted as described in the `to bool` node.
98
+
99
+ #### Input
100
+
101
+ The different inputs are differentiated by topics.
102
+
103
+ The message property to be used as payload can be defined with the `Property` property.
104
+
105
+ |msg. | type | description |
106
+ |:-------|:-------|:----------------------------------|
107
+ |topic | string | name of the input channel. |
108
+ |payload | boolean| input value for `topic`. |
109
+
110
+ #### Output
111
+
112
+ |msg. | type | description |
113
+ |:-------|:-------|:----------------------------------|
114
+ |payload | boolean | result of `and` of all input topics.|
115
+ |count | number | number of data elements.|
116
+
117
+ #### Parameters
118
+
119
+ |config| type | description |
120
+ |:-----|:-------|:----------------------------------|
121
+ |Property| string | defines the message property to be used as payload.|
122
+ |min. Data|number|min. amount of topics to generate an output.|
123
+
124
+ ### to number
125
+
126
+ Converts payload to a number.
81
127
 
82
128
  #### Input
83
129
 
130
+ The message property to be used as payload can be defined with the `Property` property.
131
+
132
+ |msg. | type | description |
133
+ |:-------|:-------|:----------------------------------|
134
+ |payload | | input value. |
135
+
136
+ #### Output
137
+
138
+ |msg. | type | description |
139
+ |:-------|:-------|:----------------------------------|
140
+ |payload | number | number value of payload.|
141
+
142
+ #### Parameters
143
+
144
+ |config| type | description |
145
+ |:-----|:-------|:----------------------------------|
146
+ |Property| string | defines the message property to be used as payload.|
147
+
148
+ ### reduce
149
+
150
+ Combines two or more streams of data (topics) into one single value.
151
+
152
+ Each stream can be debounced by arithmatic mean.
153
+
154
+ #### Input
155
+
156
+ The different inputs are differentiated by topics.
157
+
158
+ The message property to be used as payload can be defined with the `Property` property.
159
+
160
+ |msg. | type | description |
161
+ |:-------|:-------|:----------------------------------|
162
+ |topic | string | name of the input channel. |
163
+ |payload | number | input value for `topic`. |
164
+
84
165
  #### Output
85
166
 
167
+ |msg. | type | description |
168
+ |:-------|:-------|:----------------------------------|
169
+ |payload | number | result of combining of all input topics.|
170
+ |count | number | number of data elements.|
171
+
86
172
  #### Parameters
87
173
 
174
+ |config| type | description |
175
+ |:-----|:-------|:----------------------------------|
176
+ |Property| string | defines the message property to be used as payload.|
177
+ |min. Mean|number|min. amount of values for the arithmatic mean of one topic.|
178
+ |max. Mean|number|max. amount of values for the arithmatic mean of one topic.|
179
+ |min. Data|number|min. amount of topics to generate an output.|
180
+ |Algorithm|string|algorithm to combine the values.|
181
+
182
+ #### Algorithms
183
+
88
184
  ## Example Flow
89
185
 
90
186
  [example flow](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-logic/examples/logic.json)
package/counter.html CHANGED
@@ -27,6 +27,11 @@
27
27
 
28
28
  <p>A node that just count the messages.</p>
29
29
 
30
- <h3>Input</h3>
30
+ <h3>Output</h3>
31
+
32
+ <dl class="message-properties">
33
+ <dt>count <span class="property-type">number</span></dt>
34
+ <dd> number of messages.</dd>
35
+ </dl>
31
36
 
32
37
  </script>
package/logic_and.html CHANGED
@@ -45,8 +45,37 @@
45
45
 
46
46
  <script type="text/html" data-help-name="and">
47
47
 
48
- <p>.</p>
48
+ <p>.Combines two or more boolean vales with the <code>and</code> operator.</p>
49
+ <p>The input values are converted as described in the <code>to bool</code> node.</p>
49
50
 
50
51
  <h3>Input</h3>
52
+
53
+ <p>The different inputs are differentiated by topics.</p>
54
+ <p>The message property to be used as payload can be defined with the <code>Property</code> property.</p>
55
+
56
+ <dl class="message-properties">
57
+ <dt>topic <span class="property-type">string</span></dt>
58
+ <dd> name of the input channel.</dd>
59
+ <dt>payload <span class="property-type">boolean</span></dt>
60
+ <dd> input value for <code>topic</code>.</dd>
61
+ </dl>
62
+
63
+ <h3>Output</h3>
64
+
65
+ <dl class="message-properties">
66
+ <dt>payload <span class="property-type">boolean</span></dt>
67
+ <dd> result of <code>and</code> of all input topics.</dd>
68
+ <dt>count <span class="property-type">number</span></dt>
69
+ <dd> number of data elements.</dd>
70
+ </dl>
71
+
72
+ <h3>Parameter</h3>
51
73
 
74
+ <dl class="message-properties">
75
+ <dt>Property <span class="property-type">string</span></dt>
76
+ <dd> defines the message property to be used as payload.</dd>
77
+ <dt>min. Data <span class="property-type">number</span></dt>
78
+ <dd> min. amount of topics to generate an output.</dd>
79
+ </dl>
80
+
52
81
  </script>
package/logic_bool.html CHANGED
@@ -39,8 +39,43 @@
39
39
 
40
40
  <script type="text/html" data-help-name="tobool">
41
41
 
42
- <p>.</p>
42
+ <p>Converts payload to a bool value:</p>
43
+
44
+ <table>
45
+ <tr> <th>type</th> <th>input</th> <th>output</th> </tr>
46
+ <tr> <td>boolean</td> <td>false</td> <td>false</td> </tr>
47
+ <tr> <td></td> <td>true</td> <td>true</td> </tr>
48
+ <tr> <td>number</td> <td>0</td> <td>false</td> </tr>
49
+ <tr> <td></td> <td>1</td> <td>true</td> </tr>
50
+ <tr> <td>string</td> <td>false</td> <td>false</td> </tr>
51
+ <tr> <td></td> <td>true</td> <td>true</td> </tr>
52
+ <tr> <td></td> <td>0</td> <td>false</td> </tr>
53
+ <tr> <td></td> <td>1</td> <td>true</td> </tr>
54
+ <tr> <td></td> <td>on</td> <td>false</td> </tr>
55
+ <tr> <td></td> <td>off</td> <td>true</td> </tr>
56
+ </table>
43
57
 
44
58
  <h3>Input</h3>
59
+
60
+ <p>The message property to be used as payload can be defined with the <code>Property</code> property.</p>
61
+
62
+ <dl class="message-properties">
63
+ <dt>payload <span class="property-type"></span></dt>
64
+ <dd> input value.</dd>
65
+ </dl>
66
+
67
+ <h3>Output</h3>
68
+
69
+ <dl class="message-properties">
70
+ <dt>payload <span class="property-type">boolean</span></dt>
71
+ <dd> bool value of payload.</dd>
72
+ </dl>
73
+
74
+ <h3>Parameter</h3>
45
75
 
76
+ <dl class="message-properties">
77
+ <dt>Property <span class="property-type">string</span></dt>
78
+ <dd> defines the message property to be used as payload.</dd>
79
+ </dl>
80
+
46
81
  </script>
package/logic_or.html CHANGED
@@ -45,8 +45,37 @@
45
45
 
46
46
  <script type="text/html" data-help-name="or">
47
47
 
48
- <p>.</p>
48
+ <p>Combines two or more boolean vales with the <code>or</code> operator.</p>
49
+ <p>The input values are converted as described in the <code>to bool</code> node.</p>
49
50
 
50
51
  <h3>Input</h3>
52
+
53
+ <p>The different inputs are differentiated by topics.</p>
54
+ <p>The message property to be used as payload can be defined with the <code>Property</code> property.</p>
55
+
56
+ <dl class="message-properties">
57
+ <dt>topic <span class="property-type">string</span></dt>
58
+ <dd> name of the input channel.</dd>
59
+ <dt>payload <span class="property-type">boolean</span></dt>
60
+ <dd> input value for <code>topic</code>.</dd>
61
+ </dl>
62
+
63
+ <h3>Output</h3>
64
+
65
+ <dl class="message-properties">
66
+ <dt>payload <span class="property-type">boolean</span></dt>
67
+ <dd> result of <code>or</code> of all input topics.</dd>
68
+ <dt>count <span class="property-type">number</span></dt>
69
+ <dd> number of data elements.</dd>
70
+ </dl>
71
+
72
+ <h3>Parameter</h3>
51
73
 
74
+ <dl class="message-properties">
75
+ <dt>Property <span class="property-type">string</span></dt>
76
+ <dd> defines the message property to be used as payload.</dd>
77
+ <dt>min. Data <span class="property-type">number</span></dt>
78
+ <dd> min. amount of topics to generate an output.</dd>
79
+ </dl>
80
+
52
81
  </script>
package/math_number.html CHANGED
@@ -39,8 +39,29 @@
39
39
 
40
40
  <script type="text/html" data-help-name="tonumber">
41
41
 
42
- <p>.</p>
42
+ <p>Converts payload to a number.</p>
43
43
 
44
44
  <h3>Input</h3>
45
+
46
+ <p>The message property to be used as payload can be defined with the <code>Property</code> property.</p>
47
+
48
+ <dl class="message-properties">
49
+ <dt>payload <span class="property-type"></span></dt>
50
+ <dd> input value.</dd>
51
+ </dl>
52
+
53
+ <h3>Output</h3>
54
+
55
+ <dl class="message-properties">
56
+ <dt>payload <span class="property-type">number</span></dt>
57
+ <dd> number value of payload.</dd>
58
+ </dl>
59
+
60
+ <h3>Parameter</h3>
45
61
 
62
+ <dl class="message-properties">
63
+ <dt>Property <span class="property-type">string</span></dt>
64
+ <dd> defines the message property to be used as payload.</dd>
65
+ </dl>
66
+
46
67
  </script>
package/math_reduce.html CHANGED
@@ -87,8 +87,45 @@
87
87
 
88
88
  <script type="text/html" data-help-name="reduce">
89
89
 
90
- <p>.</p>
90
+ <p>Combines two or more streams of data (topics) into one single value.</p>
91
+ <p>Each stream can be debounced by arithmatic mean.</p>
91
92
 
92
93
  <h3>Input</h3>
94
+
95
+ <p>The different inputs are differentiated by topics.</p>
96
+ <p>The message property to be used as payload can be defined with the <code>Property</code> property.</p>
97
+
98
+ <dl class="message-properties">
99
+ <dt>topic <span class="property-type">string</span></dt>
100
+ <dd> name of the input channel.</dd>
101
+ <dt>payload <span class="property-type">number</span></dt>
102
+ <dd> input value for <code>topic</code>.</dd>
103
+ </dl>
104
+
105
+ <h3>Output</h3>
106
+
107
+ <dl class="message-properties">
108
+ <dt>payload <span class="property-type">number</span></dt>
109
+ <dd> result of combining of all input topics.</dd>
110
+ <dt>count <span class="property-type">number</span></dt>
111
+ <dd> number of data elements.</dd>
112
+ </dl>
113
+
114
+ <h3>Parameter</h3>
93
115
 
116
+ <dl class="message-properties">
117
+ <dt>Property <span class="property-type">string</span></dt>
118
+ <dd> defines the message property to be used as payload.</dd>
119
+ <dt>min. Mean <span class="property-type">number</span></dt>
120
+ <dd> min. amount of values for the arithmatic mean of one topic.</dd>
121
+ <dt>max. Mean <span class="property-type">number</span></dt>
122
+ <dd> max. amount of values for the arithmatic mean of one topic.</dd>
123
+ <dt>min. Data <span class="property-type">number</span></dt>
124
+ <dd> min. amount of topics to generate an output.</dd>
125
+ <dt>Algorithm <span class="property-type">string</span></dt>
126
+ <dd> algorithm to combine the values.</dd>
127
+ </dl>
128
+
129
+ <h3>Algorithms</h3>
130
+
94
131
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-logic",
3
- "version": "0.0.7",
3
+ "version": "0.1.0",
4
4
  "description": "nodes for simple mathematical operations.",
5
5
  "license": "LGPL-2.1",
6
6
  "homepage": "https://github.com/m-schaeffler/node-red-my-nodes/tree/main/node-red-logic",
@@ -17,11 +17,11 @@
17
17
  "node-red": {
18
18
  "version": ">=1.3.7",
19
19
  "nodes": {
20
+ "counter":"counter.js",
20
21
  "tobool":"logic_bool.js",
21
22
  "tonumber":"math_number.js",
22
23
  "or":"logic_or.js",
23
24
  "and":"logic_and.js",
24
- "counter":"counter.js",
25
25
  "reduce":"math_reduce.js"
26
26
  }
27
27
  },