@mschaeffler/node-red-logic 3.11.2 → 3.11.4

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_minus.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
  showState:{value:false},
@@ -13,7 +14,7 @@
13
14
  outputs:1,
14
15
  icon: "font-awesome/fa-minus",
15
16
  label: function() {
16
- return this.name||"minus";
17
+ return this.name||this.topic||"minus";
17
18
  },
18
19
  labelStyle: function() {
19
20
  return this.name?"node_label_italic":"";
@@ -36,6 +37,10 @@
36
37
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
37
38
  <input type="text" id="node-input-name" placeholder="Name">
38
39
  </div>
40
+ <div class="form-row">
41
+ <label for="node-input-topic"><i class="fa fa-envelope-o"></i> Topic</label>
42
+ <input type="text" id="node-input-topic" placeholder="Topic">
43
+ </div>
39
44
  <div class="form-row">
40
45
  <label for="node-input-input"><i class="fa fa-ellipsis-h"></i> Eigenschaft</label>
41
46
  <input type="text" id="node-input-property">
@@ -75,6 +80,8 @@
75
80
  <h3>Parameter</h3>
76
81
 
77
82
  <dl class="message-properties">
83
+ <dt>Topic <span class="property-type">string</span></dt>
84
+ <dd> defines the topic for the output message.</dd>
78
85
  <dt>Property <span class="property-type">string</span></dt>
79
86
  <dd> defines the message property to be used as payload.</dd>
80
87
  <dt>Status <span class="property-type">boolean</span></dt>
package/math_minus.js CHANGED
@@ -4,6 +4,7 @@ module.exports = function(RED) {
4
4
  RED.nodes.createNode(this,config);
5
5
  //this.config = config;
6
6
  var node = this;
7
+ this.topic = config.topic ?? "";
7
8
  this.property = config.property ?? "payload";
8
9
  this.propertyType = config.propertyType ?? "msg";
9
10
  this.showState = Boolean( config.showState );
@@ -54,6 +55,10 @@ module.exports = function(RED) {
54
55
  let status = { text:msg.payload };
55
56
  if( ! isNaN( msg.payload ) )
56
57
  {
58
+ if( node.topic )
59
+ {
60
+ msg.topic = node.topic;
61
+ }
57
62
  if( node.filter )
58
63
  {
59
64
  status.shape = "dot";
@@ -30,7 +30,7 @@ module.exports = function(RED) {
30
30
  }
31
31
  else if( msg.reset || msg.topic==="init" )
32
32
  {
33
- context.set( "data", {} );
33
+ context.set( "data", {}, node.contextStore );
34
34
  node.status( "" );
35
35
  done();
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-logic",
3
- "version": "3.11.2",
3
+ "version": "3.11.4",
4
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",