node-switchbot 1.6.1-beta.0 → 1.7.0-beta.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.
@@ -505,17 +505,43 @@ class SwitchbotAdvertising {
505
505
  }
506
506
  return null;
507
507
  }
508
- let byte1 = buf.readUInt8(1);
509
508
  let byte2 = buf.readUInt8(2);
509
+ let byte7 = buf.readUInt8(7);
510
+ let byte8 = buf.readUInt8(8);
511
+
512
+
513
+ let LockStatus = {
514
+ LOCKED: 0b0000000,
515
+ UNLOCKED: 0b0010000,
516
+ LOCKING: 0b0100000,
517
+ UNLOCKING: 0b0110000,
518
+ LOCKING_STOP: 0b1000000,
519
+ UNLOCKING_STOP: 0b1010000,
520
+ NOT_FULLY_LOCKED: 0b1100000, //Only EU lock type
521
+ }
510
522
 
511
- let movement = (byte1 & 0b01000000) ? true : false; // 1 - Movement detected
512
523
  let battery = byte2 & 0b01111111; // %
524
+ let calibration = byte7 & 0b10000000 ? true : false;
525
+ let status = LockStatus(byte7 & 0b01110000);
526
+ let update_from_secondary_lock = byte7 & 0b00001000 ? true : false;
527
+ let door_open = byte7 & 0b00000100 ? true : false;
528
+ let double_lock_mode = byte8 & 0b10000000 ? true : false;
529
+ let unclosed_alarm = byte8 & 0b00100000 ? true : false;
530
+ let unlocked_alarm = byte8 & 0b00010000 ? true : false;
531
+ let auto_lock_paused = byte8 & 0b00000010 ? true : false;
513
532
 
514
533
  let data = {
515
534
  model: "o",
516
535
  modelName: "WoSmartLock",
517
536
  battery: battery,
518
- movement: movement,
537
+ calibration: calibration,
538
+ status: status,
539
+ update_from_secondary_lock: update_from_secondary_lock,
540
+ door_open: door_open,
541
+ double_lock_mode: double_lock_mode,
542
+ unclosed_alarm: unclosed_alarm,
543
+ unlocked_alarm: unlocked_alarm,
544
+ auto_lock_paused: auto_lock_paused,
519
545
  };
520
546
 
521
547
  return data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-switchbot",
3
- "version": "1.6.1-beta.0",
3
+ "version": "1.7.0-beta.0",
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": [