@mschaeffler/node-red-logic 2.0.0 → 2.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/math_reduce.html +7 -0
- package/math_reduce.js +6 -1
- package/package.json +1 -1
package/math_reduce.html
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
return v!=='' && !isNaN(v) && Number(v)>0;}
|
|
18
18
|
},
|
|
19
19
|
algo:{value:"", required:true},
|
|
20
|
+
showState:{value:false},
|
|
20
21
|
filter:{value:false}
|
|
21
22
|
},
|
|
22
23
|
inputs:1,
|
|
@@ -86,6 +87,10 @@
|
|
|
86
87
|
<option value="max">Maximum</option>
|
|
87
88
|
</select>
|
|
88
89
|
</div>
|
|
90
|
+
<div class="form-row">
|
|
91
|
+
<label for="node-input-showStatus"><i class="fa fa-star-o"></i> Status</label>
|
|
92
|
+
<input type="checkbox" id="node-input-showState" style="display:inline-block; width:20px; vertical-align:baseline;">
|
|
93
|
+
</div>
|
|
89
94
|
<div class="form-row">
|
|
90
95
|
<label for="node-input-filter"><i class="fa fa-filter"></i> Filter</label>
|
|
91
96
|
<input type="checkbox" id="node-input-filter" style="display:inline-block; width:20px; vertical-align:baseline;">
|
|
@@ -136,6 +141,8 @@
|
|
|
136
141
|
<dd> min. amount of topics to generate an output.</dd>
|
|
137
142
|
<dt>Algorithm <span class="property-type">string</span></dt>
|
|
138
143
|
<dd> algorithm to combine the values.</dd>
|
|
144
|
+
<dt>Status <span class="property-type">boolean</span></dt>
|
|
145
|
+
<dd> shows the actual value as a node status.</dd>
|
|
139
146
|
<dt>Filter <span class="property-type">boolean</span></dt>
|
|
140
147
|
<dd> block sending of unchanged <code>property</code>.</dd>
|
|
141
148
|
</dl>
|
package/math_reduce.js
CHANGED
|
@@ -11,8 +11,10 @@ module.exports = function(RED) {
|
|
|
11
11
|
this.maxMean = Number( config.maxMean ?? 1 );
|
|
12
12
|
this.minData = Number( config.minData ?? 1 );
|
|
13
13
|
this.algo = config.algo;
|
|
14
|
+
this.showState= Boolean( config.showState );
|
|
14
15
|
this.filter = Boolean( config.filter );
|
|
15
16
|
this.last = null;
|
|
17
|
+
node.status( "" );
|
|
16
18
|
|
|
17
19
|
node.on('input', function(msg,send,done) {
|
|
18
20
|
if( msg.invalid )
|
|
@@ -107,7 +109,10 @@ module.exports = function(RED) {
|
|
|
107
109
|
status.fill = "red";
|
|
108
110
|
status.text = "payload is NaN";
|
|
109
111
|
}
|
|
110
|
-
node.
|
|
112
|
+
if( node.showState )
|
|
113
|
+
{
|
|
114
|
+
node.status( status );
|
|
115
|
+
}
|
|
111
116
|
done();
|
|
112
117
|
}
|
|
113
118
|
});
|
package/package.json
CHANGED