node-switchbot 1.7.0-beta.0 → 1.7.0-beta.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.
@@ -101,7 +101,7 @@ class SwitchbotAdvertising {
101
101
  } else if (model === "j") {
102
102
  sd = this._parseServiceDataForWoPlugMiniJP(manufacturerData, onlog);// WoPlugMini (JP)
103
103
  } else if (model === "o") {
104
- sd = this._parseServiceDataForWoSmartLock(buf, onlog);// WoSmartLock
104
+ sd = this._parseServiceDataForWoSmartLock(manufacturerData, onlog);// WoSmartLock
105
105
  } else if (model === "i") {
106
106
  sd = this._parseServiceDataForWoSensorTHPlus(buf, onlog);// WoMeterPlus
107
107
  } else if (model === "r") {
@@ -365,25 +365,25 @@ class SwitchbotAdvertising {
365
365
  return data;
366
366
  }
367
367
 
368
- _parseServiceDataForWoBulb(buf, onlog) {
369
- if (buf.length !== 13) {
368
+ _parseServiceDataForWoBulb(manufacturerData, onlog) {
369
+ if (manufacturerData.length !== 13) {
370
370
  if (onlog && typeof onlog === "function") {
371
371
  onlog(
372
- `[_parseServiceDataForWoBulb] Buffer length ${buf.length} !== 13!`
372
+ `[_parseServiceDataForWoBulb] Buffer length ${manufacturerData.length} !== 13!`
373
373
  );
374
374
  }
375
375
  return null;
376
376
  }
377
- let byte1 = buf.readUInt8(1);//power and light status
378
- let byte2 = buf.readUInt8(2);//bulb brightness
379
- let byte3 = buf.readUInt8(3);//bulb R
380
- let byte4 = buf.readUInt8(4);//bulb G
381
- let byte5 = buf.readUInt8(5);//bulb B
382
- let byte6 = buf.readUInt8(6);//bulb temperature
383
- let byte7 = buf.readUInt8(7);
384
- let byte8 = buf.readUInt8(8);
385
- let byte9 = buf.readUInt8(9);
386
- let byte10 = buf.readUInt8(10);//bulb mode
377
+ let byte1 = manufacturerData.readUInt8(1);//power and light status
378
+ let byte2 = manufacturerData.readUInt8(2);//bulb brightness
379
+ let byte3 = manufacturerData.readUInt8(3);//bulb R
380
+ let byte4 = manufacturerData.readUInt8(4);//bulb G
381
+ let byte5 = manufacturerData.readUInt8(5);//bulb B
382
+ let byte6 = manufacturerData.readUInt8(6);//bulb temperature
383
+ let byte7 = manufacturerData.readUInt8(7);
384
+ let byte8 = manufacturerData.readUInt8(8);
385
+ let byte9 = manufacturerData.readUInt8(9);
386
+ let byte10 = manufacturerData.readUInt8(10);//bulb mode
387
387
 
388
388
  let power = byte1;
389
389
  let red = byte3;
@@ -418,20 +418,20 @@ class SwitchbotAdvertising {
418
418
  return data;
419
419
  }
420
420
 
421
- _parseServiceDataForWoPlugMiniUS(buf, onlog) {
422
- if (buf.length !== 14) {
421
+ _parseServiceDataForWoPlugMiniUS(manufacturerData, onlog) {
422
+ if (manufacturerData.length !== 14) {
423
423
  if (onlog && typeof onlog === "function") {
424
424
  onlog(
425
- `[_parseServiceDataForWoPlugMiniUS] Buffer length ${buf.length} should be 14`
425
+ `[_parseServiceDataForWoPlugMiniUS] Buffer length ${manufacturerData.length} should be 14`
426
426
  );
427
427
  }
428
428
  return null;
429
429
  }
430
- let byte9 = buf.readUInt8(9); // byte9: plug mini state; 0x00=off, 0x80=on
431
- let byte10 = buf.readUInt8(10); // byte10: bit0: 0=no delay,1=delay, bit1:0=no timer, 1=timer; bit2:0=no sync time, 1=sync'ed time
432
- let byte11 = buf.readUInt8(11); // byte11: wifi rssi
433
- let byte12 = buf.readUInt8(12); // byte12: bit7: overload?
434
- let byte13 = buf.readUInt8(13); // byte12[bit0~6] + byte13: current power value
430
+ let byte9 = manufacturerData.readUInt8(9); // byte9: plug mini state; 0x00=off, 0x80=on
431
+ let byte10 = manufacturerData.readUInt8(10); // byte10: bit0: 0=no delay,1=delay, bit1:0=no timer, 1=timer; bit2:0=no sync time, 1=sync'ed time
432
+ let byte11 = manufacturerData.readUInt8(11); // byte11: wifi rssi
433
+ let byte12 = manufacturerData.readUInt8(12); // byte12: bit7: overload?
434
+ let byte13 = manufacturerData.readUInt8(13); // byte12[bit0~6] + byte13: current power value
435
435
 
436
436
  let state = byte9 === 0x00 ? "off" : byte9 === 0x80 ? "on" : null;
437
437
  let delay = !!(byte10 & 0b00000001);
@@ -457,20 +457,20 @@ class SwitchbotAdvertising {
457
457
  return data;
458
458
  }
459
459
 
460
- _parseServiceDataForWoPlugMiniJP(buf, onlog) {
461
- if (buf.length !== 14) {
460
+ _parseServiceDataForWoPlugMiniJP(manufacturerData, onlog) {
461
+ if (manufacturerData.length !== 14) {
462
462
  if (onlog && typeof onlog === "function") {
463
463
  onlog(
464
- `[_parseServiceDataForWoPlugMiniJP] Buffer length ${buf.length} should be 14`
464
+ `[_parseServiceDataForWoPlugMiniJP] Buffer length ${manufacturerData.length} should be 14`
465
465
  );
466
466
  }
467
467
  return null;
468
468
  }
469
- let byte9 = buf.readUInt8(9); // byte9: plug mini state; 0x00=off, 0x80=on
470
- let byte10 = buf.readUInt8(10); // byte10: bit0: 0=no delay,1=delay, bit1:0=no timer, 1=timer; bit2:0=no sync time, 1=sync'ed time
471
- let byte11 = buf.readUInt8(11); // byte11: wifi rssi
472
- let byte12 = buf.readUInt8(12); // byte12: bit7: overload?
473
- let byte13 = buf.readUInt8(13); // byte12[bit0~6] + byte13: current power value
469
+ let byte9 = manufacturerData.readUInt8(9); // byte9: plug mini state; 0x00=off, 0x80=on
470
+ let byte10 = manufacturerData.readUInt8(10); // byte10: bit0: 0=no delay,1=delay, bit1:0=no timer, 1=timer; bit2:0=no sync time, 1=sync'ed time
471
+ let byte11 = manufacturerData.readUInt8(11); // byte11: wifi rssi
472
+ let byte12 = manufacturerData.readUInt8(12); // byte12: bit7: overload?
473
+ let byte13 = manufacturerData.readUInt8(13); // byte12[bit0~6] + byte13: current power value
474
474
 
475
475
  let state = byte9 === 0x00 ? "off" : byte9 === 0x80 ? "on" : null;
476
476
  let delay = !!(byte10 & 0b00000001);
@@ -496,18 +496,18 @@ class SwitchbotAdvertising {
496
496
  return data;
497
497
  }
498
498
 
499
- _parseServiceDataForWoSmartLock(buf, onlog) {
500
- if (buf.length !== 6) {
499
+ _parseServiceDataForWoSmartLock(manufacturerData, onlog) {
500
+ if (manufacturerData.length !== 6) {
501
501
  if (onlog && typeof onlog === "function") {
502
502
  onlog(
503
- `[_parseServiceDataForWoSmartLock] Buffer length ${buf.length} !== 6!`
503
+ `[_parseServiceDataForWoSmartLock] Buffer length ${manufacturerData.length} !== 6!`
504
504
  );
505
505
  }
506
506
  return null;
507
507
  }
508
- let byte2 = buf.readUInt8(2);
509
- let byte7 = buf.readUInt8(7);
510
- let byte8 = buf.readUInt8(8);
508
+ let byte2 = manufacturerData.readUInt8(2);
509
+ let byte7 = manufacturerData.readUInt8(7);
510
+ let byte8 = manufacturerData.readUInt8(8);
511
511
 
512
512
 
513
513
  let LockStatus = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-switchbot",
3
- "version": "1.7.0-beta.0",
3
+ "version": "1.7.0-beta.1",
4
4
  "description": "The node-switchbot is a Node.js module which allows you to control your Switchbot Devices through Bluetooth (BLE).",
5
5
  "main": "./lib/switchbot.js",
6
6
  "files": [