homebridge-ring 11.1.0 → 11.2.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 +15 -0
- package/README.md +153 -144
- package/config.schema.json +6 -6
- package/lib/api/ring-types.d.ts +11 -1
- package/lib/api/ring-types.js +3 -0
- package/lib/api/util.d.ts +2 -2
- package/lib/api/util.js +2 -2
- package/lib/homebridge/base-accessory.d.ts +1 -2
- package/lib/homebridge/base-accessory.js +3 -2
- package/lib/homebridge/base-data-accessory.d.ts +1 -2
- package/lib/homebridge/base-data-accessory.js +5 -6
- package/lib/homebridge/base-device-accessory.d.ts +1 -2
- package/lib/homebridge/beam.d.ts +2 -3
- package/lib/homebridge/beam.js +6 -5
- package/lib/homebridge/{base-station.d.ts → brightness-only.d.ts} +4 -4
- package/lib/homebridge/brightness-only.js +52 -0
- package/lib/homebridge/camera.d.ts +2 -3
- package/lib/homebridge/camera.js +6 -6
- package/lib/homebridge/chime.d.ts +2 -3
- package/lib/homebridge/chime.js +1 -2
- package/lib/homebridge/co-alarm.d.ts +2 -3
- package/lib/homebridge/co-alarm.js +1 -2
- package/lib/homebridge/config.d.ts +1 -1
- package/lib/homebridge/contact-sensor.d.ts +2 -3
- package/lib/homebridge/contact-sensor.js +1 -2
- package/lib/homebridge/fan.d.ts +2 -3
- package/lib/homebridge/fan.js +4 -4
- package/lib/homebridge/flood-freeze-sensor.d.ts +2 -3
- package/lib/homebridge/flood-freeze-sensor.js +4 -4
- package/lib/homebridge/freeze-sensor.d.ts +2 -3
- package/lib/homebridge/freeze-sensor.js +3 -3
- package/lib/homebridge/location-mode-switch.d.ts +2 -3
- package/lib/homebridge/location-mode-switch.js +4 -5
- package/lib/homebridge/lock.d.ts +2 -3
- package/lib/homebridge/lock.js +1 -2
- package/lib/homebridge/motion-sensor.d.ts +2 -3
- package/lib/homebridge/motion-sensor.js +1 -2
- package/lib/homebridge/multi-level-switch.d.ts +2 -3
- package/lib/homebridge/multi-level-switch.js +4 -4
- package/lib/homebridge/outlet.d.ts +2 -3
- package/lib/homebridge/outlet.js +3 -3
- package/lib/homebridge/panic-buttons.d.ts +2 -3
- package/lib/homebridge/panic-buttons.js +6 -6
- package/lib/homebridge/ring-platform.js +24 -25
- package/lib/homebridge/security-panel.d.ts +4 -4
- package/lib/homebridge/security-panel.js +14 -11
- package/lib/homebridge/smoke-alarm.d.ts +2 -3
- package/lib/homebridge/smoke-alarm.js +1 -2
- package/lib/homebridge/smoke-co-listener.d.ts +2 -3
- package/lib/homebridge/smoke-co-listener.js +1 -2
- package/lib/homebridge/switch.d.ts +2 -3
- package/lib/homebridge/switch.js +3 -3
- package/lib/homebridge/temperature-sensor.d.ts +2 -3
- package/lib/homebridge/temperature-sensor.js +1 -2
- package/lib/homebridge/thermostat.d.ts +2 -3
- package/lib/homebridge/thermostat.js +11 -11
- package/lib/homebridge/unknown-zwave-switch.d.ts +2 -3
- package/lib/homebridge/unknown-zwave-switch.js +3 -3
- package/lib/homebridge/water-sensor.d.ts +2 -3
- package/lib/homebridge/water-sensor.js +3 -3
- package/package.json +1 -1
- package/lib/homebridge/base-station.js +0 -14
- package/lib/homebridge/keypad.d.ts +0 -11
- package/lib/homebridge/keypad.js +0 -14
|
@@ -4,6 +4,7 @@ exports.BaseAccessory = void 0;
|
|
|
4
4
|
const hap_1 = require("./hap");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const rxjs_1 = require("rxjs");
|
|
7
|
+
const util_1 = require("../api/util");
|
|
7
8
|
function isServiceInstance(serviceType) {
|
|
8
9
|
return typeof serviceType === 'object';
|
|
9
10
|
}
|
|
@@ -60,7 +61,7 @@ class BaseAccessory {
|
|
|
60
61
|
if (setValue) {
|
|
61
62
|
characteristic.on("set" /* CharacteristicEventTypes.SET */, (newValue, callback) => {
|
|
62
63
|
Promise.resolve(setValue(newValue)).catch((e) => {
|
|
63
|
-
|
|
64
|
+
(0, util_1.logError)(e);
|
|
64
65
|
});
|
|
65
66
|
callback();
|
|
66
67
|
});
|
|
@@ -74,7 +75,7 @@ class BaseAccessory {
|
|
|
74
75
|
this.accessory.services.forEach((service) => {
|
|
75
76
|
if (!this.servicesInUse.includes(service) &&
|
|
76
77
|
!safeServiceUUIDs.includes(service.UUID)) {
|
|
77
|
-
|
|
78
|
+
(0, util_1.logInfo)('Pruning unused service', service.UUID, service.displayName || service.name, 'from', this.device.name);
|
|
78
79
|
this.accessory.removeService(service);
|
|
79
80
|
}
|
|
80
81
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BaseAccessory, CharacteristicType, ServiceType } from './base-accessory';
|
|
2
2
|
import { RingCamera, RingChime, RingDevice } from '../api';
|
|
3
3
|
import { RingPlatformConfig } from './config';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
export declare abstract class BaseDataAccessory<T extends RingDevice | RingCamera | RingChime> extends BaseAccessory<T> {
|
|
6
6
|
abstract readonly device: T;
|
|
7
7
|
abstract readonly accessory: PlatformAccessory;
|
|
8
|
-
abstract readonly logger: Logging;
|
|
9
8
|
abstract readonly config: RingPlatformConfig;
|
|
10
9
|
registerCharacteristic({ characteristicType, serviceType, getValue, setValue, setValueDebounceTime, name, requestUpdate, serviceSubType, }: {
|
|
11
10
|
characteristicType: CharacteristicType;
|
|
@@ -4,6 +4,7 @@ exports.BaseDataAccessory = void 0;
|
|
|
4
4
|
const base_accessory_1 = require("./base-accessory");
|
|
5
5
|
const rxjs_1 = require("rxjs");
|
|
6
6
|
const operators_1 = require("rxjs/operators");
|
|
7
|
+
const util_1 = require("../api/util");
|
|
7
8
|
class BaseDataAccessory extends base_accessory_1.BaseAccessory {
|
|
8
9
|
registerCharacteristic({ characteristicType, serviceType, getValue, setValue, setValueDebounceTime = 0, name, requestUpdate, serviceSubType, }) {
|
|
9
10
|
const service = this.getService(serviceType, name, serviceSubType), characteristic = service.getCharacteristic(characteristicType), { device } = this;
|
|
@@ -30,9 +31,7 @@ class BaseDataAccessory extends base_accessory_1.BaseAccessory {
|
|
|
30
31
|
}
|
|
31
32
|
else if (setValue) {
|
|
32
33
|
characteristic.on("set" /* CharacteristicEventTypes.SET */, (newValue, callback) => {
|
|
33
|
-
Promise.resolve(setValue(newValue)).catch(
|
|
34
|
-
this.logger.error(e);
|
|
35
|
-
});
|
|
34
|
+
Promise.resolve(setValue(newValue)).catch(util_1.logError);
|
|
36
35
|
callback();
|
|
37
36
|
});
|
|
38
37
|
}
|
|
@@ -53,9 +52,9 @@ class BaseDataAccessory extends base_accessory_1.BaseAccessory {
|
|
|
53
52
|
}
|
|
54
53
|
return targetLevel === undefined ? newLevel : targetLevel;
|
|
55
54
|
},
|
|
56
|
-
setValue: (
|
|
57
|
-
targetLevel =
|
|
58
|
-
setValue(
|
|
55
|
+
setValue: (level) => {
|
|
56
|
+
targetLevel = level;
|
|
57
|
+
setValue(level);
|
|
59
58
|
},
|
|
60
59
|
setValueDebounceTime: 500,
|
|
61
60
|
requestUpdate,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { RingDevice } from '../api';
|
|
2
2
|
import { RingPlatformConfig } from './config';
|
|
3
3
|
import { BaseDataAccessory } from './base-data-accessory';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
import { ServiceType } from './base-accessory';
|
|
6
6
|
export declare abstract class BaseDeviceAccessory extends BaseDataAccessory<RingDevice> {
|
|
7
7
|
abstract readonly device: RingDevice;
|
|
8
8
|
abstract readonly accessory: PlatformAccessory;
|
|
9
|
-
abstract readonly logger: Logging;
|
|
10
9
|
abstract readonly config: RingPlatformConfig;
|
|
11
10
|
initBase(): void;
|
|
12
11
|
initSensorService(serviceType: ServiceType): void;
|
package/lib/homebridge/beam.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { RingDevice } from '../api';
|
|
2
2
|
import { RingPlatformConfig } from './config';
|
|
3
3
|
import { BaseDeviceAccessory } from './base-device-accessory';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
export declare class Beam extends BaseDeviceAccessory {
|
|
6
6
|
readonly device: RingDevice;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
9
|
isLightGroup: boolean;
|
|
11
10
|
groupId: string | undefined;
|
|
12
|
-
constructor(device: RingDevice, accessory: PlatformAccessory,
|
|
11
|
+
constructor(device: RingDevice, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
13
12
|
setOnState(on: boolean): void | Promise<any>;
|
|
14
13
|
setLevelState(level: number): Promise<void>;
|
|
15
14
|
}
|
package/lib/homebridge/beam.js
CHANGED
|
@@ -4,12 +4,12 @@ exports.Beam = void 0;
|
|
|
4
4
|
const api_1 = require("../api");
|
|
5
5
|
const hap_1 = require("./hap");
|
|
6
6
|
const base_device_accessory_1 = require("./base-device-accessory");
|
|
7
|
+
const util_1 = require("../api/util");
|
|
7
8
|
class Beam extends base_device_accessory_1.BaseDeviceAccessory {
|
|
8
|
-
constructor(device, accessory,
|
|
9
|
+
constructor(device, accessory, config) {
|
|
9
10
|
super();
|
|
10
11
|
this.device = device;
|
|
11
12
|
this.accessory = accessory;
|
|
12
|
-
this.logger = logger;
|
|
13
13
|
this.config = config;
|
|
14
14
|
this.isLightGroup = this.device.data.deviceType === api_1.RingDeviceType.BeamsLightGroupSwitch;
|
|
15
15
|
this.groupId = this.device.data.groupId;
|
|
@@ -33,7 +33,8 @@ class Beam extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
33
33
|
setValue: (value) => this.setLevelState(value),
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
if (device.data.motionStatus !== undefined
|
|
36
|
+
if (device.data.motionStatus !== undefined &&
|
|
37
|
+
device.data.motionSensorEnabled !== false) {
|
|
37
38
|
this.registerCharacteristic({
|
|
38
39
|
characteristicType: hap_1.hap.Characteristic.MotionDetected,
|
|
39
40
|
serviceType: MotionSensor,
|
|
@@ -43,7 +44,7 @@ class Beam extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
setOnState(on) {
|
|
46
|
-
|
|
47
|
+
(0, util_1.logInfo)(`Turning ${this.device.name} ${on ? 'On' : 'Off'}`);
|
|
47
48
|
const { beamDurationSeconds } = this.config, duration = beamDurationSeconds
|
|
48
49
|
? Math.min(beamDurationSeconds, 32767)
|
|
49
50
|
: undefined;
|
|
@@ -54,7 +55,7 @@ class Beam extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
54
55
|
return this.device.sendCommand('light-mode.set', data);
|
|
55
56
|
}
|
|
56
57
|
setLevelState(level) {
|
|
57
|
-
|
|
58
|
+
(0, util_1.logInfo)(`Setting brightness of ${this.device.name} to ${level}%`);
|
|
58
59
|
return this.device.setInfo({
|
|
59
60
|
device: { v1: { level: level / 100 } },
|
|
60
61
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { BaseDeviceAccessory } from './base-device-accessory';
|
|
2
2
|
import { RingDevice } from '../api';
|
|
3
3
|
import { RingPlatformConfig } from './config';
|
|
4
|
-
import {
|
|
5
|
-
export declare class
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
|
+
export declare class BrightnessOnly extends BaseDeviceAccessory {
|
|
6
6
|
readonly device: RingDevice;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
|
-
constructor(device: RingDevice, accessory: PlatformAccessory,
|
|
9
|
+
constructor(device: RingDevice, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
10
|
+
setLevelState(brightness: number): Promise<void>;
|
|
11
11
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrightnessOnly = void 0;
|
|
4
|
+
const base_device_accessory_1 = require("./base-device-accessory");
|
|
5
|
+
const hap_1 = require("./hap");
|
|
6
|
+
const util_1 = require("../api/util");
|
|
7
|
+
class BrightnessOnly extends base_device_accessory_1.BaseDeviceAccessory {
|
|
8
|
+
constructor(device, accessory, config) {
|
|
9
|
+
super();
|
|
10
|
+
this.device = device;
|
|
11
|
+
this.accessory = accessory;
|
|
12
|
+
this.config = config;
|
|
13
|
+
const { Characteristic, Service } = hap_1.hap, { context } = accessory;
|
|
14
|
+
if ('brightness' in device.data && !isNaN(device.data.brightness)) {
|
|
15
|
+
this.registerLevelCharacteristic({
|
|
16
|
+
characteristicType: Characteristic.Brightness,
|
|
17
|
+
serviceType: Service.Lightbulb,
|
|
18
|
+
getValue: (data) => {
|
|
19
|
+
if (!data.brightness || isNaN(data.brightness)) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
// store the brightness so that we can set it again if light is turned off then back on
|
|
23
|
+
context.brightness = data.brightness * 100;
|
|
24
|
+
return context.brightness;
|
|
25
|
+
},
|
|
26
|
+
setValue: (brightness) => {
|
|
27
|
+
if (brightness) {
|
|
28
|
+
context.brightness = brightness;
|
|
29
|
+
}
|
|
30
|
+
return this.setLevelState(brightness);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
this.registerCharacteristic({
|
|
34
|
+
characteristicType: Characteristic.On,
|
|
35
|
+
serviceType: Service.Lightbulb,
|
|
36
|
+
getValue: (data) => Boolean(data.brightness),
|
|
37
|
+
setValue: (on) => {
|
|
38
|
+
const brightness = context.brightness || 100;
|
|
39
|
+
return this.setLevelState(on ? brightness : 0);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
this.getService(Service.Lightbulb).setPrimaryService(true);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
setLevelState(brightness) {
|
|
46
|
+
(0, util_1.logInfo)(`Setting brightness of ${this.device.name} to ${brightness}%`);
|
|
47
|
+
return this.device.setInfo({
|
|
48
|
+
device: { v1: { brightness: brightness / 100 } },
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.BrightnessOnly = BrightnessOnly;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { RingPlatformConfig } from './config';
|
|
2
2
|
import { RingCamera } from '../api';
|
|
3
3
|
import { BaseDataAccessory } from './base-data-accessory';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
export declare class Camera extends BaseDataAccessory<RingCamera> {
|
|
6
6
|
readonly device: RingCamera;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
9
|
private inHomeDoorbellStatus;
|
|
11
10
|
private cameraSource;
|
|
12
|
-
constructor(device: RingCamera, accessory: PlatformAccessory,
|
|
11
|
+
constructor(device: RingCamera, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
13
12
|
private loadSnapshotForEvent;
|
|
14
13
|
}
|
package/lib/homebridge/camera.js
CHANGED
|
@@ -6,17 +6,17 @@ const base_data_accessory_1 = require("./base-data-accessory");
|
|
|
6
6
|
const operators_1 = require("rxjs/operators");
|
|
7
7
|
const camera_source_1 = require("./camera-source");
|
|
8
8
|
const target_value_timer_1 = require("./target-value-timer");
|
|
9
|
+
const util_1 = require("../api/util");
|
|
9
10
|
class Camera extends base_data_accessory_1.BaseDataAccessory {
|
|
10
|
-
constructor(device, accessory,
|
|
11
|
+
constructor(device, accessory, config) {
|
|
11
12
|
super();
|
|
12
13
|
this.device = device;
|
|
13
14
|
this.accessory = accessory;
|
|
14
|
-
this.logger = logger;
|
|
15
15
|
this.config = config;
|
|
16
16
|
this.cameraSource = new camera_source_1.CameraSource(this.device, this.config.unbridgeCameras);
|
|
17
17
|
if (!hap_1.hap.CameraController) {
|
|
18
18
|
const error = 'HAP CameraController not found. Please make sure you are on homebridge version 1.0.0 or newer';
|
|
19
|
-
|
|
19
|
+
(0, util_1.logError)(error);
|
|
20
20
|
throw new Error(error);
|
|
21
21
|
}
|
|
22
22
|
const { Characteristic, Service } = hap_1.hap, { ChargingState, StatusLowBattery } = Characteristic;
|
|
@@ -158,16 +158,16 @@ class Camera extends base_data_accessory_1.BaseDataAccessory {
|
|
|
158
158
|
const latestNotification = this.device.latestNotification, imageUuid = latestNotification?.ding.image_uuid;
|
|
159
159
|
if (this.device.operatingOnBattery && !imageUuid) {
|
|
160
160
|
// battery cameras cannot fetch a new snapshot while recording is in progress
|
|
161
|
-
|
|
161
|
+
(0, util_1.logInfo)(this.device.name + ' ' + eventDescription);
|
|
162
162
|
return characteristicValue;
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
(0, util_1.logInfo)(this.device.name +
|
|
165
165
|
` ${eventDescription}. Loading snapshot before sending event to HomeKit`);
|
|
166
166
|
try {
|
|
167
167
|
await this.cameraSource.loadSnapshot(imageUuid);
|
|
168
168
|
}
|
|
169
169
|
catch (e) {
|
|
170
|
-
|
|
170
|
+
(0, util_1.logInfo)(this.device.name +
|
|
171
171
|
' Failed to load snapshot. Sending event to HomeKit without new snapshot');
|
|
172
172
|
}
|
|
173
173
|
return characteristicValue;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { RingChime } from '../api';
|
|
2
2
|
import { RingPlatformConfig } from './config';
|
|
3
|
-
import {
|
|
3
|
+
import { PlatformAccessory } from 'homebridge';
|
|
4
4
|
import { BaseDataAccessory } from './base-data-accessory';
|
|
5
5
|
export declare class Chime extends BaseDataAccessory<RingChime> {
|
|
6
6
|
readonly device: RingChime;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
|
-
constructor(device: RingChime, accessory: PlatformAccessory,
|
|
9
|
+
constructor(device: RingChime, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
11
10
|
}
|
package/lib/homebridge/chime.js
CHANGED
|
@@ -6,11 +6,10 @@ const base_data_accessory_1 = require("./base-data-accessory");
|
|
|
6
6
|
const util_1 = require("../api/util");
|
|
7
7
|
const minutesFor24Hours = 24 * 60;
|
|
8
8
|
class Chime extends base_data_accessory_1.BaseDataAccessory {
|
|
9
|
-
constructor(device, accessory,
|
|
9
|
+
constructor(device, accessory, config) {
|
|
10
10
|
super();
|
|
11
11
|
this.device = device;
|
|
12
12
|
this.accessory = accessory;
|
|
13
|
-
this.logger = logger;
|
|
14
13
|
this.config = config;
|
|
15
14
|
const { Characteristic, Service } = hap_1.hap, snoozeService = this.getService(Service.Switch, device.name + ' Snooze', 'snooze'), playDingService = this.getService(Service.Switch, device.name + ' Play Ding', 'play-ding'), playMotionService = this.getService(Service.Switch, device.name + ' Play Motion', 'play-motion');
|
|
16
15
|
// Snooze Switch
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BaseDeviceAccessory } from './base-device-accessory';
|
|
2
2
|
import { RingDevice } from '../api';
|
|
3
3
|
import { RingPlatformConfig } from './config';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
export declare class CoAlarm extends BaseDeviceAccessory {
|
|
6
6
|
readonly device: RingDevice;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
|
-
constructor(device: RingDevice, accessory: PlatformAccessory,
|
|
9
|
+
constructor(device: RingDevice, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
11
10
|
}
|
|
@@ -4,11 +4,10 @@ exports.CoAlarm = void 0;
|
|
|
4
4
|
const base_device_accessory_1 = require("./base-device-accessory");
|
|
5
5
|
const hap_1 = require("./hap");
|
|
6
6
|
class CoAlarm extends base_device_accessory_1.BaseDeviceAccessory {
|
|
7
|
-
constructor(device, accessory,
|
|
7
|
+
constructor(device, accessory, config) {
|
|
8
8
|
super();
|
|
9
9
|
this.device = device;
|
|
10
10
|
this.accessory = accessory;
|
|
11
|
-
this.logger = logger;
|
|
12
11
|
this.config = config;
|
|
13
12
|
const { Characteristic: { CarbonMonoxideDetected }, Service: { CarbonMonoxideSensor }, } = hap_1.hap;
|
|
14
13
|
this.registerCharacteristic({
|
|
@@ -11,12 +11,12 @@ export interface RingPlatformConfig extends RingApiOptions {
|
|
|
11
11
|
hideCameraSirenSwitch?: boolean;
|
|
12
12
|
hideInHomeDoorbellSwitch?: boolean;
|
|
13
13
|
hideAlarmSirenSwitch?: boolean;
|
|
14
|
-
hideUnsupportedServices?: boolean;
|
|
15
14
|
hideDeviceIds?: string[];
|
|
16
15
|
nightModeBypassFor: AlarmMode;
|
|
17
16
|
onlyDeviceTypes?: string[];
|
|
18
17
|
showPanicButtons?: boolean;
|
|
19
18
|
unbridgeCameras?: boolean;
|
|
19
|
+
disableLogs?: boolean;
|
|
20
20
|
}
|
|
21
21
|
export declare function updateHomebridgeConfig(homebridge: API, update: (config: string) => string): boolean;
|
|
22
22
|
export declare function getSystemId(homebridge: API): string;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BaseDeviceAccessory } from './base-device-accessory';
|
|
2
2
|
import { RingDevice } from '../api';
|
|
3
3
|
import { RingPlatformConfig } from './config';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
export declare class ContactSensor extends BaseDeviceAccessory {
|
|
6
6
|
readonly device: RingDevice;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
|
-
constructor(device: RingDevice, accessory: PlatformAccessory,
|
|
9
|
+
constructor(device: RingDevice, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
11
10
|
}
|
|
@@ -4,11 +4,10 @@ exports.ContactSensor = void 0;
|
|
|
4
4
|
const base_device_accessory_1 = require("./base-device-accessory");
|
|
5
5
|
const hap_1 = require("./hap");
|
|
6
6
|
class ContactSensor extends base_device_accessory_1.BaseDeviceAccessory {
|
|
7
|
-
constructor(device, accessory,
|
|
7
|
+
constructor(device, accessory, config) {
|
|
8
8
|
super();
|
|
9
9
|
this.device = device;
|
|
10
10
|
this.accessory = accessory;
|
|
11
|
-
this.logger = logger;
|
|
12
11
|
this.config = config;
|
|
13
12
|
const { Characteristic: { ContactSensorState }, Service, } = hap_1.hap;
|
|
14
13
|
this.registerCharacteristic({
|
package/lib/homebridge/fan.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { BaseDeviceAccessory } from './base-device-accessory';
|
|
2
2
|
import { RingDevice } from '../api';
|
|
3
3
|
import { RingPlatformConfig } from './config';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
export declare class Fan extends BaseDeviceAccessory {
|
|
6
6
|
readonly device: RingDevice;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
|
-
constructor(device: RingDevice, accessory: PlatformAccessory,
|
|
9
|
+
constructor(device: RingDevice, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
11
10
|
setOnState(on: boolean): Promise<void>;
|
|
12
11
|
setLevelState(level: number): Promise<void>;
|
|
13
12
|
}
|
package/lib/homebridge/fan.js
CHANGED
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Fan = void 0;
|
|
4
4
|
const base_device_accessory_1 = require("./base-device-accessory");
|
|
5
5
|
const hap_1 = require("./hap");
|
|
6
|
+
const util_1 = require("../api/util");
|
|
6
7
|
class Fan extends base_device_accessory_1.BaseDeviceAccessory {
|
|
7
|
-
constructor(device, accessory,
|
|
8
|
+
constructor(device, accessory, config) {
|
|
8
9
|
super();
|
|
9
10
|
this.device = device;
|
|
10
11
|
this.accessory = accessory;
|
|
11
|
-
this.logger = logger;
|
|
12
12
|
this.config = config;
|
|
13
13
|
const { Characteristic, Service } = hap_1.hap, { data: initialData } = this.device;
|
|
14
14
|
this.registerCharacteristic({
|
|
@@ -29,11 +29,11 @@ class Fan extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
setOnState(on) {
|
|
32
|
-
|
|
32
|
+
(0, util_1.logInfo)(`Turning ${this.device.name} ${on ? 'On' : 'Off'}`);
|
|
33
33
|
return this.device.setInfo({ device: { v1: { on } } });
|
|
34
34
|
}
|
|
35
35
|
setLevelState(level) {
|
|
36
|
-
|
|
36
|
+
(0, util_1.logInfo)(`Setting speed of ${this.device.name} to ${level}%`);
|
|
37
37
|
return this.device.setInfo({
|
|
38
38
|
device: { v1: { level: level / 100 } },
|
|
39
39
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BaseDeviceAccessory } from './base-device-accessory';
|
|
2
2
|
import { RingDevice } from '../api';
|
|
3
3
|
import { RingPlatformConfig } from './config';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
export declare class FloodFreezeSensor extends BaseDeviceAccessory {
|
|
6
6
|
readonly device: RingDevice;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
|
-
constructor(device: RingDevice, accessory: PlatformAccessory,
|
|
9
|
+
constructor(device: RingDevice, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
11
10
|
}
|
|
@@ -4,12 +4,12 @@ exports.FloodFreezeSensor = void 0;
|
|
|
4
4
|
const base_device_accessory_1 = require("./base-device-accessory");
|
|
5
5
|
const hap_1 = require("./hap");
|
|
6
6
|
const operators_1 = require("rxjs/operators");
|
|
7
|
+
const util_1 = require("../api/util");
|
|
7
8
|
class FloodFreezeSensor extends base_device_accessory_1.BaseDeviceAccessory {
|
|
8
|
-
constructor(device, accessory,
|
|
9
|
+
constructor(device, accessory, config) {
|
|
9
10
|
super();
|
|
10
11
|
this.device = device;
|
|
11
12
|
this.accessory = accessory;
|
|
12
|
-
this.logger = logger;
|
|
13
13
|
this.config = config;
|
|
14
14
|
const { Characteristic: { LeakDetected, OccupancyDetected }, Service: { LeakSensor, OccupancySensor }, } = hap_1.hap, leakService = this.getService(LeakSensor, `${device.name} Flood Sensor`), freezeService = this.getService(OccupancySensor, `${device.name} Freeze Sensor`), onFloodDetected = device.onData.pipe((0, operators_1.map)((data) => {
|
|
15
15
|
return data.flood && data.flood.faulted
|
|
@@ -29,7 +29,7 @@ class FloodFreezeSensor extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
29
29
|
onFloodDetected
|
|
30
30
|
.pipe((0, operators_1.filter)((faulted) => Boolean(faulted)))
|
|
31
31
|
.subscribe(() => {
|
|
32
|
-
|
|
32
|
+
(0, util_1.logInfo)(device.name + ' Detected Flooding');
|
|
33
33
|
});
|
|
34
34
|
this.initSensorService(freezeService);
|
|
35
35
|
this.registerObservableCharacteristic({
|
|
@@ -40,7 +40,7 @@ class FloodFreezeSensor extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
40
40
|
onFreezeDetected
|
|
41
41
|
.pipe((0, operators_1.filter)((faulted) => Boolean(faulted)))
|
|
42
42
|
.subscribe(() => {
|
|
43
|
-
|
|
43
|
+
(0, util_1.logInfo)(device.name + ' Detected Freezing');
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BaseDeviceAccessory } from './base-device-accessory';
|
|
2
2
|
import { RingDevice } from '../api';
|
|
3
3
|
import { RingPlatformConfig } from './config';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
export declare class FreezeSensor extends BaseDeviceAccessory {
|
|
6
6
|
readonly device: RingDevice;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
|
-
constructor(device: RingDevice, accessory: PlatformAccessory,
|
|
9
|
+
constructor(device: RingDevice, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
11
10
|
}
|
|
@@ -4,12 +4,12 @@ exports.FreezeSensor = void 0;
|
|
|
4
4
|
const base_device_accessory_1 = require("./base-device-accessory");
|
|
5
5
|
const hap_1 = require("./hap");
|
|
6
6
|
const operators_1 = require("rxjs/operators");
|
|
7
|
+
const util_1 = require("../api/util");
|
|
7
8
|
class FreezeSensor extends base_device_accessory_1.BaseDeviceAccessory {
|
|
8
|
-
constructor(device, accessory,
|
|
9
|
+
constructor(device, accessory, config) {
|
|
9
10
|
super();
|
|
10
11
|
this.device = device;
|
|
11
12
|
this.accessory = accessory;
|
|
12
|
-
this.logger = logger;
|
|
13
13
|
this.config = config;
|
|
14
14
|
const { Characteristic: { OccupancyDetected }, Service: { OccupancySensor }, } = hap_1.hap, onFreezeDetected = device.onData.pipe((0, operators_1.map)((data) => {
|
|
15
15
|
return data.faulted
|
|
@@ -25,7 +25,7 @@ class FreezeSensor extends base_device_accessory_1.BaseDeviceAccessory {
|
|
|
25
25
|
onFreezeDetected
|
|
26
26
|
.pipe((0, operators_1.filter)((faulted) => Boolean(faulted)))
|
|
27
27
|
.subscribe(() => {
|
|
28
|
-
|
|
28
|
+
(0, util_1.logInfo)(device.name + ' Detected Freezing');
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Location } from '../api';
|
|
2
2
|
import { RingPlatformConfig } from './config';
|
|
3
3
|
import { BaseAccessory } from './base-accessory';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
export declare class LocationModeSwitch extends BaseAccessory<Location> {
|
|
6
6
|
private readonly location;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
9
|
private targetState;
|
|
11
10
|
device: Location;
|
|
12
|
-
constructor(location: Location, accessory: PlatformAccessory,
|
|
11
|
+
constructor(location: Location, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
13
12
|
}
|
|
@@ -20,11 +20,10 @@ function getStateFromMode(mode) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
class LocationModeSwitch extends base_accessory_1.BaseAccessory {
|
|
23
|
-
constructor(location, accessory,
|
|
23
|
+
constructor(location, accessory, config) {
|
|
24
24
|
super();
|
|
25
25
|
this.location = location;
|
|
26
26
|
this.accessory = accessory;
|
|
27
|
-
this.logger = logger;
|
|
28
27
|
this.config = config;
|
|
29
28
|
this.device = this.location; // for use in BaseAccessory
|
|
30
29
|
const { Characteristic, Service: { SecuritySystem, AccessoryInformation }, } = hap_1.hap, accessoryName = location.name + ' Mode', service = this.getService(SecuritySystem, accessoryName), currentState = service.getCharacteristic(Characteristic.SecuritySystemCurrentState), targetState = service.getCharacteristic(Characteristic.SecuritySystemTargetState), getCurrentMode = () => {
|
|
@@ -70,14 +69,14 @@ class LocationModeSwitch extends base_accessory_1.BaseAccessory {
|
|
|
70
69
|
}
|
|
71
70
|
this.targetState = state;
|
|
72
71
|
if (state === State.AWAY_ARM) {
|
|
73
|
-
|
|
72
|
+
(0, util_1.logInfo)(`Setting ${this.location.name} Mode to away`);
|
|
74
73
|
return this.location.setLocationMode('away');
|
|
75
74
|
}
|
|
76
75
|
else if (state === State.DISARM) {
|
|
77
|
-
|
|
76
|
+
(0, util_1.logInfo)(`Setting ${this.location.name} Mode to disarmed`);
|
|
78
77
|
return this.location.setLocationMode('disarmed');
|
|
79
78
|
}
|
|
80
|
-
|
|
79
|
+
(0, util_1.logInfo)(`Setting ${this.location.name} Mode to home`);
|
|
81
80
|
return this.location.setLocationMode('home');
|
|
82
81
|
});
|
|
83
82
|
targetState.setProps({
|
package/lib/homebridge/lock.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { BaseDeviceAccessory } from './base-device-accessory';
|
|
2
2
|
import { RingDevice, RingDeviceData } from '../api';
|
|
3
3
|
import { RingPlatformConfig } from './config';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
export declare class Lock extends BaseDeviceAccessory {
|
|
6
6
|
readonly device: RingDevice;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
9
|
private targetState;
|
|
11
|
-
constructor(device: RingDevice, accessory: PlatformAccessory,
|
|
10
|
+
constructor(device: RingDevice, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
12
11
|
setTargetState(state: any): void;
|
|
13
12
|
getTargetState(data: RingDeviceData): any;
|
|
14
13
|
}
|
package/lib/homebridge/lock.js
CHANGED
|
@@ -18,11 +18,10 @@ function getCurrentState({ locked }) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
class Lock extends base_device_accessory_1.BaseDeviceAccessory {
|
|
21
|
-
constructor(device, accessory,
|
|
21
|
+
constructor(device, accessory, config) {
|
|
22
22
|
super();
|
|
23
23
|
this.device = device;
|
|
24
24
|
this.accessory = accessory;
|
|
25
|
-
this.logger = logger;
|
|
26
25
|
this.config = config;
|
|
27
26
|
const { Characteristic, Service } = hap_1.hap;
|
|
28
27
|
this.device.onData
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BaseDeviceAccessory } from './base-device-accessory';
|
|
2
2
|
import { RingDevice } from '../api';
|
|
3
3
|
import { RingPlatformConfig } from './config';
|
|
4
|
-
import {
|
|
4
|
+
import { PlatformAccessory } from 'homebridge';
|
|
5
5
|
export declare class MotionSensor extends BaseDeviceAccessory {
|
|
6
6
|
readonly device: RingDevice;
|
|
7
7
|
readonly accessory: PlatformAccessory;
|
|
8
|
-
readonly logger: Logging;
|
|
9
8
|
readonly config: RingPlatformConfig;
|
|
10
|
-
constructor(device: RingDevice, accessory: PlatformAccessory,
|
|
9
|
+
constructor(device: RingDevice, accessory: PlatformAccessory, config: RingPlatformConfig);
|
|
11
10
|
}
|
|
@@ -4,11 +4,10 @@ exports.MotionSensor = void 0;
|
|
|
4
4
|
const base_device_accessory_1 = require("./base-device-accessory");
|
|
5
5
|
const hap_1 = require("./hap");
|
|
6
6
|
class MotionSensor extends base_device_accessory_1.BaseDeviceAccessory {
|
|
7
|
-
constructor(device, accessory,
|
|
7
|
+
constructor(device, accessory, config) {
|
|
8
8
|
super();
|
|
9
9
|
this.device = device;
|
|
10
10
|
this.accessory = accessory;
|
|
11
|
-
this.logger = logger;
|
|
12
11
|
this.config = config;
|
|
13
12
|
const { Service } = hap_1.hap;
|
|
14
13
|
this.registerCharacteristic({
|