ring-client-api 13.0.0-beta.2 → 13.0.0-beta.4
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/lib/api.js +9 -5
- package/lib/ring-camera.js +4 -1
- package/lib/ring-intercom.d.ts +2 -2
- package/lib/ring-intercom.js +5 -3
- package/lib/ring-types.d.ts +22 -5
- package/lib/ring-types.js +2 -1
- package/package.json +8 -8
package/lib/api.js
CHANGED
|
@@ -123,14 +123,15 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
async registerPushReceiver(cameras, intercoms) {
|
|
126
|
-
const credentials = this.restClient._internalOnly_pushNotificationCredentials
|
|
126
|
+
const credentials = this.restClient._internalOnly_pushNotificationCredentials?.config &&
|
|
127
|
+
this.restClient._internalOnly_pushNotificationCredentials, pushReceiver = new push_receiver_1.default({
|
|
127
128
|
firebase: {
|
|
128
129
|
apiKey: 'AIzaSyCv-hdFBmmdBBJadNy-TFwB-xN_H5m3Bk8',
|
|
129
130
|
projectId: 'ring-17770',
|
|
130
131
|
messagingSenderId: '876313859327', // for Ring android app. 703521446232 for ring-site
|
|
131
132
|
appId: '1:876313859327:android:e10ec6ddb3c81f39',
|
|
132
133
|
},
|
|
133
|
-
credentials
|
|
134
|
+
credentials,
|
|
134
135
|
debug: false,
|
|
135
136
|
}), devicesById = {}, sendToDevice = (id, notification) => {
|
|
136
137
|
devicesById[id]?.processPushNotification(notification);
|
|
@@ -213,7 +214,8 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
213
214
|
}
|
|
214
215
|
const eventCategory = notification.android_config.category;
|
|
215
216
|
if (eventCategory !== ring_types_1.PushNotificationAction.Ding &&
|
|
216
|
-
eventCategory !== ring_types_1.PushNotificationAction.Motion
|
|
217
|
+
eventCategory !== ring_types_1.PushNotificationAction.Motion &&
|
|
218
|
+
eventCategory !== ring_types_1.PushNotificationAction.IntercomDing) {
|
|
217
219
|
(0, util_1.logInfo)('Received push notification with unknown category: ' +
|
|
218
220
|
eventCategory);
|
|
219
221
|
(0, util_1.logInfo)(JSON.stringify(message));
|
|
@@ -223,8 +225,10 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
223
225
|
(0, util_1.logError)(e);
|
|
224
226
|
}
|
|
225
227
|
});
|
|
226
|
-
// If we already have credentials, use them immediately
|
|
227
|
-
if (credentials
|
|
228
|
+
// If we already have credentials and they haven't been changed during registration, use them immediately
|
|
229
|
+
if (credentials &&
|
|
230
|
+
credentials?.fcm?.token ===
|
|
231
|
+
this.restClient._internalOnly_pushNotificationCredentials?.fcm?.token) {
|
|
228
232
|
onPushNotificationToken.next(credentials.fcm.token);
|
|
229
233
|
}
|
|
230
234
|
}
|
package/lib/ring-camera.js
CHANGED
|
@@ -38,7 +38,10 @@ function getBatteryLevel(data) {
|
|
|
38
38
|
parseBatteryLife(data.battery_life_2),
|
|
39
39
|
].filter((level) => level !== null), { health } = data;
|
|
40
40
|
if (!levels.length ||
|
|
41
|
-
(health &&
|
|
41
|
+
(health &&
|
|
42
|
+
!health.battery_percentage &&
|
|
43
|
+
!health.battery_present &&
|
|
44
|
+
!health.second_battery_percentage)) {
|
|
42
45
|
return null;
|
|
43
46
|
}
|
|
44
47
|
return Math.min(...levels);
|
package/lib/ring-intercom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IntercomHandsetAudioData, PushNotificationDingV2 } from './ring-types';
|
|
1
|
+
import { IntercomHandsetAudioData, PushNotificationDingV2, PushNotificationIntercomUnlockV2 } from './ring-types';
|
|
2
2
|
import { RingRestClient } from './rest-client';
|
|
3
3
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
4
4
|
export declare class RingIntercom {
|
|
@@ -22,5 +22,5 @@ export declare class RingIntercom {
|
|
|
22
22
|
private doorbotUrl;
|
|
23
23
|
subscribeToDingEvents(): Promise<void & import("./rest-client").ExtendedResponse>;
|
|
24
24
|
unsubscribeFromDingEvents(): Promise<void & import("./rest-client").ExtendedResponse>;
|
|
25
|
-
processPushNotification(notification: PushNotificationDingV2): void;
|
|
25
|
+
processPushNotification(notification: PushNotificationDingV2 | PushNotificationIntercomUnlockV2): void;
|
|
26
26
|
}
|
package/lib/ring-intercom.js
CHANGED
|
@@ -76,11 +76,13 @@ class RingIntercom {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
processPushNotification(notification) {
|
|
79
|
-
if (
|
|
79
|
+
if ('android_config' in notification &&
|
|
80
|
+
notification.android_config.category ===
|
|
81
|
+
ring_types_1.PushNotificationAction.IntercomDing) {
|
|
80
82
|
this.onDing.next();
|
|
81
83
|
}
|
|
82
|
-
else if (notification.
|
|
83
|
-
ring_types_1.PushNotificationAction.IntercomUnlock) {
|
|
84
|
+
else if ('gcmData' in notification.data &&
|
|
85
|
+
notification.data.gcmData.action === ring_types_1.PushNotificationAction.IntercomUnlock) {
|
|
84
86
|
this.onUnlocked.next();
|
|
85
87
|
}
|
|
86
88
|
}
|
package/lib/ring-types.d.ts
CHANGED
|
@@ -469,6 +469,7 @@ export interface BaseCameraData {
|
|
|
469
469
|
rssi_category: 'good' | string;
|
|
470
470
|
battery_voltage_category: 'very_good' | string;
|
|
471
471
|
second_battery_voltage_category: 'unknown' | string;
|
|
472
|
+
second_battery_percentage?: number;
|
|
472
473
|
second_battery_percentage_category: 'unknown' | string;
|
|
473
474
|
battery_save: boolean;
|
|
474
475
|
firmware_version_status: 'Up to Date';
|
|
@@ -867,7 +868,8 @@ export declare enum NotificationDetectionType {
|
|
|
867
868
|
export declare enum PushNotificationAction {
|
|
868
869
|
Ding = "com.ring.pn.live-event.ding",
|
|
869
870
|
Motion = "com.ring.pn.live-event.motion",
|
|
870
|
-
|
|
871
|
+
IntercomDing = "com.ring.pn.live-event.intercom",
|
|
872
|
+
IntercomUnlock = "com.ring.push.INTERCOM_UNLOCK_FROM_APP",
|
|
871
873
|
AlarmModeNone = "com.ring.push.HANDLE_NEW_SECURITY_PANEL_MODE_NONE_NOTICE",
|
|
872
874
|
AlarmModeSome = "com.ring.push.HANDLE_NEW_SECURITY_PANEL_MODE_SOME_NOTICE",
|
|
873
875
|
AlarmSoundSiren = "com.ring.push.HANDLE_NEW_USER_SOUND_SIREN",
|
|
@@ -892,7 +894,7 @@ export interface PushNotificationDingV2 {
|
|
|
892
894
|
device: {
|
|
893
895
|
e2ee_enabled: boolean;
|
|
894
896
|
id: number;
|
|
895
|
-
kind: RingCameraKind;
|
|
897
|
+
kind: RingCameraKind | RingDeviceType.IntercomHandsetAudio;
|
|
896
898
|
name: string;
|
|
897
899
|
};
|
|
898
900
|
event: {
|
|
@@ -900,7 +902,7 @@ export interface PushNotificationDingV2 {
|
|
|
900
902
|
id: string;
|
|
901
903
|
created_at: string;
|
|
902
904
|
subtype: 'other_motion' | 'motion' | 'ding' | 'human' | string;
|
|
903
|
-
detection_type
|
|
905
|
+
detection_type?: NotificationDetectionType;
|
|
904
906
|
};
|
|
905
907
|
eventito: {
|
|
906
908
|
type: NotificationDetectionType;
|
|
@@ -923,7 +925,7 @@ export interface PushNotificationDingV2 {
|
|
|
923
925
|
snapshot_uuid: string;
|
|
924
926
|
};
|
|
925
927
|
}
|
|
926
|
-
|
|
928
|
+
interface PushNotificationAlarm {
|
|
927
929
|
aps: {
|
|
928
930
|
alert: string;
|
|
929
931
|
};
|
|
@@ -938,7 +940,22 @@ export interface PushNotificationAlarmV2 {
|
|
|
938
940
|
gcmData: PushNotificationAlarm;
|
|
939
941
|
};
|
|
940
942
|
}
|
|
941
|
-
|
|
943
|
+
interface PushNotificationIntercomUnlock {
|
|
944
|
+
aps: {
|
|
945
|
+
alert: string;
|
|
946
|
+
};
|
|
947
|
+
action: PushNotificationAction.IntercomUnlock;
|
|
948
|
+
alarm_meta: {
|
|
949
|
+
device_zid: number;
|
|
950
|
+
location_id: string;
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
export interface PushNotificationIntercomUnlockV2 {
|
|
954
|
+
data: {
|
|
955
|
+
gcmData: PushNotificationIntercomUnlock;
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
export type PushNotification = PushNotificationDingV2 | PushNotificationAlarmV2 | PushNotificationIntercomUnlockV2;
|
|
942
959
|
export interface SocketTicketResponse {
|
|
943
960
|
ticket: string;
|
|
944
961
|
responseTimestampe: number;
|
package/lib/ring-types.js
CHANGED
|
@@ -188,7 +188,8 @@ var PushNotificationAction;
|
|
|
188
188
|
(function (PushNotificationAction) {
|
|
189
189
|
PushNotificationAction["Ding"] = "com.ring.pn.live-event.ding";
|
|
190
190
|
PushNotificationAction["Motion"] = "com.ring.pn.live-event.motion";
|
|
191
|
-
PushNotificationAction["
|
|
191
|
+
PushNotificationAction["IntercomDing"] = "com.ring.pn.live-event.intercom";
|
|
192
|
+
PushNotificationAction["IntercomUnlock"] = "com.ring.push.INTERCOM_UNLOCK_FROM_APP";
|
|
192
193
|
PushNotificationAction["AlarmModeNone"] = "com.ring.push.HANDLE_NEW_SECURITY_PANEL_MODE_NONE_NOTICE";
|
|
193
194
|
PushNotificationAction["AlarmModeSome"] = "com.ring.push.HANDLE_NEW_SECURITY_PANEL_MODE_SOME_NOTICE";
|
|
194
195
|
PushNotificationAction["AlarmSoundSiren"] = "com.ring.push.HANDLE_NEW_USER_SOUND_SIREN";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ring-client-api",
|
|
3
|
-
"version": "13.0.0-beta.
|
|
3
|
+
"version": "13.0.0-beta.4",
|
|
4
4
|
"description": "Unofficial API for Ring doorbells, cameras, security alarm system and smart lighting",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test:watch": "jest --watch"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@eneris/push-receiver": "^4.1.
|
|
20
|
+
"@eneris/push-receiver": "^4.1.4",
|
|
21
21
|
"@homebridge/camera-utils": "^2.2.6",
|
|
22
22
|
"@types/socket.io-client": "1.4.36",
|
|
23
23
|
"colors": "1.4.0",
|
|
@@ -27,22 +27,22 @@
|
|
|
27
27
|
"socket.io-client": "^2.5.0",
|
|
28
28
|
"systeminformation": "^5.22.11",
|
|
29
29
|
"uuid": "^10.0.0",
|
|
30
|
-
"werift": "0.19.
|
|
31
|
-
"ws": "^8.
|
|
30
|
+
"werift": "0.19.4",
|
|
31
|
+
"ws": "^8.18.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/debug": "4.1.12",
|
|
35
35
|
"@types/jest": "29.5.12",
|
|
36
36
|
"@types/json-bigint": "^1.0.4",
|
|
37
|
-
"@types/node": "20.14.
|
|
37
|
+
"@types/node": "20.14.11",
|
|
38
38
|
"@types/uuid": "10.0.0",
|
|
39
|
-
"@types/ws": "^8.5.
|
|
39
|
+
"@types/ws": "^8.5.11",
|
|
40
40
|
"eslint-config-shared": "*",
|
|
41
41
|
"jest": "29.7.0",
|
|
42
42
|
"msw": "^1.3.3",
|
|
43
|
-
"ts-jest": "29.
|
|
43
|
+
"ts-jest": "29.2.3",
|
|
44
44
|
"tsconfig": "*",
|
|
45
|
-
"typescript": "5.5.
|
|
45
|
+
"typescript": "5.5.3"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": "^18 || ^20"
|