@mschaeffler/node-red-bthome 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -83,6 +83,7 @@ There are two output ports:
83
83
  |config | type | description |
84
84
  |:------------|:-------|:----------------------------------|
85
85
  |Devices | JSON | configuration of the BT-Home devices |
86
+ |counter is time|Boolean| the counter in encrypted messages is checked again the actual time |
86
87
  |Status-Prefix| string | prefix for the topic for state output |
87
88
  |Event-Prefix | string | prefix for the topic for event output |
88
89
  |Context-Variable| string | name of the variable in flow context storage |
@@ -124,7 +125,7 @@ Example:
124
125
  "encrypted": false,
125
126
  "battery": 100,
126
127
  "gw": { "Shelly Gateway": { "time": 1745395033113, "rssi":-85 } },
127
- data": { "humidity":56, "temperature":-21.3 }
128
+ "data": { "humidity":56, "temperature":-21.3 }
128
129
  }
129
130
  }
130
131
  ```
package/bthome.html CHANGED
@@ -167,6 +167,8 @@
167
167
  <dl class="message-properties">
168
168
  <dt>Devices <span class="property-type">JSON</span></dt>
169
169
  <dd> configuration of the BT-Home devices.</dd>
170
+ <dt>counter is times <span class="property-type">Boolean</span></dt>
171
+ <dd> the counter in encrypted messages is checked again the actual time.</dd>
170
172
  <dt>Status-Prefix <span class="property-type">string</span></dt>
171
173
  <dd> prefix for the topic for state output.</dd>
172
174
  <dt>Event-Prefix <span class="property-type">string</span></dt>
@@ -208,7 +210,7 @@
208
210
  "encrypted": false,<br>
209
211
  "battery": 100,<br>
210
212
  "gw": { "Shelly Gateway": { "time": 1745395033113, "rssi":-85 } },<br>
211
- data": { "humidity":56, "temperature":-21.3 }<br>
213
+ "data": { "humidity":56, "temperature":-21.3 }<br>
212
214
  }
213
215
  }<code>
214
216
 
package/bthome.js CHANGED
@@ -84,8 +84,8 @@ module.exports = function(RED) {
84
84
  if( node.counterTime )
85
85
  {
86
86
  const counterInt = counter[0] | (counter[1]<<8) | (counter[2]<<16) | (counter[3]<<24);
87
- const delta = msgTime - counterInt*1000;
88
- if( delta < -5000 || delta > 15000 )
87
+ const delta = Math.abs( msgTime - counterInt*1000 );
88
+ if( delta > 15000 )
89
89
  {
90
90
  throw new Error( "bthome "+msg.payload.gateway+" "+name+" "+(new Date(counterInt*1000))+" "+delta );
91
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-bthome",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "A Node Red node to decrypt and decode BT-Home frames",
5
5
  "author": {
6
6
  "name": "Mathias Schäffler",