eufy-security-client 2.4.2 → 2.4.3

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.
Files changed (85) hide show
  1. package/README.md +6 -0
  2. package/build/error.d.ts +57 -57
  3. package/build/error.js +155 -155
  4. package/build/eufysecurity.d.ts +161 -161
  5. package/build/eufysecurity.js +2091 -2091
  6. package/build/http/api.d.ts +90 -90
  7. package/build/http/api.js +1407 -1407
  8. package/build/http/api.js.map +1 -1
  9. package/build/http/cache.d.ts +8 -8
  10. package/build/http/cache.js +33 -33
  11. package/build/http/const.d.ts +3 -3
  12. package/build/http/const.js +8545 -8545
  13. package/build/http/device.d.ts +360 -360
  14. package/build/http/device.js +2793 -2793
  15. package/build/http/device.js.map +1 -1
  16. package/build/http/error.d.ts +28 -28
  17. package/build/http/error.js +76 -76
  18. package/build/http/index.d.ts +10 -10
  19. package/build/http/index.js +29 -29
  20. package/build/http/interfaces.d.ts +202 -202
  21. package/build/http/interfaces.js +2 -2
  22. package/build/http/models.d.ts +561 -561
  23. package/build/http/models.js +2 -2
  24. package/build/http/parameter.d.ts +5 -5
  25. package/build/http/parameter.js +75 -75
  26. package/build/http/station.d.ts +292 -292
  27. package/build/http/station.js +6780 -6780
  28. package/build/http/station.js.map +1 -1
  29. package/build/http/types.d.ts +945 -945
  30. package/build/http/types.js +6070 -6070
  31. package/build/http/utils.d.ts +37 -37
  32. package/build/http/utils.js +370 -370
  33. package/build/index.d.ts +7 -7
  34. package/build/index.js +25 -25
  35. package/build/interfaces.d.ts +113 -113
  36. package/build/interfaces.js +2 -2
  37. package/build/mqtt/interface.d.ts +6 -6
  38. package/build/mqtt/interface.js +2 -2
  39. package/build/mqtt/model.d.ts +24 -24
  40. package/build/mqtt/model.js +2 -2
  41. package/build/mqtt/service.d.ts +30 -30
  42. package/build/mqtt/service.js +168 -168
  43. package/build/mqtt/service.js.map +1 -1
  44. package/build/p2p/ble.d.ts +47 -47
  45. package/build/p2p/ble.js +188 -188
  46. package/build/p2p/ble.js.map +1 -1
  47. package/build/p2p/error.d.ts +24 -24
  48. package/build/p2p/error.js +67 -67
  49. package/build/p2p/index.d.ts +8 -8
  50. package/build/p2p/index.js +27 -27
  51. package/build/p2p/interfaces.d.ts +162 -162
  52. package/build/p2p/interfaces.js +2 -2
  53. package/build/p2p/models.d.ts +146 -146
  54. package/build/p2p/models.js +2 -2
  55. package/build/p2p/session.d.ts +168 -168
  56. package/build/p2p/session.js +2087 -2087
  57. package/build/p2p/session.js.map +1 -1
  58. package/build/p2p/talkback.d.ts +10 -10
  59. package/build/p2p/talkback.js +22 -22
  60. package/build/p2p/types.d.ts +923 -923
  61. package/build/p2p/types.js +957 -957
  62. package/build/p2p/utils.d.ts +56 -56
  63. package/build/p2p/utils.js +653 -653
  64. package/build/push/client.d.ts +51 -51
  65. package/build/push/client.js +311 -311
  66. package/build/push/client.js.map +1 -1
  67. package/build/push/index.d.ts +5 -5
  68. package/build/push/index.js +24 -24
  69. package/build/push/interfaces.d.ts +19 -19
  70. package/build/push/interfaces.js +2 -2
  71. package/build/push/models.d.ts +292 -292
  72. package/build/push/models.js +30 -30
  73. package/build/push/parser.d.ts +28 -28
  74. package/build/push/parser.js +215 -215
  75. package/build/push/parser.js.map +1 -1
  76. package/build/push/service.d.ts +45 -45
  77. package/build/push/service.js +643 -643
  78. package/build/push/service.js.map +1 -1
  79. package/build/push/types.d.ts +176 -176
  80. package/build/push/types.js +192 -192
  81. package/build/push/utils.d.ts +7 -7
  82. package/build/push/utils.js +102 -102
  83. package/build/utils.d.ts +13 -13
  84. package/build/utils.js +191 -191
  85. package/package.json +9 -9
