ring-client-api 10.0.0-beta.2 → 10.0.0-beta.5
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 +41 -0
- package/README.md +0 -3
- package/lib/api/api.d.ts +2 -4
- package/lib/api/api.js +64 -23
- package/lib/api/index.js +5 -1
- package/lib/api/live-call-ring-edge.d.ts +41 -0
- package/lib/api/live-call-ring-edge.js +294 -0
- package/lib/api/live-call.d.ts +2 -6
- package/lib/api/live-call.js +27 -127
- package/lib/api/peer-connection.d.ts +4 -0
- package/lib/api/peer-connection.js +21 -2
- package/lib/api/ring-camera.d.ts +20 -14
- package/lib/api/ring-camera.js +60 -34
- package/lib/api/ring-types.d.ts +89 -24
- package/lib/api/ring-types.js +18 -7
- package/lib/api/util.js +8 -1
- package/lib/test/api/ring-camera.spec.js +3 -1
- package/package.json +23 -22
package/lib/api/ring-types.d.ts
CHANGED
|
@@ -87,7 +87,6 @@ export declare enum RingCameraKind {
|
|
|
87
87
|
cocoa_doorbell = "cocoa_doorbell",
|
|
88
88
|
stickup_cam_mini = "stickup_cam_mini"
|
|
89
89
|
}
|
|
90
|
-
export declare function isBatteryCameraKind(kind: RingCameraKind): boolean;
|
|
91
90
|
export declare const RingCameraModel: {
|
|
92
91
|
readonly [P in RingCameraKind]: string;
|
|
93
92
|
};
|
|
@@ -427,6 +426,44 @@ export interface CameraData {
|
|
|
427
426
|
ends_at?: string;
|
|
428
427
|
seconds_remaining: number;
|
|
429
428
|
};
|
|
429
|
+
health: {
|
|
430
|
+
device_type: RingCameraKind;
|
|
431
|
+
last_update_time: number;
|
|
432
|
+
connected: boolean;
|
|
433
|
+
rss_connected: boolean;
|
|
434
|
+
vod_enabled: boolean;
|
|
435
|
+
sidewalk_connection: boolean;
|
|
436
|
+
floodlight_on: boolean;
|
|
437
|
+
siren_on?: boolean;
|
|
438
|
+
white_led_on: boolean;
|
|
439
|
+
night_mode_on: boolean;
|
|
440
|
+
hatch_open: boolean;
|
|
441
|
+
packet_loss: number;
|
|
442
|
+
packet_loss_category: 'good' | string;
|
|
443
|
+
rssi: number;
|
|
444
|
+
battery_voltage: number;
|
|
445
|
+
wifi_is_ring_network: boolean;
|
|
446
|
+
supported_rpc_commands: string[];
|
|
447
|
+
ota_status: 'successful' | string;
|
|
448
|
+
ext_power_state?: 0 | number;
|
|
449
|
+
pref_run_mode?: 'low_power' | string;
|
|
450
|
+
run_mode?: 'low_power' | 'full_power' | string;
|
|
451
|
+
network_connection_value: 'wifi' | string;
|
|
452
|
+
ac_power: number;
|
|
453
|
+
battery_present?: boolean;
|
|
454
|
+
external_connection: boolean;
|
|
455
|
+
battery_percentage?: number;
|
|
456
|
+
battery_percentage_category: 'very_good' | 'unknown' | string;
|
|
457
|
+
firmware_version: string;
|
|
458
|
+
rssi_category: 'good' | string;
|
|
459
|
+
battery_voltage_category: 'very_good' | string;
|
|
460
|
+
second_battery_voltage_category: 'unknown' | string;
|
|
461
|
+
second_battery_percentage_category: 'unknown' | string;
|
|
462
|
+
battery_save: boolean;
|
|
463
|
+
firmware_version_status: 'Up to Date';
|
|
464
|
+
tx_rate: number;
|
|
465
|
+
ptz_connected?: 'penguin';
|
|
466
|
+
};
|
|
430
467
|
}
|
|
431
468
|
export interface CvDetectionType {
|
|
432
469
|
enabled: boolean;
|
|
@@ -670,31 +707,59 @@ export interface RingDeviceHistoryEvent {
|
|
|
670
707
|
body: any;
|
|
671
708
|
}
|
|
672
709
|
export declare type DingState = 'ringing' | 'connected' | 'timed_out' | 'completed';
|
|
673
|
-
export
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
710
|
+
export declare enum NotificationDetectionType {
|
|
711
|
+
Human = "human",
|
|
712
|
+
Loitering = "loitering",
|
|
713
|
+
Motion = "motion",
|
|
714
|
+
OtherMotion = "other_motion",
|
|
715
|
+
NotAvailable = "null",
|
|
716
|
+
StreamBroken = "stream_broken"
|
|
717
|
+
}
|
|
718
|
+
export declare enum PushNotificationAction {
|
|
719
|
+
Ding = "com.ring.push.HANDLE_NEW_DING",
|
|
720
|
+
Motion = "com.ring.push.HANDLE_NEW_motion"
|
|
721
|
+
}
|
|
722
|
+
export interface PushNotification {
|
|
723
|
+
ding: {
|
|
724
|
+
streaming_protocol: 'ring_media_server';
|
|
725
|
+
location_id: string;
|
|
726
|
+
device_name: string;
|
|
727
|
+
doorbot_id: number;
|
|
728
|
+
e2ee_enabled: boolean;
|
|
729
|
+
streaming_data_hash: string;
|
|
730
|
+
device_kind: RingCameraKind;
|
|
731
|
+
detection_type: NotificationDetectionType;
|
|
732
|
+
human_detected?: boolean;
|
|
733
|
+
id: number;
|
|
734
|
+
pod_id: number;
|
|
735
|
+
request_id: string;
|
|
736
|
+
image_uuid: string;
|
|
737
|
+
properties: {
|
|
738
|
+
active_streaming_profile: 'rms';
|
|
739
|
+
is_sidewalk: boolean;
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
aps: {
|
|
743
|
+
alert: string;
|
|
744
|
+
sound: string;
|
|
745
|
+
};
|
|
746
|
+
subtype: 'motion' | 'ding' | 'human' | string;
|
|
747
|
+
action: PushNotificationAction | string;
|
|
748
|
+
}
|
|
749
|
+
export interface LiveCallResponse {
|
|
750
|
+
ding_id: string;
|
|
751
|
+
ding_kind: DingKind;
|
|
752
|
+
device_id: number;
|
|
680
753
|
device_kind: RingCameraKind;
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
sip_server_ip: string;
|
|
685
|
-
sip_server_port: number;
|
|
686
|
-
sip_server_tls: boolean;
|
|
687
|
-
sip_session_id: string;
|
|
688
|
-
sip_from: string;
|
|
689
|
-
sip_to: string;
|
|
690
|
-
audio_jitter_buffer_ms: number;
|
|
691
|
-
video_jitter_buffer_ms: number;
|
|
692
|
-
sip_endpoints: null;
|
|
693
|
-
expires_in: number;
|
|
754
|
+
device_description: string;
|
|
755
|
+
state: DingState;
|
|
756
|
+
protocol: 'ring_media_server' | unknown;
|
|
694
757
|
now: number;
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
758
|
+
video_jitter_buffer_ms: number;
|
|
759
|
+
audio_jitter_buffer_ms: number;
|
|
760
|
+
data: {
|
|
761
|
+
session_id: string;
|
|
762
|
+
};
|
|
698
763
|
}
|
|
699
764
|
export interface AuthTokenResponse {
|
|
700
765
|
access_token: string;
|
package/lib/api/ring-types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isWebSocketSupportedAsset = exports.disabledLocationModes = exports.DispatchSignalType = exports.DoorbellType = exports.ChimeModel = exports.deviceTypesWithVolume = exports.allAlarmStates = exports.RingCameraModel = exports.
|
|
3
|
+
exports.isWebSocketSupportedAsset = exports.disabledLocationModes = exports.DispatchSignalType = exports.PushNotificationAction = exports.NotificationDetectionType = exports.DoorbellType = exports.ChimeModel = exports.deviceTypesWithVolume = exports.allAlarmStates = exports.RingCameraModel = exports.RingCameraKind = exports.RingDeviceCategory = exports.RingDeviceType = void 0;
|
|
4
4
|
// eslint-disable-next-line no-shadow
|
|
5
5
|
var RingDeviceType;
|
|
6
6
|
(function (RingDeviceType) {
|
|
@@ -95,12 +95,6 @@ var RingCameraKind;
|
|
|
95
95
|
RingCameraKind["cocoa_doorbell"] = "cocoa_doorbell";
|
|
96
96
|
RingCameraKind["stickup_cam_mini"] = "stickup_cam_mini";
|
|
97
97
|
})(RingCameraKind = exports.RingCameraKind || (exports.RingCameraKind = {}));
|
|
98
|
-
// RegExp taken from ring.com app
|
|
99
|
-
const isWiredCameraRegExp = new RegExp(/(^(lpd|jbox|stickup_cam_elite|stickup_cam_mini|hp_cam|spotlightw|floodlight|doorbell_graham_cracker))/);
|
|
100
|
-
function isBatteryCameraKind(kind) {
|
|
101
|
-
return !kind.match(isWiredCameraRegExp);
|
|
102
|
-
}
|
|
103
|
-
exports.isBatteryCameraKind = isBatteryCameraKind;
|
|
104
98
|
exports.RingCameraModel = {
|
|
105
99
|
doorbot: 'Doorbell',
|
|
106
100
|
doorbell: 'Doorbell',
|
|
@@ -158,6 +152,23 @@ var DoorbellType;
|
|
|
158
152
|
DoorbellType[DoorbellType["None"] = 2] = "None";
|
|
159
153
|
})(DoorbellType = exports.DoorbellType || (exports.DoorbellType = {}));
|
|
160
154
|
// eslint-disable-next-line no-shadow
|
|
155
|
+
var NotificationDetectionType;
|
|
156
|
+
(function (NotificationDetectionType) {
|
|
157
|
+
// Note, this list may not be complete
|
|
158
|
+
NotificationDetectionType["Human"] = "human";
|
|
159
|
+
NotificationDetectionType["Loitering"] = "loitering";
|
|
160
|
+
NotificationDetectionType["Motion"] = "motion";
|
|
161
|
+
NotificationDetectionType["OtherMotion"] = "other_motion";
|
|
162
|
+
NotificationDetectionType["NotAvailable"] = "null";
|
|
163
|
+
NotificationDetectionType["StreamBroken"] = "stream_broken";
|
|
164
|
+
})(NotificationDetectionType = exports.NotificationDetectionType || (exports.NotificationDetectionType = {}));
|
|
165
|
+
// eslint-disable-next-line no-shadow
|
|
166
|
+
var PushNotificationAction;
|
|
167
|
+
(function (PushNotificationAction) {
|
|
168
|
+
PushNotificationAction["Ding"] = "com.ring.push.HANDLE_NEW_DING";
|
|
169
|
+
PushNotificationAction["Motion"] = "com.ring.push.HANDLE_NEW_motion";
|
|
170
|
+
})(PushNotificationAction = exports.PushNotificationAction || (exports.PushNotificationAction = {}));
|
|
171
|
+
// eslint-disable-next-line no-shadow
|
|
161
172
|
var DispatchSignalType;
|
|
162
173
|
(function (DispatchSignalType) {
|
|
163
174
|
DispatchSignalType["Burglar"] = "user-verified-burglar-xa";
|
package/lib/api/util.js
CHANGED
|
@@ -18,7 +18,8 @@ const colors_1 = require("colors");
|
|
|
18
18
|
const readline_1 = require("readline");
|
|
19
19
|
const uuid_1 = require("uuid");
|
|
20
20
|
const systeminformation_1 = require("systeminformation");
|
|
21
|
-
const
|
|
21
|
+
const logger_1 = __importDefault(require("@eneris/push-receiver/dist/utils/logger"));
|
|
22
|
+
const debugLogger = (0, debug_1.default)('ring'), uuidNamespace = 'e53ffdc0-e91d-4ce1-bec2-df939d94739d';
|
|
22
23
|
let logger = {
|
|
23
24
|
logInfo(message) {
|
|
24
25
|
debugLogger(message);
|
|
@@ -120,3 +121,9 @@ function randomString(length) {
|
|
|
120
121
|
return uuid.replace(/-/g, '').substring(0, length).toLowerCase();
|
|
121
122
|
}
|
|
122
123
|
exports.randomString = randomString;
|
|
124
|
+
// Override push receiver logging to avoid ECONNRESET errors leaking
|
|
125
|
+
function logPushReceiver(...args) {
|
|
126
|
+
logDebug('[Push Receiver]');
|
|
127
|
+
logDebug(args[0]);
|
|
128
|
+
}
|
|
129
|
+
logger_1.default.error = logPushReceiver;
|
|
@@ -4,7 +4,9 @@ const api_1 = require("../../api");
|
|
|
4
4
|
describe('Ring Camera', () => {
|
|
5
5
|
describe('battery level', () => {
|
|
6
6
|
it('should handle string battery life', () => {
|
|
7
|
-
expect((0, api_1.getBatteryLevel)({
|
|
7
|
+
expect((0, api_1.getBatteryLevel)({
|
|
8
|
+
battery_life: '49',
|
|
9
|
+
})).toEqual(49);
|
|
8
10
|
});
|
|
9
11
|
it('should handle null battery life', () => {
|
|
10
12
|
expect((0, api_1.getBatteryLevel)({ battery_life: null })).toEqual(null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ring-client-api",
|
|
3
|
-
"version": "10.0.0-beta.
|
|
3
|
+
"version": "10.0.0-beta.5",
|
|
4
4
|
"description": "Unofficial API for Ring doorbells, cameras, security alarm system and smart lighting",
|
|
5
5
|
"main": "lib/api/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -55,44 +55,45 @@
|
|
|
55
55
|
"author": "dgreif",
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"dependencies": {
|
|
58
|
+
"@eneris/push-receiver": "^3.0.1",
|
|
58
59
|
"@homebridge/camera-utils": "2.1.0",
|
|
59
60
|
"@homebridge/plugin-ui-utils": "0.0.19",
|
|
60
|
-
"@koush/werift": "0.14.5-
|
|
61
|
+
"@koush/werift": "0.14.5-beta9",
|
|
61
62
|
"@types/socket.io-client": "1.4.36",
|
|
62
63
|
"colors": "1.4.0",
|
|
63
|
-
"debug": "4.3.
|
|
64
|
+
"debug": "4.3.4",
|
|
64
65
|
"got": "11.8.3",
|
|
65
|
-
"rxjs": "7.5.
|
|
66
|
+
"rxjs": "7.5.5",
|
|
66
67
|
"socket.io-client": "2.4.0",
|
|
67
|
-
"systeminformation": "5.
|
|
68
|
+
"systeminformation": "5.11.9",
|
|
68
69
|
"uuid": "8.3.2",
|
|
69
|
-
"ws": "8.
|
|
70
|
+
"ws": "8.5.0"
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
72
73
|
"@types/debug": "4.1.7",
|
|
73
|
-
"@types/jest": "27.4.
|
|
74
|
-
"@types/node": "17.0.
|
|
74
|
+
"@types/jest": "27.4.1",
|
|
75
|
+
"@types/node": "17.0.23",
|
|
75
76
|
"@types/uuid": "8.3.4",
|
|
76
|
-
"@types/ws": "^8.
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
78
|
-
"@typescript-eslint/parser": "5.
|
|
79
|
-
"concurrently": "^7.
|
|
77
|
+
"@types/ws": "^8.5.3",
|
|
78
|
+
"@typescript-eslint/eslint-plugin": "5.18.0",
|
|
79
|
+
"@typescript-eslint/parser": "5.18.0",
|
|
80
|
+
"concurrently": "^7.1.0",
|
|
80
81
|
"conventional-github-releaser": "3.1.5",
|
|
81
|
-
"dotenv": "
|
|
82
|
-
"esbuild": "^0.14.
|
|
83
|
-
"eslint": "8.
|
|
84
|
-
"eslint-config-prettier": "8.
|
|
85
|
-
"eslint-plugin-jest": "
|
|
82
|
+
"dotenv": "16.0.0",
|
|
83
|
+
"esbuild": "^0.14.34",
|
|
84
|
+
"eslint": "8.13.0",
|
|
85
|
+
"eslint-config-prettier": "8.5.0",
|
|
86
|
+
"eslint-plugin-jest": "26.1.4",
|
|
86
87
|
"eslint-plugin-prettier": "4.0.0",
|
|
87
|
-
"express": "4.17.
|
|
88
|
+
"express": "4.17.3",
|
|
88
89
|
"homebridge": "1.4.0",
|
|
89
|
-
"jest": "27.
|
|
90
|
-
"prettier": "2.
|
|
90
|
+
"jest": "27.5.1",
|
|
91
|
+
"prettier": "2.6.2",
|
|
91
92
|
"reflect-metadata": "0.1.13",
|
|
92
93
|
"rimraf": "3.0.2",
|
|
93
94
|
"standard-version": "9.3.2",
|
|
94
|
-
"ts-jest": "27.1.
|
|
95
|
-
"typescript": "4.
|
|
95
|
+
"ts-jest": "27.1.4",
|
|
96
|
+
"typescript": "4.6.3"
|
|
96
97
|
},
|
|
97
98
|
"engines": {
|
|
98
99
|
"node": "^12.20 || ^14 || ^16",
|