homebridge-ring 13.2.1 → 14.0.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.
- package/CHANGELOG.md +23 -0
- package/README.md +22 -23
- package/config.schema.json +0 -6
- package/lib/base-accessory.js +14 -18
- package/lib/base-data-accessory.js +9 -13
- package/lib/base-device-accessory.js +7 -11
- package/lib/beam.js +12 -16
- package/lib/brightness-only.js +6 -10
- package/lib/camera-source.js +108 -176
- package/lib/camera.js +27 -31
- package/lib/chime.js +7 -11
- package/lib/co-alarm.js +4 -8
- package/lib/config.js +13 -18
- package/lib/contact-sensor.js +4 -8
- package/lib/fan.js +7 -11
- package/lib/flood-freeze-sensor.js +12 -16
- package/lib/freeze-sensor.js +9 -13
- package/lib/hap.js +3 -6
- package/lib/homebridge-ui/server.js +10 -12
- package/lib/index.js +5 -8
- package/lib/intercom.js +11 -15
- package/lib/location-mode-switch.js +19 -23
- package/lib/lock.js +8 -12
- package/lib/motion-sensor.js +5 -9
- package/lib/multi-level-switch.js +7 -11
- package/lib/outlet.js +6 -10
- package/lib/panic-buttons.js +10 -14
- package/lib/ring-platform.js +126 -142
- package/lib/security-panel.js +18 -22
- package/lib/smoke-alarm.js +4 -8
- package/lib/smoke-co-listener.js +4 -8
- package/lib/switch.js +6 -10
- package/lib/target-value-timer.js +1 -5
- package/lib/temperature-sensor.js +7 -11
- package/lib/thermostat.js +23 -27
- package/lib/unknown-zwave-switch.js +6 -10
- package/lib/util.js +3 -6
- package/lib/valve.js +6 -10
- package/lib/water-sensor.js +9 -13
- package/package.json +8 -7
- package/lib/opus-repacketizer.js +0 -167
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# homebridge-ring
|
|
2
2
|
|
|
3
|
+
## 14.0.0-beta.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`f76974a`](https://github.com/dgreif/ring/commit/f76974a06dbc8c3f2fd30cc00c615406e66f1ba5) Thanks [@dgreif](https://github.com/dgreif)! - Removed bridged cameras. If you already had `unbridgeCameras: true` in your config, this change will not affect you. For those who were still using bridged cameras, you will need to manually add each camera to HomeKit after upgrading. This change allows us to stop requiring special builds of ffmpeg and should make video streaming more reliable. Unbridge cameras are also avoid blocking the whole bridge while waiting for requests (e.g. Snapshot), which leads to a better overall experience. After updating, you can delete the `unbridgeCameras` option from your config.
|
|
8
|
+
|
|
9
|
+
- [`c492877`](https://github.com/dgreif/ring/commit/c49287762a1f12e96306007c8f3579980895e657) Thanks [@dgreif](https://github.com/dgreif)! - Converted project to ESM. This should not impact homebridge-ring, but will require any other projects using ring-client-api to also use ESM in order to use the latest version.
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`2b801e0`](https://github.com/dgreif/ring/commit/2b801e09affa47cb2fd1195d0e6f02734639670c) Thanks [@dgreif](https://github.com/dgreif)! - Avoid snapshots while recording for doorbell_graham_cracker. This should allow notifications to work on these devices in homebridge.
|
|
14
|
+
|
|
15
|
+
- [`b0f735c`](https://github.com/dgreif/ring/commit/b0f735c0c4e02db487ed619d8fe1f823d51e95fa) Thanks [@tsightler](https://github.com/tsightler)! - Simplified handling of Opus audio packets, which should lead to better audio when streaming
|
|
16
|
+
|
|
17
|
+
- [`4daeb5f`](https://github.com/dgreif/ring/commit/4daeb5fc352c8d78853e3f7803dcf5f72a98f188) Thanks [@hkoci](https://github.com/hkoci)! - Add support for Battery Video Doorbell Pro and Battery Video Doorbell Plus
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`6b3bd96`](https://github.com/dgreif/ring/commit/6b3bd96d7b3d89dbb20f79be419e63f424b22ce9) Thanks [@dgreif](https://github.com/dgreif)! - Update Dependencies
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`2b801e0`](https://github.com/dgreif/ring/commit/2b801e09affa47cb2fd1195d0e6f02734639670c), [`4daeb5f`](https://github.com/dgreif/ring/commit/4daeb5fc352c8d78853e3f7803dcf5f72a98f188), [`c492877`](https://github.com/dgreif/ring/commit/c49287762a1f12e96306007c8f3579980895e657), [`6b3bd96`](https://github.com/dgreif/ring/commit/6b3bd96d7b3d89dbb20f79be419e63f424b22ce9)]:
|
|
24
|
+
- ring-client-api@14.0.0-beta.0
|
|
25
|
+
|
|
3
26
|
## 13.2.1
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -80,29 +80,28 @@ Only include an optional parameter if you actually need it. Default behavior wit
|
|
|
80
80
|
}
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
| Option
|
|
84
|
-
| ---------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `disableLogs` | false | Turns off all logging |
|
|
83
|
+
| Option | Default | Explanation |
|
|
84
|
+
| ---------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
|
|
85
|
+
| `alarmOnEntryDelay` | `false` | if `true`, HomeKit will register a delayed entry event as a triggered alarm. There are some households where this is a nice feature as a heads up if you have other people who enter your house and you want an alert so that you can disable the alarm for them before it actually goes off. This works well if you automatically arm/disarm on leave/arrive (see setup instructions below) |
|
|
86
|
+
| `beamDurationSeconds` | `60` for light groups, previous from Ring app for individual lights | Ring smart lighting has a default behavior of only staying on for 60 seconds when you turn on a light via the Ring app. To force a duration when the light is turned on from HomeKit, set this option to a specific number of seconds. If this option is not set, the lights will use the duration from the previous time the light was turned on in the Ring app. For light groups, this will default to 60 seconds. The maximum value is `32767`, which is ~9.1 hours. |
|
|
87
|
+
| `hideDeviceIds` | `[]` | Allows you to hide specific devices by an array of ids. The id for each device is logged when homebridge starts. |
|
|
88
|
+
| `hideLightGroups` | `false` | Ring smart lighting allows you to create lighting groups within the Ring app. These groups are convenient for detecting motion in an area of your yard and turning on/off all lights in the group. However, you may wish to group the lights differently in HomeKit and ignore the groups you have configured in Ring. If this option is `true`, your Ring groups (and their associated motion sensor) will be ignored and will not show up in HomeKit. |
|
|
89
|
+
| `hideDoorbellSwitch` | `false` | If you have a Ring video doorbell, you will see a Programmable Switch associated with it. This switch can be used to perform actions on when the doorbell is pressed using "Single Press" actions. If you do not care to perform actions when the doorbell is pressed, you can hide the Programmable Switch by setting this option to `true`. You will still be able to receive _notifications_ from the doorbell even if the Programmable Switch is hidden (notifications can be configured in the settings for the doorbell camera in the Home app) |
|
|
90
|
+
| `hideCameraLight` | `false` | If `true`, hides the light for Ring cameras in HomeKit. |
|
|
91
|
+
| `hideCameraMotionSensor` | `false` | If `true`, hides the motion sensor for Ring cameras in HomeKit. |
|
|
92
|
+
| `hideCameraSirenSwitch` | `false` | If `true`, hides the siren switch for Ring cameras in HomeKit. |
|
|
93
|
+
| `hideInHomeDoorbellSwitch` | `false` | If `true`, hides the switch for in-home doorbells in HomeKit. |
|
|
94
|
+
| `hideAlarmSirenSwitch` | `false` | If you have a Ring Alarm, you will see both the alarm and a "Siren" switch in HomeKit. The siren switch can sometimes get triggered by Siri commands by accident, which is loud and annoying. Set this option to `true` to hide the siren switch. |
|
|
95
|
+
| `showPanicButtons` | `false` | Creates a new `Panic Buttons` device in HomeKit with `Burglar Alarm` and `Fire Alarm` switches. **Use these at your own risk. I do not guarantee functionality in case of emergency, nor do I take responsibility for any false alarms**. These function just like the SOS sliders in the Ring app. |
|
|
96
|
+
| `nightModeBypassFor` | no Night Mode | Allows you to use Night mode to "Bypass and Arm" a Ring Alarm. Can be set to `all` for Away or `some` for Home. If set and Night mode is activated from HomeKit, any open contact sensors will automatically be bypassed. |
|
|
97
|
+
| `avoidSnapshotBatteryDrain` | false | Causes snapshots for battery cameras to be fetched at a minimum 10 minute interval to avoid draining the battery. |
|
|
98
|
+
| `cameraStatusPollingSeconds` | `20` | How frequently to poll for updates to your cameras and chimes (in seconds). Information like light/siren/volume/snooze status do not update in real time and need to be requested periodically. |
|
|
99
|
+
| `locationModePollingSeconds` | `20` | How frequently to poll for location mode updates (in seconds). This is only useful if you are using location modes to control camera settings and want to keep an up-to-date reference of the current mode for each location. Polling is automatically disabled for locations equipped with a Ring Alarm. Will hide Location Mode switch if set to `0` |
|
|
100
|
+
| `locationIds` | All Locations | Use this option if you only want a subset of your locations to appear in HomeKit. If this option is not included, all of your locations will be added to HomeKit (which is what most users will want to do). |
|
|
101
|
+
| `onlyDeviceTypes` | All Device Types | A subset of device types to be shown. If set, all other device types will be hidden in HomeKit. |
|
|
102
|
+
| `ffmpegPath` | Uses `ffmpeg-for-homebridge` | A custom path to the `ffmpeg` executable. By default, the static binaries built in [ffmpeg-for-homebridge](https://github.com/oznu/ffmpeg-for-homebridge) will be used. If you prefer to use your own version of ffmpeg, you can pass a complete path, or simply `"ffmpeg"` to use ffmpeg from your `PATH`. |
|
|
103
|
+
| `debug` | false | Turns on additional logging. In particular, ffmpeg logging. |
|
|
104
|
+
| `disableLogs` | false | Turns off all logging |
|
|
106
105
|
|
|
107
106
|
### Cameras
|
|
108
107
|
|
package/config.schema.json
CHANGED
|
@@ -16,11 +16,6 @@
|
|
|
16
16
|
"description": "Click \"Generate New Refresh Token\" above to change accounts or if your refresh token has expired",
|
|
17
17
|
"placeholder": "Refresh Token"
|
|
18
18
|
},
|
|
19
|
-
"unbridgeCameras": {
|
|
20
|
-
"title": "Unbridge Cameras",
|
|
21
|
-
"type": "boolean",
|
|
22
|
-
"description": "If enabled, all Ring Cameras we be treated as external accessories, which generally leads to better performance. This means they each need to be individually added to HomeKit. This option will be enabled by default in the next major release. WARNING: If your cameras are already bridged, they will be deleted from HomeKit when you enable this option, and you will need to reconfigure any associated automations or HomeKit settings"
|
|
23
|
-
},
|
|
24
19
|
"alarmOnEntryDelay": {
|
|
25
20
|
"title": "Alarm on Entry Delay",
|
|
26
21
|
"type": "boolean",
|
|
@@ -157,7 +152,6 @@
|
|
|
157
152
|
"title": "Optional Configuration",
|
|
158
153
|
"expandable": true,
|
|
159
154
|
"items": [
|
|
160
|
-
"unbridgeCameras",
|
|
161
155
|
"alarmOnEntryDelay",
|
|
162
156
|
"hideLightGroups",
|
|
163
157
|
"hideDoorbellSwitch",
|
package/lib/base-accessory.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const rxjs_1 = require("rxjs");
|
|
7
|
-
const config_1 = require("./config");
|
|
8
|
-
const util_1 = require("ring-client-api/util");
|
|
1
|
+
import { hap } from "./hap.js";
|
|
2
|
+
import { shareReplay, take } from 'rxjs/operators';
|
|
3
|
+
import { firstValueFrom } from 'rxjs';
|
|
4
|
+
import { debug } from "./config.js";
|
|
5
|
+
import { logError, logInfo } from 'ring-client-api/util';
|
|
9
6
|
function isServiceInstance(serviceType) {
|
|
10
7
|
return typeof serviceType === 'object';
|
|
11
8
|
}
|
|
12
|
-
class BaseAccessory {
|
|
9
|
+
export class BaseAccessory {
|
|
13
10
|
servicesInUse = [];
|
|
14
11
|
initBase() {
|
|
15
12
|
this.pruneUnusedServices();
|
|
@@ -18,14 +15,14 @@ class BaseAccessory {
|
|
|
18
15
|
if (isServiceInstance(serviceType)) {
|
|
19
16
|
return serviceType;
|
|
20
17
|
}
|
|
21
|
-
if (
|
|
18
|
+
if (debug) {
|
|
22
19
|
name = 'TEST ' + name;
|
|
23
20
|
}
|
|
24
21
|
const existingService = subType
|
|
25
22
|
? this.accessory.getServiceById(serviceType, subType)
|
|
26
23
|
: this.accessory.getService(serviceType), service = existingService ||
|
|
27
24
|
this.accessory.addService(serviceType, name, subType);
|
|
28
|
-
if (
|
|
25
|
+
if (debug &&
|
|
29
26
|
existingService &&
|
|
30
27
|
existingService.displayName &&
|
|
31
28
|
name !== existingService.displayName) {
|
|
@@ -37,17 +34,17 @@ class BaseAccessory {
|
|
|
37
34
|
return service;
|
|
38
35
|
}
|
|
39
36
|
registerObservableCharacteristic({ characteristicType, serviceType, serviceSubType, onValue, setValue, name, requestUpdate, }) {
|
|
40
|
-
const service = this.getService(serviceType, name, serviceSubType), characteristic = service.getCharacteristic(characteristicType), onCachedValue = onValue.pipe(
|
|
37
|
+
const service = this.getService(serviceType, name, serviceSubType), characteristic = service.getCharacteristic(characteristicType), onCachedValue = onValue.pipe(shareReplay(1));
|
|
41
38
|
onCachedValue.subscribe((value) => {
|
|
42
39
|
characteristic.updateValue(value);
|
|
43
40
|
});
|
|
44
41
|
if (requestUpdate) {
|
|
45
42
|
// Only register for GET if an async request should be made to get an updated value
|
|
46
|
-
onCachedValue.pipe(
|
|
43
|
+
onCachedValue.pipe(take(1)).subscribe(() => {
|
|
47
44
|
// allow GET once a value is cached
|
|
48
45
|
characteristic.on("get" /* CharacteristicEventTypes.GET */, async (callback) => {
|
|
49
46
|
try {
|
|
50
|
-
const value = await
|
|
47
|
+
const value = await firstValueFrom(onCachedValue);
|
|
51
48
|
callback(null, value);
|
|
52
49
|
requestUpdate();
|
|
53
50
|
}
|
|
@@ -60,21 +57,20 @@ class BaseAccessory {
|
|
|
60
57
|
if (setValue) {
|
|
61
58
|
characteristic.on("set" /* CharacteristicEventTypes.SET */, (newValue, callback) => {
|
|
62
59
|
Promise.resolve(setValue(newValue)).catch((e) => {
|
|
63
|
-
|
|
60
|
+
logError(e);
|
|
64
61
|
});
|
|
65
62
|
callback();
|
|
66
63
|
});
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
pruneUnusedServices() {
|
|
70
|
-
const safeServiceUUIDs = [
|
|
67
|
+
const safeServiceUUIDs = [hap.Service.CameraRTPStreamManagement.UUID];
|
|
71
68
|
this.accessory.services.forEach((service) => {
|
|
72
69
|
if (!this.servicesInUse.includes(service) &&
|
|
73
70
|
!safeServiceUUIDs.includes(service.UUID)) {
|
|
74
|
-
|
|
71
|
+
logInfo('Pruning unused service', service.UUID, service.displayName || service.name, 'from', this.device.name);
|
|
75
72
|
this.accessory.removeService(service);
|
|
76
73
|
}
|
|
77
74
|
});
|
|
78
75
|
}
|
|
79
76
|
}
|
|
80
|
-
exports.BaseAccessory = BaseAccessory;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const operators_1 = require("rxjs/operators");
|
|
7
|
-
const util_1 = require("ring-client-api/util");
|
|
8
|
-
class BaseDataAccessory extends base_accessory_1.BaseAccessory {
|
|
1
|
+
import { BaseAccessory } from "./base-accessory.js";
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators';
|
|
4
|
+
import { logError } from 'ring-client-api/util';
|
|
5
|
+
export class BaseDataAccessory extends BaseAccessory {
|
|
9
6
|
registerCharacteristic({ characteristicType, serviceType, getValue, setValue, setValueDebounceTime = 0, name, requestUpdate, serviceSubType, }) {
|
|
10
7
|
const service = this.getService(serviceType, name, serviceSubType), characteristic = service.getCharacteristic(characteristicType), { device } = this;
|
|
11
8
|
if (requestUpdate) {
|
|
@@ -22,22 +19,22 @@ class BaseDataAccessory extends base_accessory_1.BaseAccessory {
|
|
|
22
19
|
});
|
|
23
20
|
}
|
|
24
21
|
if (setValue && setValueDebounceTime) {
|
|
25
|
-
const onValueToSet = new
|
|
22
|
+
const onValueToSet = new Subject();
|
|
26
23
|
characteristic.on("set" /* CharacteristicEventTypes.SET */, (newValue, callback) => {
|
|
27
24
|
onValueToSet.next(newValue);
|
|
28
25
|
callback();
|
|
29
26
|
});
|
|
30
|
-
onValueToSet.pipe(
|
|
27
|
+
onValueToSet.pipe(debounceTime(setValueDebounceTime)).subscribe(setValue);
|
|
31
28
|
}
|
|
32
29
|
else if (setValue) {
|
|
33
30
|
characteristic.on("set" /* CharacteristicEventTypes.SET */, (newValue, callback) => {
|
|
34
|
-
Promise.resolve(setValue(newValue)).catch(
|
|
31
|
+
Promise.resolve(setValue(newValue)).catch(logError);
|
|
35
32
|
callback();
|
|
36
33
|
});
|
|
37
34
|
}
|
|
38
35
|
;
|
|
39
36
|
this.device.onData
|
|
40
|
-
.pipe(
|
|
37
|
+
.pipe(map(getValue), distinctUntilChanged())
|
|
41
38
|
.subscribe((value) => characteristic.updateValue(value));
|
|
42
39
|
}
|
|
43
40
|
registerLevelCharacteristic({ characteristicType, serviceType, getValue, setValue, requestUpdate, }) {
|
|
@@ -61,4 +58,3 @@ class BaseDataAccessory extends base_accessory_1.BaseAccessory {
|
|
|
61
58
|
});
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
|
-
exports.BaseDataAccessory = BaseDataAccessory;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.BaseDeviceAccessory = void 0;
|
|
4
|
-
const hap_1 = require("./hap");
|
|
5
|
-
const base_data_accessory_1 = require("./base-data-accessory");
|
|
1
|
+
import { hap } from "./hap.js";
|
|
2
|
+
import { BaseDataAccessory } from "./base-data-accessory.js";
|
|
6
3
|
function getBatteryLevel({ batteryLevel, batteryStatus }) {
|
|
7
4
|
if (batteryLevel !== undefined) {
|
|
8
5
|
return batteryLevel;
|
|
@@ -16,13 +13,13 @@ function getBatteryLevel({ batteryLevel, batteryStatus }) {
|
|
|
16
13
|
return 0;
|
|
17
14
|
}
|
|
18
15
|
function getStatusLowBattery(data) {
|
|
19
|
-
const { StatusLowBattery } =
|
|
16
|
+
const { StatusLowBattery } = hap.Characteristic, batteryLevel = getBatteryLevel(data);
|
|
20
17
|
return batteryLevel > 20
|
|
21
18
|
? StatusLowBattery.BATTERY_LEVEL_NORMAL
|
|
22
19
|
: StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
23
20
|
}
|
|
24
21
|
function getBatteryChargingState({ batteryStatus, batteryBackup, acStatus, }) {
|
|
25
|
-
const { ChargingState } =
|
|
22
|
+
const { ChargingState } = hap.Characteristic;
|
|
26
23
|
if (batteryStatus === 'charging' ||
|
|
27
24
|
batteryStatus === 'charged' ||
|
|
28
25
|
batteryBackup === 'charged' ||
|
|
@@ -38,9 +35,9 @@ function getBatteryChargingState({ batteryStatus, batteryBackup, acStatus, }) {
|
|
|
38
35
|
function hasBatteryStatus({ batteryStatus }) {
|
|
39
36
|
return batteryStatus !== 'none';
|
|
40
37
|
}
|
|
41
|
-
class BaseDeviceAccessory extends
|
|
38
|
+
export class BaseDeviceAccessory extends BaseDataAccessory {
|
|
42
39
|
initBase() {
|
|
43
|
-
const { device: { data: initialData }, device, } = this, { Characteristic, Service } =
|
|
40
|
+
const { device: { data: initialData }, device, } = this, { Characteristic, Service } = hap;
|
|
44
41
|
this.registerCharacteristic({
|
|
45
42
|
characteristicType: Characteristic.Manufacturer,
|
|
46
43
|
serviceType: Service.AccessoryInformation,
|
|
@@ -91,7 +88,7 @@ class BaseDeviceAccessory extends base_data_accessory_1.BaseDataAccessory {
|
|
|
91
88
|
super.initBase();
|
|
92
89
|
}
|
|
93
90
|
initSensorService(serviceType) {
|
|
94
|
-
const { Characteristic } =
|
|
91
|
+
const { Characteristic } = hap;
|
|
95
92
|
this.registerCharacteristic({
|
|
96
93
|
characteristicType: Characteristic.StatusTampered,
|
|
97
94
|
serviceType,
|
|
@@ -110,4 +107,3 @@ class BaseDeviceAccessory extends base_data_accessory_1.BaseDataAccessory {
|
|
|
110
107
|
}
|
|
111
108
|
}
|
|
112
109
|
}
|
|
113
|
-
exports.BaseDeviceAccessory = BaseDeviceAccessory;
|
package/lib/beam.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const base_device_accessory_1 = require("./base-device-accessory");
|
|
7
|
-
const util_1 = require("ring-client-api/util");
|
|
8
|
-
class Beam extends base_device_accessory_1.BaseDeviceAccessory {
|
|
1
|
+
import { RingDeviceType } from 'ring-client-api';
|
|
2
|
+
import { hap } from "./hap.js";
|
|
3
|
+
import { BaseDeviceAccessory } from "./base-device-accessory.js";
|
|
4
|
+
import { logInfo } from 'ring-client-api/util';
|
|
5
|
+
export class Beam extends BaseDeviceAccessory {
|
|
9
6
|
device;
|
|
10
7
|
accessory;
|
|
11
8
|
config;
|
|
@@ -17,10 +14,10 @@ class Beam extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
17
14
|
this.accessory = accessory;
|
|
18
15
|
this.config = config;
|
|
19
16
|
this.isLightGroup =
|
|
20
|
-
this.device.data.deviceType ===
|
|
17
|
+
this.device.data.deviceType === RingDeviceType.BeamsLightGroupSwitch;
|
|
21
18
|
this.groupId = this.device.data.groupId;
|
|
22
|
-
const { Characteristic, Service } =
|
|
23
|
-
if (deviceType !==
|
|
19
|
+
const { Characteristic, Service } = hap, { MotionSensor } = Service, { data: { deviceType }, } = this.device;
|
|
20
|
+
if (deviceType !== RingDeviceType.BeamsMotionSensor) {
|
|
24
21
|
this.registerCharacteristic({
|
|
25
22
|
characteristicType: Characteristic.On,
|
|
26
23
|
serviceType: Service.Lightbulb,
|
|
@@ -29,7 +26,7 @@ class Beam extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
29
26
|
});
|
|
30
27
|
this.getService(Service.Lightbulb).setPrimaryService(true);
|
|
31
28
|
}
|
|
32
|
-
if (deviceType ===
|
|
29
|
+
if (deviceType === RingDeviceType.BeamsMultiLevelSwitch) {
|
|
33
30
|
this.registerLevelCharacteristic({
|
|
34
31
|
characteristicType: Characteristic.Brightness,
|
|
35
32
|
serviceType: Service.Lightbulb,
|
|
@@ -42,7 +39,7 @@ class Beam extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
42
39
|
if (device.data.motionStatus !== undefined &&
|
|
43
40
|
device.data.motionSensorEnabled !== false) {
|
|
44
41
|
this.registerCharacteristic({
|
|
45
|
-
characteristicType:
|
|
42
|
+
characteristicType: hap.Characteristic.MotionDetected,
|
|
46
43
|
serviceType: MotionSensor,
|
|
47
44
|
getValue: (data) => data.motionStatus === 'faulted',
|
|
48
45
|
});
|
|
@@ -50,7 +47,7 @@ class Beam extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
setOnState(on) {
|
|
53
|
-
|
|
50
|
+
logInfo(`Turning ${this.device.name} ${on ? 'On' : 'Off'}`);
|
|
54
51
|
const { beamDurationSeconds } = this.config, duration = beamDurationSeconds
|
|
55
52
|
? Math.min(beamDurationSeconds, 32767)
|
|
56
53
|
: undefined;
|
|
@@ -61,10 +58,9 @@ class Beam extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
61
58
|
return this.device.sendCommand('light-mode.set', data);
|
|
62
59
|
}
|
|
63
60
|
setLevelState(level) {
|
|
64
|
-
|
|
61
|
+
logInfo(`Setting brightness of ${this.device.name} to ${level}%`);
|
|
65
62
|
return this.device.setInfo({
|
|
66
63
|
device: { v1: { level: level / 100 } },
|
|
67
64
|
});
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
|
-
exports.Beam = Beam;
|
package/lib/brightness-only.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const hap_1 = require("./hap");
|
|
6
|
-
const util_1 = require("ring-client-api/util");
|
|
7
|
-
class BrightnessOnly extends base_device_accessory_1.BaseDeviceAccessory {
|
|
1
|
+
import { BaseDeviceAccessory } from "./base-device-accessory.js";
|
|
2
|
+
import { hap } from "./hap.js";
|
|
3
|
+
import { logInfo } from 'ring-client-api/util';
|
|
4
|
+
export class BrightnessOnly extends BaseDeviceAccessory {
|
|
8
5
|
device;
|
|
9
6
|
accessory;
|
|
10
7
|
config;
|
|
@@ -13,7 +10,7 @@ class BrightnessOnly extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
13
10
|
this.device = device;
|
|
14
11
|
this.accessory = accessory;
|
|
15
12
|
this.config = config;
|
|
16
|
-
const { Characteristic, Service } =
|
|
13
|
+
const { Characteristic, Service } = hap, { context } = accessory;
|
|
17
14
|
if (device.data.brightness !== undefined &&
|
|
18
15
|
!isNaN(device.data.brightness)) {
|
|
19
16
|
this.registerLevelCharacteristic({
|
|
@@ -47,10 +44,9 @@ class BrightnessOnly extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
46
|
setLevelState(brightness) {
|
|
50
|
-
|
|
47
|
+
logInfo(`Setting brightness of ${this.device.name} to ${brightness}%`);
|
|
51
48
|
return this.device.setInfo({
|
|
52
49
|
device: { v1: { brightness: brightness / 100 } },
|
|
53
50
|
});
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
|
-
exports.BrightnessOnly = BrightnessOnly;
|