@@ -1,360 +1,360 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { TypedEmitter } from "tiny-typed-emitter";
4
- import { Logger } from "ts-log";
5
- import { HTTPApi } from "./api";
6
- import { CommandName, DeviceEvent } from "./types";
7
- import { DeviceListResponse } from "./models";
8
- import { DeviceEvents, PropertyValue, PropertyValues, PropertyMetadataAny, IndexedProperty, RawValues, Schedule, Voices } from "./interfaces";
9
- import { PushMessage } from "../push/models";
10
- import { DeviceSmartLockNotifyData } from "../mqtt/model";
11
- export declare class Device extends TypedEmitter<DeviceEvents> {
12
- protected api: HTTPApi;
13
- protected rawDevice: DeviceListResponse;
14
- protected log: Logger;
15
- protected eventTimeouts: Map<DeviceEvent, NodeJS.Timeout>;
16
- protected properties: PropertyValues;
17
- private rawProperties;
18
- private ready;
19
- protected constructor(api: HTTPApi, device: DeviceListResponse);
20
- protected initializeState(): void;
21
- getRawDevice(): DeviceListResponse;
22
- update(device: DeviceListResponse, cloudOnlyProperties?: boolean): void;
23
- updateProperty(name: string, value: PropertyValue): boolean;
24
- updateRawProperties(values: RawValues): void;
25
- protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
26
- updateRawProperty(type: number, value: string): boolean;
27
- protected convertRawPropertyValue(property: PropertyMetadataAny, value: string): PropertyValue;
28
- getPropertyMetadata(name: string): PropertyMetadataAny;
29
- getPropertyValue(name: string): PropertyValue;
30
- hasPropertyValue(name: string): boolean;
31
- getRawProperty(type: number): string;
32
- getRawProperties(): RawValues;
33
- getProperties(): PropertyValues;
34
- getPropertiesMetadata(): IndexedProperty;
35
- hasProperty(name: string): boolean;
36
- getCommands(): Array<CommandName>;
37
- hasCommand(name: CommandName): boolean;
38
- processPushNotification(_message: PushMessage, _eventDurationSeconds: number): void;
39
- setCustomPropertyValue(name: string, value: PropertyValue): void;
40
- destroy(): void;
41
- protected clearEventTimeout(eventType: DeviceEvent): void;
42
- static isCamera(type: number): boolean;
43
- static hasBattery(type: number): boolean;
44
- static isStation(type: number): boolean;
45
- static isSensor(type: number): boolean;
46
- static isKeyPad(type: number): boolean;
47
- static isDoorbell(type: number): boolean;
48
- static isWiredDoorbell(type: number): boolean;
49
- static isWiredDoorbellT8200X(type: number, serialnumber: string): boolean;
50
- static isWiredDoorbellDual(type: number): boolean;
51
- static isIndoorCamera(type: number): boolean;
52
- static isPanAndTiltCamera(type: number): boolean;
53
- static isFloodLight(type: number): boolean;
54
- static isFloodLightT8420X(type: number, serialnumber: string): boolean;
55
- static isLock(type: number): boolean;
56
- static isLockKeypad(type: number): boolean;
57
- static isLockBle(type: number): boolean;
58
- static isLockBleNoFinger(type: number): boolean;
59
- static isLockWifi(type: number): boolean;
60
- static isLockWifiNoFinger(type: number): boolean;
61
- static isLockWifiR10(type: number): boolean;
62
- static isLockWifiR20(type: number): boolean;
63
- static isLockWifiVideo(type: number): boolean;
64
- static isLockWifiR10Keypad(type: number): boolean;
65
- static isBatteryDoorbell1(type: number): boolean;
66
- static isBatteryDoorbell2(type: number): boolean;
67
- static isBatteryDoorbellDual(type: number): boolean;
68
- static isDoorbellDual(type: number): boolean;
69
- static isBatteryDoorbell(type: number): boolean;
70
- static isSoloCamera(type: number): boolean;
71
- static isSoloCameraPro(type: number): boolean;
72
- static isSoloCameraSpotlight1080(type: number): boolean;
73
- static isSoloCameraSpotlight2k(type: number): boolean;
74
- static isSoloCameraSpotlightSolar(type: number): boolean;
75
- static isSoloCameras(type: number): boolean;
76
- static isStarlight4GLTE(type: number): boolean;
77
- static isIndoorOutdoorCamera1080p(type: number): boolean;
78
- static isIndoorOutdoorCamera1080pNoLight(type: number): boolean;
79
- static isIndoorOutdoorCamera2k(type: number): boolean;
80
- static isIndoorCamMini(type: number): boolean;
81
- static isCamera2(type: number): boolean;
82
- static isCamera2C(type: number): boolean;
83
- static isCamera2Pro(type: number): boolean;
84
- static isCamera2CPro(type: number): boolean;
85
- static isCamera2Product(type: number): boolean;
86
- static isCamera3(type: number): boolean;
87
- static isCamera3C(type: number): boolean;
88
- static isCamera3Product(type: number): boolean;
89
- static isEntrySensor(type: number): boolean;
90
- static isMotionSensor(type: number): boolean;
91
- static isSmartDrop(type: number): boolean;
92
- static isSmartSafe(type: number): boolean;
93
- static isIntegratedDeviceBySn(sn: string): boolean;
94
- static isSoloCameraBySn(sn: string): boolean;
95
- isCamera(): boolean;
96
- isFloodLight(): boolean;
97
- isFloodLightT8420X(): boolean;
98
- isDoorbell(): boolean;
99
- isWiredDoorbell(): boolean;
100
- isWiredDoorbellT8200X(): boolean;
101
- isWiredDoorbellDual(): boolean;
102
- isLock(): boolean;
103
- isLockKeypad(): boolean;
104
- isLockBle(): boolean;
105
- isLockBleNoFinger(): boolean;
106
- isLockWifi(): boolean;
107
- isLockWifiNoFinger(): boolean;
108
- isLockWifiR10(): boolean;
109
- isLockWifiR20(): boolean;
110
- isLockWifiVideo(): boolean;
111
- isLockWifiR10Keypad(): boolean;
112
- isBatteryDoorbell1(): boolean;
113
- isBatteryDoorbell2(): boolean;
114
- isBatteryDoorbellDual(): boolean;
115
- isDoorbellDual(): boolean;
116
- isBatteryDoorbell(): boolean;
117
- isSoloCamera(): boolean;
118
- isSoloCameraPro(): boolean;
119
- isSoloCameraSpotlight1080(): boolean;
120
- isSoloCameraSpotlight2k(): boolean;
121
- isSoloCameraSpotlightSolar(): boolean;
122
- isStarlight4GLTE(): boolean;
123
- isIndoorOutdoorCamera1080p(): boolean;
124
- isIndoorOutdoorCamera1080pNoLight(): boolean;
125
- isIndoorOutdoorCamera2k(): boolean;
126
- isIndoorCamMini(): boolean;
127
- isSoloCameras(): boolean;
128
- isCamera2(): boolean;
129
- isCamera2C(): boolean;
130
- isCamera2Pro(): boolean;
131
- isCamera2CPro(): boolean;
132
- isCamera2Product(): boolean;
133
- isCamera3(): boolean;
134
- isCamera3C(): boolean;
135
- isCamera3Product(): boolean;
136
- isEntrySensor(): boolean;
137
- isKeyPad(): boolean;
138
- isMotionSensor(): boolean;
139
- isIndoorCamera(): boolean;
140
- isPanAndTiltCamera(): boolean;
141
- isSmartDrop(): boolean;
142
- isSmartSafe(): boolean;
143
- isIntegratedDevice(): boolean;
144
- hasBattery(): boolean;
145
- getDeviceKey(): string;
146
- getDeviceType(): number;
147
- getHardwareVersion(): string;
148
- getSoftwareVersion(): string;
149
- getModel(): string;
150
- getName(): string;
151
- getSerial(): string;
152
- getStationSerial(): string;
153
- setParameters(params: {
154
- paramType: number;
155
- paramValue: any;
156
- }[]): Promise<boolean>;
157
- getChannel(): number;
158
- getStateID(state: string, level?: number): string;
159
- getStateChannel(): string;
160
- getWifiRssi(): PropertyValue;
161
- getStoragePath(filename: string): string;
162
- isEnabled(): PropertyValue;
163
- }
164
- export declare class Camera extends Device {
165
- private _isStreaming;
166
- protected constructor(api: HTTPApi, device: DeviceListResponse);
167
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<Camera>;
168
- getStateChannel(): string;
169
- protected convertRawPropertyValue(property: PropertyMetadataAny, value: string): PropertyValue;
170
- getLastCameraImageURL(): PropertyValue;
171
- getMACAddress(): string;
172
- startDetection(): Promise<void>;
173
- startStream(): Promise<string>;
174
- stopDetection(): Promise<void>;
175
- stopStream(): Promise<void>;
176
- getState(): PropertyValue;
177
- isStreaming(): boolean;
178
- close(): Promise<void>;
179
- getLastChargingDays(): number;
180
- getLastChargingFalseEvents(): number;
181
- getLastChargingRecordedEvents(): number;
182
- getLastChargingTotalEvents(): number;
183
- getBatteryValue(): PropertyValue;
184
- getBatteryTemperature(): PropertyValue;
185
- isMotionDetectionEnabled(): PropertyValue;
186
- isLedEnabled(): PropertyValue;
187
- isAutoNightVisionEnabled(): PropertyValue;
188
- isRTSPStreamEnabled(): PropertyValue;
189
- isAntiTheftDetectionEnabled(): PropertyValue;
190
- getWatermark(): PropertyValue;
191
- isMotionDetected(): boolean;
192
- isPersonDetected(): boolean;
193
- getDetectedPerson(): string;
194
- protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
195
- processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
196
- }
197
- export declare class SoloCamera extends Camera {
198
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<SoloCamera>;
199
- isLedEnabled(): PropertyValue;
200
- isMotionDetectionEnabled(): PropertyValue;
201
- processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
202
- }
203
- export declare class IndoorCamera extends Camera {
204
- protected constructor(api: HTTPApi, device: DeviceListResponse);
205
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<IndoorCamera>;
206
- isLedEnabled(): PropertyValue;
207
- isMotionDetectionEnabled(): PropertyValue;
208
- isPetDetectionEnabled(): PropertyValue;
209
- isSoundDetectionEnabled(): PropertyValue;
210
- isPetDetected(): boolean;
211
- isSoundDetected(): boolean;
212
- isCryingDetected(): boolean;
213
- processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
214
- destroy(): void;
215
- }
216
- export declare class DoorbellCamera extends Camera {
217
- protected voices: Voices;
218
- protected constructor(api: HTTPApi, device: DeviceListResponse, voices: Voices);
219
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<DoorbellCamera>;
220
- private loadMetadataVoiceStates;
221
- getVoiceName(id: number): string;
222
- getVoices(): Voices;
223
- getPropertiesMetadata(): IndexedProperty;
224
- isRinging(): boolean;
225
- protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
226
- processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
227
- }
228
- export declare class WiredDoorbellCamera extends DoorbellCamera {
229
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<WiredDoorbellCamera>;
230
- isLedEnabled(): PropertyValue;
231
- isAutoNightVisionEnabled(): PropertyValue;
232
- isMotionDetectionEnabled(): PropertyValue;
233
- }
234
- export declare class BatteryDoorbellCamera extends DoorbellCamera {
235
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<BatteryDoorbellCamera>;
236
- isLedEnabled(): PropertyValue;
237
- }
238
- export declare class FloodlightCamera extends Camera {
239
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<FloodlightCamera>;
240
- isLedEnabled(): PropertyValue;
241
- isMotionDetectionEnabled(): PropertyValue;
242
- protected convertRawPropertyValue(property: PropertyMetadataAny, value: string): PropertyValue;
243
- processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
244
- }
245
- export declare class Sensor extends Device {
246
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<Sensor>;
247
- getStateChannel(): string;
248
- getState(): PropertyValue;
249
- }
250
- export declare class EntrySensor extends Sensor {
251
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<EntrySensor>;
252
- isSensorOpen(): PropertyValue;
253
- getSensorChangeTime(): PropertyValue;
254
- isBatteryLow(): PropertyValue;
255
- processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
256
- protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
257
- }
258
- export declare class MotionSensor extends Sensor {
259
- static readonly MOTION_COOLDOWN_MS = 120000;
260
- protected constructor(api: HTTPApi, device: DeviceListResponse);
261
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<MotionSensor>;
262
- isMotionDetected(): boolean;
263
- getMotionSensorPIREvent(): PropertyValue;
264
- isBatteryLow(): PropertyValue;
265
- protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
266
- processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
267
- }
268
- export declare class Lock extends Device {
269
- static readonly VERSION_CODE_LOCKV12 = 18;
270
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<Lock>;
271
- getStateChannel(): string;
272
- protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
273
- getState(): PropertyValue;
274
- getBatteryValue(): PropertyValue;
275
- getWifiRssi(): PropertyValue;
276
- isLocked(): PropertyValue;
277
- getLockStatus(): PropertyValue;
278
- static encodeESLCmdOnOff(short_user_id: number, nickname: string, lock: boolean): Buffer;
279
- static encodeESLCmdQueryStatus(admin_user_id: string): Buffer;
280
- processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
281
- processMQTTNotification(message: DeviceSmartLockNotifyData, eventDurationSeconds: number): void;
282
- private processNotification;
283
- private static getCurrentTimeInSeconds;
284
- private static getUInt8Buffer;
285
- private static getUint16LEBuffer;
286
- private static getUint16BEBuffer;
287
- static encodeCmdStatus(user_id: string): Buffer;
288
- static encodeCmdUnlock(short_user_id: string, value: number, username: string): Buffer;
289
- static encodeCmdCalibrate(user_id: string): Buffer;
290
- static encodeCmdAddUser(short_user_id: string, passcode: string, username: string, schedule?: Schedule, user_permission?: number): Buffer;
291
- static encodeCmdAddTemporaryUser(schedule?: Schedule, unlimited?: boolean): Buffer;
292
- static encodeCmdDeleteTemporaryUser(password_id: string): Buffer;
293
- static encodeCmdDeleteUser(short_user_id: string): Buffer;
294
- static encodeCmdVerifyPw(password: string): Buffer;
295
- static encodeCmdQueryLockRecord(index: number): Buffer;
296
- static encodeCmdQueryUser(short_user_id: string): Buffer;
297
- static encodeCmdQueryPassword(password_id: string): Buffer;
298
- static encodeCmdModifyPassword(password_id: string, passcode: string): Buffer;
299
- static encodeCmdUpdateSchedule(short_user_id: string, schedule: Schedule): Buffer;
300
- static encodeCmdModifyUsername(username: string, password_id: string): Buffer;
301
- static encodeCmdGetLockParam(user_id: string): Buffer;
302
- static encodeCmdSetLockParamAutoLock(enabled: boolean, lockTimeSeconds: number): Buffer;
303
- private static hexTime;
304
- static encodeCmdSetLockParamAutoLockSchedule(enabled: boolean, schedule_start: string, schedule_end: string): Buffer;
305
- static encodeCmdSetLockParamOneTouchLock(enabled: boolean): Buffer;
306
- static encodeCmdSetLockParamWrongTryProtect(enabled: boolean, lockdownTime: number, attempts: number): Buffer;
307
- static encodeCmdSetLockParamScramblePasscode(enabled: boolean): Buffer;
308
- static encodeCmdSetLockParamSound(value: number): Buffer;
309
- }
310
- export declare class Keypad extends Device {
311
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<Keypad>;
312
- getStateChannel(): string;
313
- getState(): PropertyValue;
314
- isBatteryLow(): PropertyValue;
315
- isBatteryCharging(): PropertyValue;
316
- protected convertRawPropertyValue(property: PropertyMetadataAny, value: string): PropertyValue;
317
- }
318
- export declare class SmartSafe extends Device {
319
- static readonly IV = "052E19EB3F880512E99EBB684D4DC1FE";
320
- static readonly DATA_HEADER: number[];
321
- static readonly VERSION_CODE = 1;
322
- static readonly PUSH_NOTIFICATION_POSITION: {
323
- [index: string]: number;
324
- };
325
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<SmartSafe>;
326
- getStateChannel(): string;
327
- private static getCurrentTimeInSeconds;
328
- private static getUInt8Buffer;
329
- private static getUint16LEBuffer;
330
- private static encodeCmdSingleUInt8;
331
- static encodeCmdWrongTryProtect(user_id: string, enabled: boolean, attempts: number, lockdownTime: number): Buffer;
332
- static encodeCmdLeftOpenAlarm(user_id: string, enabled: boolean, duration: number): Buffer;
333
- static encodeCmdDualUnlock(user_id: string, enabled: boolean): Buffer;
334
- static encodeCmdScramblePIN(user_id: string, enabled: boolean): Buffer;
335
- static encodeCmdPowerSave(user_id: string, enabled: boolean): Buffer;
336
- static encodeCmdInteriorBrightness(user_id: string, interiorBrightness: number, duration: number): Buffer;
337
- static encodeCmdTamperAlarm(user_id: string, option: number): Buffer;
338
- static encodeCmdRemoteUnlock(user_id: string, option: number): Buffer;
339
- static encodeCmdAlertVolume(user_id: string, volume: number): Buffer;
340
- static encodeCmdPromptVolume(user_id: string, volume: number): Buffer;
341
- static encodeCmdPushNotification(user_id: string, modes: number): Buffer;
342
- static encodeCmdUnlock(user_id: string): Buffer;
343
- static encodeCmdVerifyPIN(user_id: string, pin: string): Buffer;
344
- protected convertRawPropertyValue(property: PropertyMetadataAny, value: string): PropertyValue;
345
- shakeEvent(event: number, eventDurationSeconds: number): void;
346
- alarm911Event(event: number, eventDurationSeconds: number): void;
347
- jammedEvent(eventDurationSeconds: number): void;
348
- lowBatteryEvent(eventDurationSeconds: number): void;
349
- wrongTryProtectAlarmEvent(eventDurationSeconds: number): void;
350
- processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
351
- protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
352
- getState(): PropertyValue;
353
- getBatteryValue(): PropertyValue;
354
- getWifiRssi(): PropertyValue;
355
- isLocked(): boolean;
356
- }
357
- export declare class UnknownDevice extends Device {
358
- static initialize(api: HTTPApi, device: DeviceListResponse): Promise<UnknownDevice>;
359
- getStateChannel(): string;
360
- }
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { TypedEmitter } from "tiny-typed-emitter";
4
+ import { Logger } from "ts-log";
5
+ import { HTTPApi } from "./api";
6
+ import { CommandName, DeviceEvent } from "./types";
7
+ import { DeviceListResponse } from "./models";
8
+ import { DeviceEvents, PropertyValue, PropertyValues, PropertyMetadataAny, IndexedProperty, RawValues, Schedule, Voices } from "./interfaces";
9
+ import { PushMessage } from "../push/models";
10
+ import { DeviceSmartLockNotifyData } from "../mqtt/model";
11
+ export declare class Device extends TypedEmitter<DeviceEvents> {
12
+ protected api: HTTPApi;
13
+ protected rawDevice: DeviceListResponse;
14
+ protected log: Logger;
15
+ protected eventTimeouts: Map<DeviceEvent, NodeJS.Timeout>;
16
+ protected properties: PropertyValues;
17
+ private rawProperties;
18
+ private ready;
19
+ protected constructor(api: HTTPApi, device: DeviceListResponse);
20
+ protected initializeState(): void;
21
+ getRawDevice(): DeviceListResponse;
22
+ update(device: DeviceListResponse, cloudOnlyProperties?: boolean): void;
23
+ updateProperty(name: string, value: PropertyValue): boolean;
24
+ updateRawProperties(values: RawValues): void;
25
+ protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
26
+ updateRawProperty(type: number, value: string): boolean;
27
+ protected convertRawPropertyValue(property: PropertyMetadataAny, value: string): PropertyValue;
28
+ getPropertyMetadata(name: string): PropertyMetadataAny;
29
+ getPropertyValue(name: string): PropertyValue;
30
+ hasPropertyValue(name: string): boolean;
31
+ getRawProperty(type: number): string;
32
+ getRawProperties(): RawValues;
33
+ getProperties(): PropertyValues;
34
+ getPropertiesMetadata(): IndexedProperty;
35
+ hasProperty(name: string): boolean;
36
+ getCommands(): Array<CommandName>;
37
+ hasCommand(name: CommandName): boolean;
38
+ processPushNotification(_message: PushMessage, _eventDurationSeconds: number): void;
39
+ setCustomPropertyValue(name: string, value: PropertyValue): void;
40
+ destroy(): void;
41
+ protected clearEventTimeout(eventType: DeviceEvent): void;
42
+ static isCamera(type: number): boolean;
43
+ static hasBattery(type: number): boolean;
44
+ static isStation(type: number): boolean;
45
+ static isSensor(type: number): boolean;
46
+ static isKeyPad(type: number): boolean;
47
+ static isDoorbell(type: number): boolean;
48
+ static isWiredDoorbell(type: number): boolean;
49
+ static isWiredDoorbellT8200X(type: number, serialnumber: string): boolean;
50
+ static isWiredDoorbellDual(type: number): boolean;
51
+ static isIndoorCamera(type: number): boolean;
52
+ static isPanAndTiltCamera(type: number): boolean;
53
+ static isFloodLight(type: number): boolean;
54
+ static isFloodLightT8420X(type: number, serialnumber: string): boolean;
55
+ static isLock(type: number): boolean;
56
+ static isLockKeypad(type: number): boolean;
57
+ static isLockBle(type: number): boolean;
58
+ static isLockBleNoFinger(type: number): boolean;
59
+ static isLockWifi(type: number): boolean;
60
+ static isLockWifiNoFinger(type: number): boolean;
61
+ static isLockWifiR10(type: number): boolean;
62
+ static isLockWifiR20(type: number): boolean;
63
+ static isLockWifiVideo(type: number): boolean;
64
+ static isLockWifiR10Keypad(type: number): boolean;
65
+ static isBatteryDoorbell1(type: number): boolean;
66
+ static isBatteryDoorbell2(type: number): boolean;
67
+ static isBatteryDoorbellDual(type: number): boolean;
68
+ static isDoorbellDual(type: number): boolean;
69
+ static isBatteryDoorbell(type: number): boolean;
70
+ static isSoloCamera(type: number): boolean;
71
+ static isSoloCameraPro(type: number): boolean;
72
+ static isSoloCameraSpotlight1080(type: number): boolean;
73
+ static isSoloCameraSpotlight2k(type: number): boolean;
74
+ static isSoloCameraSpotlightSolar(type: number): boolean;
75
+ static isSoloCameras(type: number): boolean;
76
+ static isStarlight4GLTE(type: number): boolean;
77
+ static isIndoorOutdoorCamera1080p(type: number): boolean;
78
+ static isIndoorOutdoorCamera1080pNoLight(type: number): boolean;
79
+ static isIndoorOutdoorCamera2k(type: number): boolean;
80
+ static isIndoorCamMini(type: number): boolean;
81
+ static isCamera2(type: number): boolean;
82
+ static isCamera2C(type: number): boolean;
83
+ static isCamera2Pro(type: number): boolean;
84
+ static isCamera2CPro(type: number): boolean;
85
+ static isCamera2Product(type: number): boolean;
86
+ static isCamera3(type: number): boolean;
87
+ static isCamera3C(type: number): boolean;
88
+ static isCamera3Product(type: number): boolean;
89
+ static isEntrySensor(type: number): boolean;
90
+ static isMotionSensor(type: number): boolean;
91
+ static isSmartDrop(type: number): boolean;
92
+ static isSmartSafe(type: number): boolean;
93
+ static isIntegratedDeviceBySn(sn: string): boolean;
94
+ static isSoloCameraBySn(sn: string): boolean;
95
+ isCamera(): boolean;
96
+ isFloodLight(): boolean;
97
+ isFloodLightT8420X(): boolean;
98
+ isDoorbell(): boolean;
99
+ isWiredDoorbell(): boolean;
100
+ isWiredDoorbellT8200X(): boolean;
101
+ isWiredDoorbellDual(): boolean;
102
+ isLock(): boolean;
103
+ isLockKeypad(): boolean;
104
+ isLockBle(): boolean;
105
+ isLockBleNoFinger(): boolean;
106
+ isLockWifi(): boolean;
107
+ isLockWifiNoFinger(): boolean;
108
+ isLockWifiR10(): boolean;
109
+ isLockWifiR20(): boolean;
110
+ isLockWifiVideo(): boolean;
111
+ isLockWifiR10Keypad(): boolean;
112
+ isBatteryDoorbell1(): boolean;
113
+ isBatteryDoorbell2(): boolean;
114
+ isBatteryDoorbellDual(): boolean;
115
+ isDoorbellDual(): boolean;
116
+ isBatteryDoorbell(): boolean;
117
+ isSoloCamera(): boolean;
118
+ isSoloCameraPro(): boolean;
119
+ isSoloCameraSpotlight1080(): boolean;
120
+ isSoloCameraSpotlight2k(): boolean;
121
+ isSoloCameraSpotlightSolar(): boolean;
122
+ isStarlight4GLTE(): boolean;
123
+ isIndoorOutdoorCamera1080p(): boolean;
124
+ isIndoorOutdoorCamera1080pNoLight(): boolean;
125
+ isIndoorOutdoorCamera2k(): boolean;
126
+ isIndoorCamMini(): boolean;
127
+ isSoloCameras(): boolean;
128
+ isCamera2(): boolean;
129
+ isCamera2C(): boolean;
130
+ isCamera2Pro(): boolean;
131
+ isCamera2CPro(): boolean;
132
+ isCamera2Product(): boolean;
133
+ isCamera3(): boolean;
134
+ isCamera3C(): boolean;
135
+ isCamera3Product(): boolean;
136
+ isEntrySensor(): boolean;
137
+ isKeyPad(): boolean;
138
+ isMotionSensor(): boolean;
139
+ isIndoorCamera(): boolean;
140
+ isPanAndTiltCamera(): boolean;
141
+ isSmartDrop(): boolean;
142
+ isSmartSafe(): boolean;
143
+ isIntegratedDevice(): boolean;
144
+ hasBattery(): boolean;
145
+ getDeviceKey(): string;
146
+ getDeviceType(): number;
147
+ getHardwareVersion(): string;
148
+ getSoftwareVersion(): string;
149
+ getModel(): string;
150
+ getName(): string;
151
+ getSerial(): string;
152
+ getStationSerial(): string;
153
+ setParameters(params: {
154
+ paramType: number;
155
+ paramValue: any;
156
+ }[]): Promise<boolean>;
157
+ getChannel(): number;
158
+ getStateID(state: string, level?: number): string;
159
+ getStateChannel(): string;
160
+ getWifiRssi(): PropertyValue;
161
+ getStoragePath(filename: string): string;
162
+ isEnabled(): PropertyValue;
163
+ }
164
+ export declare class Camera extends Device {
165
+ private _isStreaming;
166
+ protected constructor(api: HTTPApi, device: DeviceListResponse);
167
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<Camera>;
168
+ getStateChannel(): string;
169
+ protected convertRawPropertyValue(property: PropertyMetadataAny, value: string): PropertyValue;
170
+ getLastCameraImageURL(): PropertyValue;
171
+ getMACAddress(): string;
172
+ startDetection(): Promise<void>;
173
+ startStream(): Promise<string>;
174
+ stopDetection(): Promise<void>;
175
+ stopStream(): Promise<void>;
176
+ getState(): PropertyValue;
177
+ isStreaming(): boolean;
178
+ close(): Promise<void>;
179
+ getLastChargingDays(): number;
180
+ getLastChargingFalseEvents(): number;
181
+ getLastChargingRecordedEvents(): number;
182
+ getLastChargingTotalEvents(): number;
183
+ getBatteryValue(): PropertyValue;
184
+ getBatteryTemperature(): PropertyValue;
185
+ isMotionDetectionEnabled(): PropertyValue;
186
+ isLedEnabled(): PropertyValue;
187
+ isAutoNightVisionEnabled(): PropertyValue;
188
+ isRTSPStreamEnabled(): PropertyValue;
189
+ isAntiTheftDetectionEnabled(): PropertyValue;
190
+ getWatermark(): PropertyValue;
191
+ isMotionDetected(): boolean;
192
+ isPersonDetected(): boolean;
193
+ getDetectedPerson(): string;
194
+ protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
195
+ processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
196
+ }
197
+ export declare class SoloCamera extends Camera {
198
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<SoloCamera>;
199
+ isLedEnabled(): PropertyValue;
200
+ isMotionDetectionEnabled(): PropertyValue;
201
+ processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
202
+ }
203
+ export declare class IndoorCamera extends Camera {
204
+ protected constructor(api: HTTPApi, device: DeviceListResponse);
205
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<IndoorCamera>;
206
+ isLedEnabled(): PropertyValue;
207
+ isMotionDetectionEnabled(): PropertyValue;
208
+ isPetDetectionEnabled(): PropertyValue;
209
+ isSoundDetectionEnabled(): PropertyValue;
210
+ isPetDetected(): boolean;
211
+ isSoundDetected(): boolean;
212
+ isCryingDetected(): boolean;
213
+ processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
214
+ destroy(): void;
215
+ }
216
+ export declare class DoorbellCamera extends Camera {
217
+ protected voices: Voices;
218
+ protected constructor(api: HTTPApi, device: DeviceListResponse, voices: Voices);
219
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<DoorbellCamera>;
220
+ private loadMetadataVoiceStates;
221
+ getVoiceName(id: number): string;
222
+ getVoices(): Voices;
223
+ getPropertiesMetadata(): IndexedProperty;
224
+ isRinging(): boolean;
225
+ protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
226
+ processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
227
+ }
228
+ export declare class WiredDoorbellCamera extends DoorbellCamera {
229
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<WiredDoorbellCamera>;
230
+ isLedEnabled(): PropertyValue;
231
+ isAutoNightVisionEnabled(): PropertyValue;
232
+ isMotionDetectionEnabled(): PropertyValue;
233
+ }
234
+ export declare class BatteryDoorbellCamera extends DoorbellCamera {
235
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<BatteryDoorbellCamera>;
236
+ isLedEnabled(): PropertyValue;
237
+ }
238
+ export declare class FloodlightCamera extends Camera {
239
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<FloodlightCamera>;
240
+ isLedEnabled(): PropertyValue;
241
+ isMotionDetectionEnabled(): PropertyValue;
242
+ protected convertRawPropertyValue(property: PropertyMetadataAny, value: string): PropertyValue;
243
+ processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
244
+ }
245
+ export declare class Sensor extends Device {
246
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<Sensor>;
247
+ getStateChannel(): string;
248
+ getState(): PropertyValue;
249
+ }
250
+ export declare class EntrySensor extends Sensor {
251
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<EntrySensor>;
252
+ isSensorOpen(): PropertyValue;
253
+ getSensorChangeTime(): PropertyValue;
254
+ isBatteryLow(): PropertyValue;
255
+ processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
256
+ protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
257
+ }
258
+ export declare class MotionSensor extends Sensor {
259
+ static readonly MOTION_COOLDOWN_MS = 120000;
260
+ protected constructor(api: HTTPApi, device: DeviceListResponse);
261
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<MotionSensor>;
262
+ isMotionDetected(): boolean;
263
+ getMotionSensorPIREvent(): PropertyValue;
264
+ isBatteryLow(): PropertyValue;
265
+ protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
266
+ processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
267
+ }
268
+ export declare class Lock extends Device {
269
+ static readonly VERSION_CODE_LOCKV12 = 18;
270
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<Lock>;
271
+ getStateChannel(): string;
272
+ protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
273
+ getState(): PropertyValue;
274
+ getBatteryValue(): PropertyValue;
275
+ getWifiRssi(): PropertyValue;
276
+ isLocked(): PropertyValue;
277
+ getLockStatus(): PropertyValue;
278
+ static encodeESLCmdOnOff(short_user_id: number, nickname: string, lock: boolean): Buffer;
279
+ static encodeESLCmdQueryStatus(admin_user_id: string): Buffer;
280
+ processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
281
+ processMQTTNotification(message: DeviceSmartLockNotifyData, eventDurationSeconds: number): void;
282
+ private processNotification;
283
+ private static getCurrentTimeInSeconds;
284
+ private static getUInt8Buffer;
285
+ private static getUint16LEBuffer;
286
+ private static getUint16BEBuffer;
287
+ static encodeCmdStatus(user_id: string): Buffer;
288
+ static encodeCmdUnlock(short_user_id: string, value: number, username: string): Buffer;
289
+ static encodeCmdCalibrate(user_id: string): Buffer;
290
+ static encodeCmdAddUser(short_user_id: string, passcode: string, username: string, schedule?: Schedule, user_permission?: number): Buffer;
291
+ static encodeCmdAddTemporaryUser(schedule?: Schedule, unlimited?: boolean): Buffer;
292
+ static encodeCmdDeleteTemporaryUser(password_id: string): Buffer;
293
+ static encodeCmdDeleteUser(short_user_id: string): Buffer;
294
+ static encodeCmdVerifyPw(password: string): Buffer;
295
+ static encodeCmdQueryLockRecord(index: number): Buffer;
296
+ static encodeCmdQueryUser(short_user_id: string): Buffer;
297
+ static encodeCmdQueryPassword(password_id: string): Buffer;
298
+ static encodeCmdModifyPassword(password_id: string, passcode: string): Buffer;
299
+ static encodeCmdUpdateSchedule(short_user_id: string, schedule: Schedule): Buffer;
300
+ static encodeCmdModifyUsername(username: string, password_id: string): Buffer;
301
+ static encodeCmdGetLockParam(user_id: string): Buffer;
302
+ static encodeCmdSetLockParamAutoLock(enabled: boolean, lockTimeSeconds: number): Buffer;
303
+ private static hexTime;
304
+ static encodeCmdSetLockParamAutoLockSchedule(enabled: boolean, schedule_start: string, schedule_end: string): Buffer;
305
+ static encodeCmdSetLockParamOneTouchLock(enabled: boolean): Buffer;
306
+ static encodeCmdSetLockParamWrongTryProtect(enabled: boolean, lockdownTime: number, attempts: number): Buffer;
307
+ static encodeCmdSetLockParamScramblePasscode(enabled: boolean): Buffer;
308
+ static encodeCmdSetLockParamSound(value: number): Buffer;
309
+ }
310
+ export declare class Keypad extends Device {
311
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<Keypad>;
312
+ getStateChannel(): string;
313
+ getState(): PropertyValue;
314
+ isBatteryLow(): PropertyValue;
315
+ isBatteryCharging(): PropertyValue;
316
+ protected convertRawPropertyValue(property: PropertyMetadataAny, value: string): PropertyValue;
317
+ }
318
+ export declare class SmartSafe extends Device {
319
+ static readonly IV = "052E19EB3F880512E99EBB684D4DC1FE";
320
+ static readonly DATA_HEADER: number[];
321
+ static readonly VERSION_CODE = 1;
322
+ static readonly PUSH_NOTIFICATION_POSITION: {
323
+ [index: string]: number;
324
+ };
325
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<SmartSafe>;
326
+ getStateChannel(): string;
327
+ private static getCurrentTimeInSeconds;
328
+ private static getUInt8Buffer;
329
+ private static getUint16LEBuffer;
330
+ private static encodeCmdSingleUInt8;
331
+ static encodeCmdWrongTryProtect(user_id: string, enabled: boolean, attempts: number, lockdownTime: number): Buffer;
332
+ static encodeCmdLeftOpenAlarm(user_id: string, enabled: boolean, duration: number): Buffer;
333
+ static encodeCmdDualUnlock(user_id: string, enabled: boolean): Buffer;
334
+ static encodeCmdScramblePIN(user_id: string, enabled: boolean): Buffer;
335
+ static encodeCmdPowerSave(user_id: string, enabled: boolean): Buffer;
336
+ static encodeCmdInteriorBrightness(user_id: string, interiorBrightness: number, duration: number): Buffer;
337
+ static encodeCmdTamperAlarm(user_id: string, option: number): Buffer;
338
+ static encodeCmdRemoteUnlock(user_id: string, option: number): Buffer;
339
+ static encodeCmdAlertVolume(user_id: string, volume: number): Buffer;
340
+ static encodeCmdPromptVolume(user_id: string, volume: number): Buffer;
341
+ static encodeCmdPushNotification(user_id: string, modes: number): Buffer;
342
+ static encodeCmdUnlock(user_id: string): Buffer;
343
+ static encodeCmdVerifyPIN(user_id: string, pin: string): Buffer;
344
+ protected convertRawPropertyValue(property: PropertyMetadataAny, value: string): PropertyValue;
345
+ shakeEvent(event: number, eventDurationSeconds: number): void;
346
+ alarm911Event(event: number, eventDurationSeconds: number): void;
347
+ jammedEvent(eventDurationSeconds: number): void;
348
+ lowBatteryEvent(eventDurationSeconds: number): void;
349
+ wrongTryProtectAlarmEvent(eventDurationSeconds: number): void;
350
+ processPushNotification(message: PushMessage, eventDurationSeconds: number): void;
351
+ protected handlePropertyChange(metadata: PropertyMetadataAny, oldValue: PropertyValue, newValue: PropertyValue): void;
352
+ getState(): PropertyValue;
353
+ getBatteryValue(): PropertyValue;
354
+ getWifiRssi(): PropertyValue;
355
+ isLocked(): boolean;
356
+ }
357
+ export declare class UnknownDevice extends Device {
358
+ static initialize(api: HTTPApi, device: DeviceListResponse): Promise<UnknownDevice>;
359
+ getStateChannel(): string;
360
+ }