eufy-security-client 3.6.0 → 3.7.1
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/.prettierignore/342/200/216 +8 -0
- package/.prettierrc +11 -0
- package/README.md +18 -0
- package/a.ts +61 -0
- package/build/error.js.map +1 -1
- package/build/eufysecurity.d.ts +1 -0
- package/build/eufysecurity.js +721 -224
- package/build/eufysecurity.js.map +1 -1
- package/build/http/api.d.ts +29 -0
- package/build/http/api.js +991 -701
- package/build/http/api.js.map +1 -1
- package/build/http/cache.js.map +1 -1
- package/build/http/const.d.ts +6 -1
- package/build/http/const.js +2044 -7536
- package/build/http/const.js.map +1 -1
- package/build/http/device.d.ts +4 -0
- package/build/http/device.js +1325 -440
- package/build/http/device.js.map +1 -1
- package/build/http/error.js.map +1 -1
- package/build/http/index.js.map +1 -1
- package/build/http/interfaces.d.ts +22 -15
- package/build/http/models.d.ts +2 -1
- package/build/http/parameter.js +74 -63
- package/build/http/parameter.js.map +1 -1
- package/build/http/station.d.ts +20 -2
- package/build/http/station.js +8639 -3566
- package/build/http/station.js.map +1 -1
- package/build/http/types.d.ts +12 -0
- package/build/http/types.js +297 -155
- package/build/http/types.js.map +1 -1
- package/build/http/utils.d.ts +16 -6
- package/build/http/utils.js +335 -208
- package/build/http/utils.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/interfaces.d.ts +4 -3
- package/build/logging.js +8 -13
- package/build/logging.js.map +1 -1
- package/build/mqtt/interface.d.ts +2 -2
- package/build/mqtt/service.js +12 -3
- package/build/mqtt/service.js.map +1 -1
- package/build/p2p/ble.js +7 -6
- package/build/p2p/ble.js.map +1 -1
- package/build/p2p/error.js.map +1 -1
- package/build/p2p/interfaces.d.ts +41 -6
- package/build/p2p/session.js +1484 -383
- package/build/p2p/session.js.map +1 -1
- package/build/p2p/talkback.js.map +1 -1
- package/build/p2p/types.js +36 -36
- package/build/p2p/types.js.map +1 -1
- package/build/p2p/utils.d.ts +10 -0
- package/build/p2p/utils.js +183 -90
- package/build/p2p/utils.js.map +1 -1
- package/build/push/client.js +15 -4
- package/build/push/client.js.map +1 -1
- package/build/push/error.js.map +1 -1
- package/build/push/interfaces.d.ts +8 -8
- package/build/push/models.js.map +1 -1
- package/build/push/parser.js +6 -2
- package/build/push/parser.js.map +1 -1
- package/build/push/service.js +214 -85
- package/build/push/service.js.map +1 -1
- package/build/push/types.js.map +1 -1
- package/build/push/utils.js.map +1 -1
- package/build/utils.js +7 -15
- package/build/utils.js.map +1 -1
- package/coverage/clover.xml +11133 -13648
- package/coverage/coverage-final.json +20 -30
- package/coverage/lcov-report/error.ts.html +3 -3
- package/coverage/lcov-report/index.html +50 -65
- package/coverage/lcov-report/logging.ts.html +598 -0
- package/coverage/lcov.info +21072 -25751
- package/dont-care.js +101 -0
- package/package.json +9 -5
- package/build/package.json +0 -81
package/build/http/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/http/error.ts"],"names":[],"mappings":";;;AAAA,oCAA+C;AAE/C,MAAa,oBAAqB,SAAQ,iBAAS;
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/http/error.ts"],"names":[],"mappings":";;;AAAA,oCAA+C;AAE/C,MAAa,oBAAqB,SAAQ,iBAAS;IACjD,YAAY,OAAe,EAAE,UAAiD,EAAE;QAC9E,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC;IACxC,CAAC;CACF;AAND,oDAMC;AAED,MAAa,6BAA8B,SAAQ,iBAAS;IAC1D,YAAY,OAAe,EAAE,UAAiD,EAAE;QAC9E,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,MAAM,CAAC,cAAc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MC;AAED,MAAa,kBAAmB,SAAQ,iBAAS;IAC/C,YAAY,OAAe,EAAE,UAAiD,EAAE;QAC9E,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC;IACtC,CAAC;CACF;AAND,gDAMC;AAED,MAAa,cAAe,SAAQ,iBAAS;IAC3C,YAAY,OAAe,EAAE,UAAiD,EAAE;QAC9E,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC;IAClC,CAAC;CACF;AAND,wCAMC"}
|
package/build/http/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B;AAC7B,2CAAyB;AACzB,8CAA4B;AAC5B,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B;AAC7B,2CAAyB;AACzB,8CAA4B;AAC5B,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,iCAAwE;AAA/D,iHAAA,wBAAwB,OAAA;AAAE,4GAAA,mBAAmB,OAAA"}
|
|
@@ -5,7 +5,7 @@ import type { Method } from "got" with {
|
|
|
5
5
|
import type { ImageFileExtension } from "image-type" with {
|
|
6
6
|
"resolution-mode": "import"
|
|
7
7
|
};
|
|
8
|
-
import { DatabaseCountByDate, DatabaseQueryLatestInfo, DatabaseQueryLocal, StreamMetadata } from "../p2p/interfaces";
|
|
8
|
+
import { DatabaseCountByDate, DatabaseQueryByDate, DatabaseQueryLatestInfo, DatabaseQueryLocal, StreamMetadata } from "../p2p/interfaces";
|
|
9
9
|
import { CommandResult, StorageInfoBodyHB3 } from "../p2p/models";
|
|
10
10
|
import { AlarmEvent, DatabaseReturnCode, SmartSafeAlarm911Event, SmartSafeShakeAlarmEvent, TFCardStatus } from "../p2p/types";
|
|
11
11
|
import { Camera, Device } from "./device";
|
|
@@ -147,19 +147,19 @@ export interface Picture {
|
|
|
147
147
|
type: ImageType;
|
|
148
148
|
}
|
|
149
149
|
export interface HTTPApiEvents {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
devices: (devices: FullDevices) => void;
|
|
151
|
+
hubs: (hubs: Hubs) => void;
|
|
152
|
+
houses: (houses: Houses) => void;
|
|
153
|
+
connect: () => void;
|
|
154
|
+
close: () => void;
|
|
155
155
|
"connection error": (error: Error) => void;
|
|
156
156
|
"tfa request": () => void;
|
|
157
157
|
"captcha request": (id: string, captcha: string) => void;
|
|
158
158
|
"auth token invalidated": () => void;
|
|
159
159
|
}
|
|
160
160
|
export interface StationEvents {
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
connect: (station: Station) => void;
|
|
162
|
+
close: (station: Station) => void;
|
|
163
163
|
"connection error": (station: Station, error: Error) => void;
|
|
164
164
|
"raw device property changed": (deviceSN: string, params: RawValues) => void;
|
|
165
165
|
"property changed": (station: Station, name: string, value: PropertyValue, ready: boolean) => void;
|
|
@@ -176,7 +176,7 @@ export interface StationEvents {
|
|
|
176
176
|
"guard mode": (station: Station, guardMode: number) => void;
|
|
177
177
|
"current mode": (station: Station, currentMode: number) => void;
|
|
178
178
|
"alarm event": (station: Station, alarmEvent: AlarmEvent) => void;
|
|
179
|
-
|
|
179
|
+
ready: (station: Station) => void;
|
|
180
180
|
"runtime state": (station: Station, channel: number, batteryLevel: number, temperature: number) => void;
|
|
181
181
|
"charging state": (station: Station, channel: number, chargeType: number, batteryLevel: number) => void;
|
|
182
182
|
"wifi rssi": (station: Station, channel: number, rssi: number) => void;
|
|
@@ -198,6 +198,7 @@ export interface StationEvents {
|
|
|
198
198
|
"image download": (station: Station, file: string, image: Buffer) => void;
|
|
199
199
|
"database query latest": (station: Station, returnCode: DatabaseReturnCode, data: Array<DatabaseQueryLatestInfo>) => void;
|
|
200
200
|
"database query local": (station: Station, returnCode: DatabaseReturnCode, data: Array<DatabaseQueryLocal>) => void;
|
|
201
|
+
"database query by date": (station: Station, returnCode: DatabaseReturnCode, data: Array<DatabaseQueryByDate>) => void;
|
|
201
202
|
"database count by date": (station: Station, returnCode: DatabaseReturnCode, data: Array<DatabaseCountByDate>) => void;
|
|
202
203
|
"database delete": (station: Station, returnCode: DatabaseReturnCode, failedIds: Array<unknown>) => void;
|
|
203
204
|
"sensor status": (station: Station, channel: number, status: number) => void;
|
|
@@ -217,10 +218,10 @@ export interface DeviceEvents {
|
|
|
217
218
|
"dog lick detected": (device: Device, state: boolean) => void;
|
|
218
219
|
"dog poop detected": (device: Device, state: boolean) => void;
|
|
219
220
|
"stranger person detected": (device: Device, state: boolean) => void;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
rings: (device: Device, state: boolean) => void;
|
|
222
|
+
locked: (device: Device, state: boolean) => void;
|
|
223
|
+
open: (device: Device, state: boolean) => void;
|
|
224
|
+
ready: (device: Device) => void;
|
|
224
225
|
"package delivered": (device: Device, state: boolean) => void;
|
|
225
226
|
"package stranded": (device: Device, state: boolean) => void;
|
|
226
227
|
"package taken": (device: Device, state: boolean) => void;
|
|
@@ -231,11 +232,17 @@ export interface DeviceEvents {
|
|
|
231
232
|
"wrong try-protect alarm": (device: Device, state: boolean) => void;
|
|
232
233
|
"long time not close": (device: Device, state: boolean) => void;
|
|
233
234
|
"low battery": (device: Device, state: boolean) => void;
|
|
234
|
-
|
|
235
|
-
|
|
235
|
+
jammed: (device: Device, state: boolean) => void;
|
|
236
|
+
tampering: (device: Device, state: boolean) => void;
|
|
236
237
|
"low temperature": (device: Device, state: boolean) => void;
|
|
237
238
|
"high temperature": (device: Device, state: boolean) => void;
|
|
238
239
|
"pin incorrect": (device: Device, state: boolean) => void;
|
|
239
240
|
"lid stuck": (device: Device, state: boolean) => void;
|
|
240
241
|
"battery fully charged": (device: Device, state: boolean) => void;
|
|
241
242
|
}
|
|
243
|
+
export interface BrandData {
|
|
244
|
+
first?: string[];
|
|
245
|
+
second?: string[];
|
|
246
|
+
numbers?: number;
|
|
247
|
+
letters?: string[];
|
|
248
|
+
}
|
package/build/http/models.d.ts
CHANGED
|
@@ -382,6 +382,7 @@ export interface Cipher {
|
|
|
382
382
|
cipher_id: number;
|
|
383
383
|
user_id: string;
|
|
384
384
|
private_key: string;
|
|
385
|
+
ecc_private_key?: string;
|
|
385
386
|
}
|
|
386
387
|
export interface Voice {
|
|
387
388
|
voice_id: number;
|
|
@@ -595,7 +596,7 @@ export interface FloodlightDetectionRangeT8425Property {
|
|
|
595
596
|
}
|
|
596
597
|
export interface FloodlightLightSettingsBrightnessScheduleT8425Property {
|
|
597
598
|
sunset2rise: number;
|
|
598
|
-
|
|
599
|
+
longitude: string;
|
|
599
600
|
latitude: string;
|
|
600
601
|
brightness: number;
|
|
601
602
|
schedule: Array<unknown>;
|
package/build/http/parameter.js
CHANGED
|
@@ -1,81 +1,87 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ParameterHelper = void 0;
|
|
4
|
-
const
|
|
4
|
+
const p2p_1 = require("../p2p");
|
|
5
5
|
const utils_1 = require("../p2p/utils");
|
|
6
6
|
const utils_2 = require("../utils");
|
|
7
|
-
const
|
|
7
|
+
const types_1 = require("./types");
|
|
8
8
|
const utils_3 = require("./utils");
|
|
9
9
|
const error_1 = require("../error");
|
|
10
10
|
class ParameterHelper {
|
|
11
11
|
static JSON_PARSE_BASE64_PARAMS = new Set([
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
12
|
+
types_1.ParamType.SNOOZE_MODE,
|
|
13
|
+
types_1.ParamType.CAMERA_MOTION_ZONES,
|
|
14
|
+
p2p_1.CommandType.CMD_SET_DOORSENSOR_ALWAYS_OPEN_DELAY,
|
|
15
|
+
p2p_1.CommandType.CMD_SET_DOORSENSOR_ALWAYS_OPEN,
|
|
16
|
+
p2p_1.CommandType.ARM_DELAY_HOME,
|
|
17
|
+
p2p_1.CommandType.ARM_DELAY_AWAY,
|
|
18
|
+
p2p_1.CommandType.ARM_DELAY_CUS1,
|
|
19
|
+
p2p_1.CommandType.ARM_DELAY_CUS2,
|
|
20
|
+
p2p_1.CommandType.ARM_DELAY_CUS3,
|
|
21
|
+
p2p_1.CommandType.ARM_DELAY_OFF,
|
|
22
|
+
p2p_1.CommandType.CELLULAR_INFO,
|
|
23
|
+
p2p_1.CommandType.CMD_WALL_LIGHT_SETTINGS_MANUAL_COLORED_LIGHTING,
|
|
24
|
+
p2p_1.CommandType.CMD_WALL_LIGHT_SETTINGS_SCHEDULE_COLORED_LIGHTING,
|
|
25
|
+
p2p_1.CommandType.CMD_WALL_LIGHT_SETTINGS_COLORED_LIGHTING_COLORS,
|
|
26
|
+
p2p_1.CommandType.CMD_WALL_LIGHT_SETTINGS_DYNAMIC_LIGHTING_THEMES,
|
|
27
|
+
p2p_1.CommandType.CMD_INDOOR_DET_SET_ACTIVE_ZONE,
|
|
28
|
+
p2p_1.CommandType.CMD_SET_PRIVACYPARAM,
|
|
29
|
+
p2p_1.CommandType.CMD_BAT_DOORBELL_VIDEO_QUALITY2,
|
|
30
|
+
p2p_1.CommandType.CMD_BAT_DOORBELL_RECORD_QUALITY2,
|
|
31
|
+
p2p_1.CommandType.CMD_SET_CROSS_TRACKING_CAMERA_LIST,
|
|
32
|
+
p2p_1.CommandType.CMD_SET_CROSS_TRACKING_GROUP_LIST,
|
|
33
|
+
p2p_1.CommandType.CMD_FLOODLIGHT_SET_DETECTION_RANGE_T8425,
|
|
34
|
+
p2p_1.CommandType.CMD_SET_LIGHT_CTRL_BRIGHT_PIR_T8425,
|
|
35
|
+
p2p_1.CommandType.CMD_SET_LIGHT_CTRL_BRIGHT_SCH_T8425,
|
|
36
36
|
]);
|
|
37
37
|
static JSON_PARSE_PLAIN_PARAMS = new Set([
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
p2p_1.CommandType.CMD_BAT_DOORBELL_SET_NOTIFICATION_MODE,
|
|
39
|
+
p2p_1.CommandType.CMD_DOORBELL_DUAL_RADAR_WD_DETECTION_SENSITIVITY,
|
|
40
|
+
p2p_1.CommandType.CMD_DOORBELL_DUAL_RADAR_WD_AUTO_RESPONSE,
|
|
41
|
+
p2p_1.CommandType.CMD_DOORBELL_DUAL_PACKAGE_STRAND_TIME,
|
|
42
|
+
p2p_1.CommandType.CMD_DOORBELL_DUAL_RING_AUTO_RESPONSE,
|
|
43
|
+
p2p_1.CommandType.CMD_DOORBELL_DUAL_PACKAGE_GUARD_TIME,
|
|
44
|
+
p2p_1.CommandType.CMD_DOORBELL_DUAL_RADAR_WD_DISTANCE,
|
|
45
|
+
p2p_1.CommandType.CMD_DOORBELL_DUAL_RADAR_WD_TIME,
|
|
46
|
+
p2p_1.CommandType.CMD_DOORBELL_DUAL_DELIVERY_GUARD_SWITCH,
|
|
47
|
+
p2p_1.CommandType.CMD_DOORBELL_DUAL_PACKAGE_GUARD_VOICE,
|
|
48
|
+
p2p_1.CommandType.CMD_CAMERA_GARAGE_DOOR_SENSORS,
|
|
49
|
+
p2p_1.CommandType.CMD_MOTION_SET_LEAVING_REACTIONS,
|
|
50
50
|
]);
|
|
51
51
|
static readValue(serialNumber, type, value, log) {
|
|
52
52
|
if (value) {
|
|
53
|
+
// TODO: investigate why the value can be a object
|
|
54
|
+
//
|
|
55
|
+
//if (typeof value !== "string") return value;
|
|
56
|
+
if (typeof value !== "string") {
|
|
57
|
+
log.debug("Watch out for this object! .", {
|
|
58
|
+
value: JSON.stringify(value, null, 2)
|
|
59
|
+
});
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
53
62
|
if (ParameterHelper.JSON_PARSE_BASE64_PARAMS.has(type)) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
else {
|
|
62
|
-
return value; //return object
|
|
63
|
+
const parsedValue = (0, utils_2.parseJSON)((0, utils_1.getNullTerminatedString)((0, utils_1.decodeBase64)(value), "utf-8"), log);
|
|
64
|
+
if (parsedValue === undefined) {
|
|
65
|
+
log.debug("Non-parsable parameter value received from eufy cloud. Will be ignored.", {
|
|
66
|
+
serialNumber: serialNumber,
|
|
67
|
+
type: type,
|
|
68
|
+
value: value,
|
|
69
|
+
});
|
|
63
70
|
}
|
|
71
|
+
return parsedValue;
|
|
64
72
|
}
|
|
65
73
|
else if (ParameterHelper.JSON_PARSE_PLAIN_PARAMS.has(type)) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
else {
|
|
74
|
-
return value; //return object
|
|
74
|
+
const parsedValue = (0, utils_2.parseJSON)(value, log);
|
|
75
|
+
if (parsedValue === undefined) {
|
|
76
|
+
log.debug("Non-parsable parameter value received from eufy cloud. Will be ignored.", {
|
|
77
|
+
serialNumber: serialNumber,
|
|
78
|
+
type: type,
|
|
79
|
+
value: value,
|
|
80
|
+
});
|
|
75
81
|
}
|
|
82
|
+
return parsedValue;
|
|
76
83
|
}
|
|
77
|
-
else if (type ===
|
|
78
|
-
type === types_1.TrackerCommandType.LOCATION_NEW_ADDRESS) {
|
|
84
|
+
else if (type === p2p_1.TrackerCommandType.COMMAND_NEW_LOCATION || type === p2p_1.TrackerCommandType.LOCATION_NEW_ADDRESS) {
|
|
79
85
|
try {
|
|
80
86
|
const decrypted = (0, utils_3.decryptTrackerData)(Buffer.from(value, "hex"), Buffer.from(serialNumber));
|
|
81
87
|
if (decrypted !== undefined) {
|
|
@@ -84,7 +90,12 @@ class ParameterHelper {
|
|
|
84
90
|
}
|
|
85
91
|
catch (err) {
|
|
86
92
|
const error = (0, error_1.ensureError)(err);
|
|
87
|
-
log.debug("Non-parsable parameter value received from eufy cloud. Will be ignored.", {
|
|
93
|
+
log.debug("Non-parsable parameter value received from eufy cloud. Will be ignored.", {
|
|
94
|
+
serialNumber: serialNumber,
|
|
95
|
+
type: type,
|
|
96
|
+
value: value,
|
|
97
|
+
error: (0, utils_2.getError)(error),
|
|
98
|
+
});
|
|
88
99
|
}
|
|
89
100
|
return "";
|
|
90
101
|
}
|
|
@@ -93,10 +104,10 @@ class ParameterHelper {
|
|
|
93
104
|
}
|
|
94
105
|
static writeValue(type, value) {
|
|
95
106
|
if (value) {
|
|
96
|
-
if (type ===
|
|
97
|
-
type ===
|
|
98
|
-
type ===
|
|
99
|
-
type ===
|
|
107
|
+
if (type === types_1.ParamType.SNOOZE_MODE ||
|
|
108
|
+
type === types_1.ParamType.CAMERA_MOTION_ZONES ||
|
|
109
|
+
type === p2p_1.CommandType.CMD_SET_DOORSENSOR_ALWAYS_OPEN_DELAY ||
|
|
110
|
+
type === p2p_1.CommandType.CMD_SET_DOORSENSOR_ALWAYS_OPEN) {
|
|
100
111
|
return Buffer.from(JSON.stringify(value)).toString("base64");
|
|
101
112
|
}
|
|
102
113
|
return value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameter.js","sourceRoot":"","sources":["../../src/http/parameter.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"parameter.js","sourceRoot":"","sources":["../../src/http/parameter.ts"],"names":[],"mappings":";;;AAEA,gCAAyD;AACzD,wCAAqE;AACrE,oCAA+C;AAC/C,mCAAoC;AACpC,mCAA6C;AAC7C,oCAAuC;AAEvC,MAAa,eAAe;IAClB,MAAM,CAAU,wBAAwB,GAAG,IAAI,GAAG,CAAS;QACjE,iBAAS,CAAC,WAAW;QACrB,iBAAS,CAAC,mBAAmB;QAC7B,iBAAW,CAAC,oCAAoC;QAChD,iBAAW,CAAC,8BAA8B;QAC1C,iBAAW,CAAC,cAAc;QAC1B,iBAAW,CAAC,cAAc;QAC1B,iBAAW,CAAC,cAAc;QAC1B,iBAAW,CAAC,cAAc;QAC1B,iBAAW,CAAC,cAAc;QAC1B,iBAAW,CAAC,aAAa;QACzB,iBAAW,CAAC,aAAa;QACzB,iBAAW,CAAC,+CAA+C;QAC3D,iBAAW,CAAC,iDAAiD;QAC7D,iBAAW,CAAC,+CAA+C;QAC3D,iBAAW,CAAC,+CAA+C;QAC3D,iBAAW,CAAC,8BAA8B;QAC1C,iBAAW,CAAC,oBAAoB;QAChC,iBAAW,CAAC,+BAA+B;QAC3C,iBAAW,CAAC,gCAAgC;QAC5C,iBAAW,CAAC,kCAAkC;QAC9C,iBAAW,CAAC,iCAAiC;QAC7C,iBAAW,CAAC,wCAAwC;QACpD,iBAAW,CAAC,mCAAmC;QAC/C,iBAAW,CAAC,mCAAmC;KAChD,CAAC,CAAC;IAEK,MAAM,CAAU,uBAAuB,GAAG,IAAI,GAAG,CAAS;Q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,WAAW;gBAC9B,IAAI,KAAK,iBAAS,CAAC,mBAAmB;gBACtC,IAAI,KAAK,iBAAW,CAAC,oCAAoC;gBACzD,IAAI,KAAK,iBAAW,CAAC,8BAA8B,EACnD,CAAC;gBACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC/D,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;;AA7GH,0CA8GC"}
|
package/build/http/station.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypedEmitter } from "tiny-typed-emitter";
|
|
2
2
|
import { HTTPApi } from "./api";
|
|
3
|
-
import { AlarmTone, NotificationSwitchMode, DeviceType, FloodlightMotionTriggeredDistance, GuardMode, NotificationType, PowerSource, PropertyName, TimeFormat, CommandName, VideoTypeStoreToNAS, HB3DetectionTypes, WalllightNotificationType, DailyLightingType, MotionActivationMode, LightingActiveMode, SourceType, T8170DetectionTypes, IndoorS350NotificationTypes, SoloCameraDetectionTypes, MotionDetectionRangeType, ViewModeType, FloodlightT8425NotificationTypes, PresetPositionType, IndoorS350DetectionTypes } from "./types";
|
|
3
|
+
import { AlarmTone, NotificationSwitchMode, DeviceType, FloodlightMotionTriggeredDistance, GuardMode, NotificationType, PowerSource, PropertyName, TimeFormat, CommandName, VideoTypeStoreToNAS, HB3DetectionTypes, WalllightNotificationType, DailyLightingType, MotionActivationMode, LightingActiveMode, SourceType, T8170DetectionTypes, IndoorS350NotificationTypes, SoloCameraDetectionTypes, MotionDetectionRangeType, ViewModeType, FloodlightT8425NotificationTypes, PresetPositionType, IndoorS350DetectionTypes, EufyCamC35DetectionTypes } from "./types";
|
|
4
4
|
import { SnoozeDetail, StationListResponse } from "./models";
|
|
5
5
|
import { IndexedProperty, PropertyMetadataAny, PropertyValue, PropertyValues, RawValues, StationEvents, Schedule } from "./interfaces";
|
|
6
6
|
import { CrossTrackingGroupEntry, DynamicLighting, MotionZone, RGBColor } from "../p2p/interfaces";
|
|
@@ -48,9 +48,25 @@ export declare class Station extends TypedEmitter<StationEvents> {
|
|
|
48
48
|
static getChannel(type: number): number;
|
|
49
49
|
static isStation(type: number): boolean;
|
|
50
50
|
isStation(): boolean;
|
|
51
|
+
static isStationHomeBase2OrOlder(type: number): boolean;
|
|
51
52
|
static isStationHomeBase3(type: number): boolean;
|
|
53
|
+
static isStationHomeBaseMini(type: number): boolean;
|
|
52
54
|
static isStationHomeBase3BySn(sn: string): boolean;
|
|
55
|
+
static isStationHomeBaseMiniBySn(sn: string): boolean;
|
|
56
|
+
isStationHomeBase2OrOlder(): boolean;
|
|
53
57
|
isStationHomeBase3(): boolean;
|
|
58
|
+
isStationHomeBaseMini(): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Checks if the station is a HomeBase 3 or HomeBase mini for determining if SoloDevices are connected to a supported HomeBase.
|
|
61
|
+
* @returns Returns true, if this is a HomeBase 3 or a HomeBase mini, otherwise false.
|
|
62
|
+
*/
|
|
63
|
+
isDeviceControlledByHomeBase(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Checks if the station is a HomeBase 3 or HomeBase mini for determining if SoloDevices are connected to a supported HomeBase The check will be done by the given serial number.
|
|
66
|
+
* @param sn The serial of the station to check.
|
|
67
|
+
* @returns Returns true, if this is a HomeBase 3 or a HomeBase mini, otherwise false.
|
|
68
|
+
*/
|
|
69
|
+
static isDeviceControlledByHomeBaseBySn(sn: string): boolean;
|
|
54
70
|
isIntegratedDevice(): boolean;
|
|
55
71
|
isP2PConnectableDevice(): boolean;
|
|
56
72
|
getDeviceType(): number;
|
|
@@ -111,7 +127,7 @@ export declare class Station extends TypedEmitter<StationEvents> {
|
|
|
111
127
|
switchLight(device: Device, value: boolean): void;
|
|
112
128
|
setMotionDetectionSensitivity(device: Device, value: number): void;
|
|
113
129
|
setMotionDetectionType(device: Device, value: number): void;
|
|
114
|
-
setMotionDetectionTypeHB3(device: Device, type: HB3DetectionTypes | T8170DetectionTypes | SoloCameraDetectionTypes | IndoorS350DetectionTypes, value: boolean): void;
|
|
130
|
+
setMotionDetectionTypeHB3(device: Device, type: HB3DetectionTypes | T8170DetectionTypes | SoloCameraDetectionTypes | IndoorS350DetectionTypes | EufyCamC35DetectionTypes, value: boolean): void;
|
|
115
131
|
setMotionZone(device: Device, value: MotionZone): void;
|
|
116
132
|
setMotionTracking(device: Device, value: boolean): void;
|
|
117
133
|
setPanAndTiltRotationSpeed(device: Device, value: number): void;
|
|
@@ -305,10 +321,12 @@ export declare class Station extends TypedEmitter<StationEvents> {
|
|
|
305
321
|
private onTFCardStatus;
|
|
306
322
|
databaseQueryLatestInfo(failureCallback?: () => void): void;
|
|
307
323
|
databaseQueryLocal(serialNumbers: Array<string>, startDate: Date, endDate: Date, eventType?: FilterEventType, detectionType?: FilterDetectType, storageType?: FilterStorageType): void;
|
|
324
|
+
databaseQueryByDate(serialNumbers: Array<string>, startDate: Date, endDate: Date, eventType?: FilterEventType, detectionType?: FilterDetectType, storageType?: FilterStorageType): void;
|
|
308
325
|
databaseDelete(ids: Array<number>): void;
|
|
309
326
|
databaseCountByDate(startDate: Date, endDate: Date): void;
|
|
310
327
|
private onDatabaseQueryLatest;
|
|
311
328
|
private onDatabaseQueryLocal;
|
|
329
|
+
private onDatabaseQueryByDate;
|
|
312
330
|
private onDatabaseCountByDate;
|
|
313
331
|
private onDatabaseDelete;
|
|
314
332
|
private onSensorStatus;
|