@mschaeffler/node-red-bthome 0.2.2 → 0.2.3

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/bthome.html CHANGED
@@ -5,6 +5,7 @@
5
5
  defaults: {
6
6
  name: {value:""},
7
7
  devices:{value:"[]",required:true},
8
+ counterTime:{value:false},
8
9
  statusPrefix:{value:""},
9
10
  eventPrefix:{value:""},
10
11
  contextVar:{value:"bthome",required:true},
@@ -65,6 +66,10 @@
65
66
  <label for="node-input-devices"><i class="fa fa-bluetooth-b"></i> Devices</label>
66
67
  <input type="text" id="node-input-devices">
67
68
  </div>
69
+ <div class="form-row">
70
+ <label for="node-input-counterTime"><i class="fa fa-clock-o"></i> counter is time</label>
71
+ <input type="checkbox" id="node-input-counterTime" style="display:inline-block; width:20px; vertical-align:baseline;">
72
+ </div>
68
73
  <div class="form-row">
69
74
  <label for="node-input-statusPrefix"><i class="fa fa-star"></i> Status-Prefix</label>
70
75
  <input type="text" id="node-input-statusPrefix"></input>
package/bthome.js CHANGED
@@ -9,6 +9,7 @@ module.exports = function(RED) {
9
9
  var node = this;
10
10
  this.flowcontext = this.context().flow;
11
11
  this.devices = JSON.parse( config.devices ?? "{}" );
12
+ this.counterTime = Boolean( config.counterTime );
12
13
  this.statusPrefix = config.statusPrefix ? config.statusPrefix+'/' : "";
13
14
  this.eventPrefix = config.eventPrefix ? config.eventPrefix +'/' : "";
14
15
  this.contextVar = config.contextVar ?? "bthome";
@@ -105,8 +106,7 @@ module.exports = function(RED) {
105
106
  decipher.setAuthTag( mic );
106
107
  rawdata = Array.from( decipher.update( ciphertext ) );
107
108
  decipher.final();
108
-
109
- if( Date.now() - counterInt*1000 > 7500 )
109
+ if( node.counterTime && Date.now() - counterInt*1000 > 7500 )
110
110
  {
111
111
  node.error("bthome "+name+" "+(new Date(counterInt*1000))+" "+(Date.now()-counterInt*1000));
112
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-bthome",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "A Node Red node to decrypt and decode BT-Home frames",
5
5
  "author": {
6
6
  "name": "Mathias Schäffler",