homebridge-ring 11.7.0-beta.4 → 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 +22 -0
- package/README.md +1 -0
- package/lib/intercom.js +30 -17
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
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
|
+
|
|
14
|
+
## 11.7.0-beta.5
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [`f59e357`](https://github.com/dgreif/ring/commit/f59e35713fb82595a4f25f4226c660fb635896ed) Thanks [@dgreif](https://github.com/dgreif)! - Add true doorbell service for intercoms. This can trigger Homepods to chime when the intercom doorbell is pressed
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies []:
|
|
23
|
+
- ring-client-api@11.7.0-beta.5
|
|
24
|
+
|
|
3
25
|
## 11.7.0-beta.4
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -216,6 +216,7 @@ Note: Although homebridge has support for HomeKit Secure Video (HKSV), I will no
|
|
|
216
216
|
Intercom support is still experimental. See [this issue](https://github.com/dgreif/ring/issues/1083) for more details
|
|
217
217
|
|
|
218
218
|
- Unlock door
|
|
219
|
+
- Doorbell which can cause Homepods to chime when the intercom doorbell is pressed
|
|
219
220
|
- Programmable switch which is trigged when the intercom doorbell is pressed
|
|
220
221
|
|
|
221
222
|
### Alarm/Location Modes
|
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
|
-
|
|
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"
|
|
@@ -60,7 +68,12 @@ class Intercom extends base_data_accessory_1.BaseDataAccessory {
|
|
|
60
68
|
});
|
|
61
69
|
lockService.setPrimaryService(true);
|
|
62
70
|
// Doorbell Service
|
|
63
|
-
|
|
71
|
+
this.registerObservableCharacteristic({
|
|
72
|
+
characteristicType: ProgrammableSwitchEvent,
|
|
73
|
+
serviceType: Service.Doorbell,
|
|
74
|
+
onValue: onDoorbellPressed,
|
|
75
|
+
});
|
|
76
|
+
// Programmable Switch Service
|
|
64
77
|
this.registerObservableCharacteristic({
|
|
65
78
|
characteristicType: ProgrammableSwitchEvent,
|
|
66
79
|
serviceType: programableSwitchService,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-ring",
|
|
3
|
-
"version": "11.7.0-beta.
|
|
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.
|
|
16
|
+
"ring-client-api": "11.7.0-beta.6"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"concurrently": "^7.5.0",
|