@mschaeffler/node-red-logic 3.0.4 → 3.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.
@@ -12,6 +12,7 @@
12
12
  return v!=='' && !isNaN(v) && Number(v)<raise;}
13
13
  },
14
14
  consecutive:{value:"1",required:true},
15
+ consecutiveFall:{value:"1",required:true},
15
16
  outputRise:{value:true,required:true},
16
17
  outputRiseType:{value:"bool"},
17
18
  outputFall:{value:false,required:true},
@@ -69,9 +70,13 @@
69
70
  <input type="text" id="node-input-threshold_fall">
70
71
  </div>
71
72
  <div class="form-row">
72
- <label for="node-input-consecutive"><i class="fa fa-line-chart"></i> Consecutive</label>
73
+ <label for="node-input-consecutive"><i class="fa fa-line-chart"></i> rise Consecutive</label>
73
74
  <input type="text" id="node-input-consecutive">
74
75
  </div>
76
+ <div class="form-row">
77
+ <label for="node-input-consecutiveFall"><i class="fa fa-line-chart"></i> fall Consecutive</label>
78
+ <input type="text" id="node-input-consecutiveFall">
79
+ </div>
75
80
  <div class="form-row">
76
81
  <label for="node-input-outputRise"><i class="fa fa-sign-out"></i> rise Output</label>
77
82
  <input type="text" id="node-input-outputRise">
@@ -131,8 +136,10 @@
131
136
  <dd> threshold value for the rising edge detection.</dd>
132
137
  <dt>d(ow)n Threshold <span class="property-type">number</span></dt>
133
138
  <dd> threshold value for the falling edge detection.</dd>
134
- <dt>Consecutive <span class="property-type">number</span></dt>
135
- <dd> number of consecutive frames to generate an output.</dd>
139
+ <dt>rise Consecutive <span class="property-type">number</span></dt>
140
+ <dd> number of consecutive frames to generate a rising output.</dd>
141
+ <dt>fall Consecutive <span class="property-type">number</span></dt>
142
+ <dd> number of consecutive frames to generate a falling output.</dd>
136
143
  <dt>rise Output <span class="property-type">multi</span></dt>
137
144
  <dd> Value to be sent in case of a rising edge.</dd>
138
145
  <dt>fall Output <span class="property-type">multi</span></dt>
@@ -10,7 +10,8 @@ module.exports = function(RED) {
10
10
  this.propertyType = config.propertyType ?? "msg";
11
11
  this.threshold_rise = Number( config.threshold_raise );
12
12
  this.threshold_fall = Number( config.threshold_fall );
13
- this.consecutive = Number( config.consecutive ?? 1 );
13
+ this.consecutiveRise= Number( config.consecutive ?? 1 );
14
+ this.consecutiveFall= Number( config.consecutiveFall ?? 1 );
14
15
  this.outputRise = tools.convertTypedInput( config.outputRise ?? "true", config.outputRiseType ?? "bool" );
15
16
  this.outputFall = tools.convertTypedInput( config.outputFall ?? "false",config.outputFallType ?? "bool" );
16
17
  this.showState = Boolean( config.showState );
@@ -85,7 +86,7 @@ module.exports = function(RED) {
85
86
 
86
87
  if( msg.value > node.threshold_rise && last !== true )
87
88
  {
88
- if( ++node.cntRise >= node.consecutive )
89
+ if( ++node.cntRise >= node.consecutiveRise )
89
90
  {
90
91
  sendMsg( true );
91
92
  node.cntRise = 0;
@@ -98,7 +99,7 @@ module.exports = function(RED) {
98
99
  }
99
100
  else if( msg.value < node.threshold_fall && last !== false )
100
101
  {
101
- if( ++node.cntFall >= node.consecutive )
102
+ if( ++node.cntFall >= node.consecutiveFall )
102
103
  {
103
104
  sendMsg( false );
104
105
  node.cntFall = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-logic",
3
- "version": "3.0.4",
3
+ "version": "3.1.0",
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",