homebridge-ring 11.7.0-beta.5 → 11.7.0-beta.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # homebridge-ring
2
2
 
3
+ ## 11.7.0-beta.6
4
+
5
+ ### Minor Changes
6
+
7
+ - [`d49548f`](https://github.com/dgreif/ring/commit/d49548f9d563d2faf094899f9d120689ac4083f3) Thanks [@dgreif](https://github.com/dgreif)! - Detect unlock notification from intercom
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`d49548f`](https://github.com/dgreif/ring/commit/d49548f9d563d2faf094899f9d120689ac4083f3)]:
12
+ - ring-client-api@11.7.0-beta.6
13
+
3
14
  ## 11.7.0-beta.5
4
15
 
5
16
  ### Minor Changes
package/lib/intercom.js CHANGED
@@ -12,7 +12,29 @@ class Intercom extends base_data_accessory_1.BaseDataAccessory {
12
12
  this.accessory = accessory;
13
13
  this.config = config;
14
14
  this.unlocking = false;
15
- const { Characteristic, Service } = hap_1.hap, lockService = this.getService(Service.LockMechanism), { LockCurrentState, LockTargetState, ProgrammableSwitchEvent } = Characteristic, programableSwitchService = this.getService(Service.StatelessProgrammableSwitch), onDoorbellPressed = device.onDing.pipe((0, operators_1.throttleTime)(15000), (0, operators_1.map)(() => ProgrammableSwitchEvent.SINGLE_PRESS));
15
+ const { Characteristic, Service } = hap_1.hap, lockService = this.getService(Service.LockMechanism), { LockCurrentState, LockTargetState, ProgrammableSwitchEvent } = Characteristic, programableSwitchService = this.getService(Service.StatelessProgrammableSwitch), onDoorbellPressed = device.onDing.pipe((0, operators_1.throttleTime)(15000), (0, operators_1.map)(() => ProgrammableSwitchEvent.SINGLE_PRESS)), syncLockState = () => {
16
+ const state = this.getLockState();
17
+ lockService
18
+ .getCharacteristic(Characteristic.LockCurrentState)
19
+ .updateValue(state);
20
+ lockService
21
+ .getCharacteristic(Characteristic.LockTargetState)
22
+ .updateValue(state);
23
+ }, markAsUnlocked = () => {
24
+ // Mark the lock as unlocked, wait 5 seconds, then mark it as locked again
25
+ clearTimeout(this.unlockTimeout);
26
+ this.unlocking = true;
27
+ // Update current state to reflect that the lock is unlocked
28
+ syncLockState();
29
+ // Leave the door in an "unlocked" state for 5 seconds
30
+ // After that, set the lock back to "locked" for both current and target state
31
+ this.unlockTimeout = setTimeout(() => {
32
+ this.unlocking = false;
33
+ syncLockState();
34
+ }, 5000);
35
+ };
36
+ // Subscribe to unlock events coming from push notifications, which will catch an unlock from the Ring app
37
+ device.onUnlocked.subscribe(markAsUnlocked);
16
38
  // Lock Service
17
39
  this.registerCharacteristic({
18
40
  characteristicType: LockCurrentState,
@@ -33,21 +55,7 @@ class Intercom extends base_data_accessory_1.BaseDataAccessory {
33
55
  this.unlocking = false;
34
56
  });
35
57
  (0, util_1.logInfo)(`Unlock response: ${JSON.stringify(response)}`);
36
- // Update current state to reflect that the lock is unlocked
37
- lockService
38
- .getCharacteristic(Characteristic.LockCurrentState)
39
- .updateValue(this.getLockState());
40
- // Leave the door in an "unlocked" state for 5 seconds
41
- // After that, set the lock back to "locked" for both current and target state
42
- this.unlockTimeout = setTimeout(() => {
43
- this.unlocking = false;
44
- lockService
45
- .getCharacteristic(Characteristic.LockCurrentState)
46
- .updateValue(this.getLockState());
47
- lockService
48
- .getCharacteristic(Characteristic.LockTargetState)
49
- .updateValue(this.getLockState());
50
- }, 5000);
58
+ markAsUnlocked();
51
59
  }
52
60
  else {
53
61
  // If the user locks the door from the home app, we can't do anything but set the states back to "locked"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-ring",
3
- "version": "11.7.0-beta.5",
3
+ "version": "11.7.0-beta.6",
4
4
  "description": "Homebridge plugin for Ring doorbells, cameras, security alarm system and smart lighting",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "@homebridge/camera-utils": "^2.2.0",
15
15
  "@homebridge/plugin-ui-utils": "^0.0.19",
16
- "ring-client-api": "11.7.0-beta.5"
16
+ "ring-client-api": "11.7.0-beta.6"
17
17
  },
18
18
  "devDependencies": {
19
19
  "concurrently": "^7.5.0",