@mschaeffler/node-red-logic 1.4.6 → 1.4.7

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/logic_bool.js CHANGED
@@ -9,6 +9,7 @@ module.exports = function(RED) {
9
9
  this.showState = Boolean( config.showState );
10
10
  this.filter = Boolean( config.filter );
11
11
  this.last = null;
12
+ node.status( "" );
12
13
 
13
14
  node.on('input', function(msg,send,done) {
14
15
  if( msg.invalid )
package/logic_not.js CHANGED
@@ -9,6 +9,7 @@ module.exports = function(RED) {
9
9
  this.showState = Boolean( config.showState );
10
10
  this.filter = Boolean( config.filter );
11
11
  this.last = null;
12
+ node.status( "" );
12
13
 
13
14
  node.on('input', function(msg,send,done) {
14
15
  if( msg.invalid )
package/math_falling.js CHANGED
@@ -19,6 +19,7 @@ module.exports = function(RED) {
19
19
  return;
20
20
  }
21
21
  }
22
+ node.status( "" );
22
23
 
23
24
  node.on('input', function(msg,send,done) {
24
25
  if( msg.invalid )
@@ -21,6 +21,7 @@ module.exports = function(RED) {
21
21
  return;
22
22
  }
23
23
  }
24
+ node.status( "" );
24
25
 
25
26
  node.on('input', function(msg,send,done) {
26
27
  if( msg.invalid )
package/math_mean.html CHANGED
@@ -13,7 +13,8 @@
13
13
  return v!=='' && !isNaN(v) && Number(v)>0;}
14
14
  },
15
15
  filter:{value:"0", validate:RED.validators.number()},
16
- zeroIsZero:{value:false}
16
+ zeroIsZero:{value:false},
17
+ showState:{value:false}
17
18
  },
18
19
  inputs:1,
19
20
  outputs:1,
@@ -62,6 +63,10 @@
62
63
  <label for="node-input-zeroIsZero"><i class="fa fa-exclamation-circle"></i> Null ist Null</label>
63
64
  <input type="checkbox" id="node-input-zeroIsZero" style="display:inline-block; width:20px; vertical-align:baseline;">
64
65
  </div>
66
+ <div class="form-row">
67
+ <label for="node-input-showStatus"><i class="fa fa-star-o"></i> Status</label>
68
+ <input type="checkbox" id="node-input-showState" style="display:inline-block; width:20px; vertical-align:baseline;">
69
+ </div>
65
70
  </script>
66
71
 
67
72
  <script type="text/html" data-help-name="mean">
@@ -101,5 +106,7 @@
101
106
  <dd> send output only after this time.</dd>
102
107
  <dt>Null ist NUll <span class="property-type">boolean</span></dt>
103
108
  <dd> If 0 is received, 0 is send immediately.</dd>
109
+ <dt>Status <span class="property-type">boolean</span></dt>
110
+ <dd> shows the actual value as a node status.</dd>
104
111
  </dl>
105
112
  </script>
package/math_mean.js CHANGED
@@ -11,6 +11,7 @@ module.exports = function(RED) {
11
11
  this.minData = Number( config.minData ?? 1 );
12
12
  this.filter = Number( config.filter ?? 0 )*1000;
13
13
  this.zeroIsZero = Boolean( config.zeroIsZero );
14
+ this.showState = Boolean( config.showState );
14
15
  if( this.propertyType === "jsonata" )
15
16
  {
16
17
  try {
@@ -21,6 +22,15 @@ module.exports = function(RED) {
21
22
  return;
22
23
  }
23
24
  }
25
+ this.oldStatus = this.status;
26
+ this.status = function(state)
27
+ {
28
+ if( node.showState )
29
+ {
30
+ node.oldStatus( state );
31
+ }
32
+ }
33
+ node.oldStatus( "" );
24
34
 
25
35
  node.on('input', function(msg,send,done) {
26
36
  if( msg.invalid )
package/math_minus.js CHANGED
@@ -19,6 +19,7 @@ module.exports = function(RED) {
19
19
  return;
20
20
  }
21
21
  }
22
+ node.status( "" );
22
23
 
23
24
  node.on('input', function(msg,send,done) {
24
25
  if( msg.invalid )
package/math_number.js CHANGED
@@ -19,6 +19,7 @@ module.exports = function(RED) {
19
19
  return;
20
20
  }
21
21
  }
22
+ node.status( "" );
22
23
 
23
24
  node.on('input', function(msg,send,done) {
24
25
  if( msg.invalid )
package/math_rising.js CHANGED
@@ -19,6 +19,7 @@ module.exports = function(RED) {
19
19
  return;
20
20
  }
21
21
  }
22
+ node.status( "" );
22
23
 
23
24
  node.on('input', function(msg,send,done) {
24
25
  if( msg.invalid )
@@ -7,8 +7,8 @@ module.exports = function(RED) {
7
7
  var context = this.context();
8
8
  this.property = config.property || "payload";
9
9
  this.propertyType = config.propertyType ?? "msg";
10
- this.deltaTime = Number( config.deltaTime )*1000;
11
- this.minData = Number( config.minData );
10
+ this.deltaTime = Number( config.deltaTime ?? 60 )*1000;
11
+ this.minData = Number( config.minData ?? 1 );
12
12
  if( this.propertyType === "jsonata" )
13
13
  {
14
14
  try {
@@ -33,7 +33,6 @@ module.exports = function(RED) {
33
33
  }
34
34
  else
35
35
  {
36
- const now = Date.now();
37
36
  function getPayload(callback)
38
37
  {
39
38
  if( node.propertyPrepared )
@@ -57,6 +56,7 @@ module.exports = function(RED) {
57
56
  }
58
57
  getPayload( function(value)
59
58
  {
59
+ const now = Date.now();
60
60
  const payload = Number( value );
61
61
  if( ! isNaN( payload ) )
62
62
  {
@@ -73,6 +73,7 @@ module.exports = function(RED) {
73
73
  if( item.length >= node.minData )
74
74
  {
75
75
  msg.stat = {
76
+ value: payload,
76
77
  count: item.length,
77
78
  min: Number.MAX_SAFE_INTEGER,
78
79
  max: Number.MIN_SAFE_INTEGER };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-logic",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
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",
@@ -35,5 +35,8 @@
35
35
  "author": {
36
36
  "name": "Mathias Schäffler",
37
37
  "url": "https://github.com/m-schaeffler"
38
+ },
39
+ "scripts": {
40
+ "test": "mocha \"test/*_spec.js\""
38
41
  }
39
42
  }