@mschaeffler/node-red-bthome 1.2.0 → 1.4.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.
package/README.md CHANGED
@@ -34,6 +34,7 @@ $ npm install @mschaeffler/node-red-bthome
34
34
  |msg. | type | description |
35
35
  |:-------|:-------|:----------------------------------|
36
36
  |payload | object | data from Shelly script|
37
+ |resync | boolean| if set to yes, allow all packed ids; to resync after some issue|
37
38
 
38
39
  ### msg.payload
39
40
 
package/bthome.html CHANGED
@@ -123,6 +123,8 @@
123
123
  <dl class="message-properties">
124
124
  <dt>payload <span class="property-type">object</span></dt>
125
125
  <dd> data from Shelly script</dd>
126
+ <dt>resync <span class="property-type">boolean</span></dt>
127
+ <dd> if set to yes, allow all packed ids; to resync after some issue</dd>
126
128
  </dl>
127
129
 
128
130
  <h4>msg.payload</h4>
package/bthome.js CHANGED
@@ -4,7 +4,7 @@ const Rawdata = require( "./rawdata.js" );
4
4
  const BtEvent = require( "./btevent.js" );
5
5
 
6
6
  class TypeIds {
7
- static bluDW = 0x0202;
7
+ static bluDW = 2;
8
8
  static bluRemote = 9;
9
9
  }
10
10
  Object.freeze( TypeIds );
@@ -59,7 +59,20 @@ module.exports = function(RED) {
59
59
  }
60
60
 
61
61
  node.on('input', function(msg,send,done) {
62
- if( ! Array.isArray( msg.payload.data ) )
62
+ if( msg.resync )
63
+ {
64
+ for( const t in node.data )
65
+ {
66
+ node.data[t].pid = null;
67
+ }
68
+ if( node.contextStore !== "none" )
69
+ {
70
+ node.flowcontext.set( node.contextVar, node.data, node.contextStore );
71
+ }
72
+ done();
73
+ return;
74
+ }
75
+ if( ! Array.isArray( msg.payload?.data ) )
63
76
  {
64
77
  node.statistics.err++;
65
78
  done( "msg.payload.data must be an Array!" );
@@ -253,7 +266,7 @@ module.exports = function(RED) {
253
266
  setData( "channel", rawdata.getUInt8() + 1 );
254
267
  break;
255
268
  case 0xF0:
256
- item.typeId = rawdata.getUInt16();
269
+ item.typeId = rawdata.getUInt16() & 0xFF;
257
270
  break;
258
271
  case 0xF1:
259
272
  item.version = {
@@ -288,7 +301,7 @@ module.exports = function(RED) {
288
301
  {
289
302
  // veraltete Nachricht und nicht reboot
290
303
  node.statistics.old++;
291
- node.warn( `old ble message ${name} from ${msg.payload.gateway} dropped, ${pid} < ${item.pid}` );
304
+ node.warn( `old ble message ${name} dropped, ${pid} < ${item.pid}` );
292
305
  return false;
293
306
  }
294
307
  if( msg.payload.gateway )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-bthome",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "A Node Red node to decrypt and decode BT-Home frames",
5
5
  "author": {
6
6
  "name": "Mathias Schäffler",