@mschaeffler/node-red-logic 3.9.0 → 3.10.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_mean.html +7 -0
- package/math_mean.js +5 -0
- package/package.json +1 -1
package/math_mean.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
|
propertyType:{value:"msg"},
|
|
9
10
|
deltaTime:{value:"60", required:true, validate:function(v){
|
|
@@ -45,6 +46,10 @@
|
|
|
45
46
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
46
47
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
47
48
|
</div>
|
|
49
|
+
<div class="form-row">
|
|
50
|
+
<label for="node-input-topic"><i class="fa fa-envelope-o"></i> Topic</label>
|
|
51
|
+
<input type="text" id="node-input-topic" placeholder="Topic">
|
|
52
|
+
</div>
|
|
48
53
|
<div class="form-row">
|
|
49
54
|
<label for="node-input-input"><i class="fa fa-ellipsis-h"></i> Eigenschaft</label>
|
|
50
55
|
<input type="text" id="node-input-property">
|
|
@@ -111,6 +116,8 @@
|
|
|
111
116
|
<h3>Parameter</h3>
|
|
112
117
|
|
|
113
118
|
<dl class="message-properties">
|
|
119
|
+
<dt>Topic <span class="property-type">string</span></dt>
|
|
120
|
+
<dd> defines the topic for the output message, "" is <code>msg.topic</code>.</dd>
|
|
114
121
|
<dt>Property <span class="property-type">string</span></dt>
|
|
115
122
|
<dd> defines the message property to be used as payload.</dd>
|
|
116
123
|
<dt>Delta time <span class="property-type">number</span></dt>
|
package/math_mean.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.propertyType = config.propertyType ?? "msg";
|
|
11
12
|
this.deltaTime = Number( config.deltaTime ?? 60 )*1000;
|
|
@@ -90,6 +91,10 @@ module.exports = function(RED) {
|
|
|
90
91
|
|
|
91
92
|
function sendValue(value,count)
|
|
92
93
|
{
|
|
94
|
+
if( node.topic )
|
|
95
|
+
{
|
|
96
|
+
msg.topic = node.topic;
|
|
97
|
+
}
|
|
93
98
|
msg.payload = value;
|
|
94
99
|
msg.count = count;
|
|
95
100
|
last[msg.topic] = {value:value,time:now};
|
package/package.json
CHANGED