eufy-security-client 1.6.5 → 2.0.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.
Files changed (61) hide show
  1. package/README.md +37 -0
  2. package/build/eufysecurity.d.ts +14 -10
  3. package/build/eufysecurity.js +390 -281
  4. package/build/eufysecurity.js.map +1 -1
  5. package/build/http/api.d.ts +16 -13
  6. package/build/http/api.js +658 -644
  7. package/build/http/api.js.map +1 -1
  8. package/build/http/cache.d.ts +8 -0
  9. package/build/http/cache.js +34 -0
  10. package/build/http/cache.js.map +1 -0
  11. package/build/http/device.d.ts +54 -19
  12. package/build/http/device.js +633 -264
  13. package/build/http/device.js.map +1 -1
  14. package/build/http/error.d.ts +4 -0
  15. package/build/http/error.js +10 -1
  16. package/build/http/error.js.map +1 -1
  17. package/build/http/index.js +5 -1
  18. package/build/http/index.js.map +1 -1
  19. package/build/http/interfaces.d.ts +25 -23
  20. package/build/http/parameter.d.ts +2 -1
  21. package/build/http/parameter.js +25 -10
  22. package/build/http/parameter.js.map +1 -1
  23. package/build/http/station.d.ts +55 -6
  24. package/build/http/station.js +1069 -229
  25. package/build/http/station.js.map +1 -1
  26. package/build/http/types.d.ts +122 -12
  27. package/build/http/types.js +827 -152
  28. package/build/http/types.js.map +1 -1
  29. package/build/http/utils.d.ts +2 -0
  30. package/build/http/utils.js +44 -2
  31. package/build/http/utils.js.map +1 -1
  32. package/build/index.js +5 -1
  33. package/build/index.js.map +1 -1
  34. package/build/interfaces.d.ts +6 -10
  35. package/build/mqtt/service.js +5 -27
  36. package/build/mqtt/service.js.map +1 -1
  37. package/build/p2p/interfaces.d.ts +1 -1
  38. package/build/p2p/models.d.ts +3 -2
  39. package/build/p2p/session.d.ts +1 -2
  40. package/build/p2p/session.js +39 -65
  41. package/build/p2p/session.js.map +1 -1
  42. package/build/p2p/types.d.ts +22 -2
  43. package/build/p2p/types.js +21 -1
  44. package/build/p2p/types.js.map +1 -1
  45. package/build/p2p/utils.d.ts +1 -1
  46. package/build/p2p/utils.js +32 -33
  47. package/build/p2p/utils.js.map +1 -1
  48. package/build/push/client.js +5 -27
  49. package/build/push/client.js.map +1 -1
  50. package/build/push/index.js +5 -1
  51. package/build/push/index.js.map +1 -1
  52. package/build/push/parser.js +2 -5
  53. package/build/push/parser.js.map +1 -1
  54. package/build/push/service.js +19 -21
  55. package/build/push/service.js.map +1 -1
  56. package/build/push/utils.js +3 -6
  57. package/build/push/utils.js.map +1 -1
  58. package/build/utils.d.ts +3 -2
  59. package/build/utils.js +29 -22
  60. package/build/utils.js.map +1 -1
  61. package/package.json +17 -14
package/README.md CHANGED
@@ -5,6 +5,7 @@
5
5
  [![node](https://img.shields.io/node/v/eufy-security-client.svg)](https://www.npmjs.com/package/eufy-security-client)
6
6
  [![NPM version](http://img.shields.io/npm/v/eufy-security-client.svg)](https://www.npmjs.com/package/eufy-security-client)
7
7
  [![Downloads](https://img.shields.io/npm/dm/eufy-security-client.svg)](https://www.npmjs.com/package/eufy-security-client)
8
+ [![Total Downloads](https://img.shields.io/npm/dt/eufy-security-client.svg)](https://www.npmjs.com/package/eufy-security-client)
8
9
  [![Dependency Status](https://img.shields.io/librariesio/release/npm/eufy-security-client)](https://libraries.io/npm/eufy-security-client)
9
10
  [![Known Vulnerabilities](https://snyk.io/test/github/bropat/eufy-security-client/badge.svg)](https://snyk.io/test/github/bropat/eufy-security-client)
10
11
 
@@ -79,6 +80,42 @@ Please use GitHub issues for this.
79
80
 
80
81
  ## Changelog
81
82
 
83
+ ### 2.0.1 (2022-05-03)
84
+
85
+ * (bropat) **Breaking Change** Fixed regression in device data loading
86
+ * (bropat) Target set back to ES2019
87
+
88
+ ### 2.0.0 (2022-04-30)
89
+
90
+ * (bropat) **Breaking Change** Requires node version >= 14.17
91
+ * (bropat) **Breaking Change** HTTPApi class, EufySecurity class and Device classes instantiation changed
92
+ * (bropat) **Breaking Change** Timestamp for device and station properties has been removed
93
+ * (bropat) Added support for Battery Doorbell Dual (T8213; #126)
94
+ * (bropat) Added support for Video Doorbell Dual (T8203; #141)
95
+ * (bropat) Added support for IndoorCam Mini (T8414; #143)
96
+ * (bropat) Added continuos recording setting for some supported cameras
97
+ * (bropat) Added continuos recording type setting for some supported cameras
98
+ * (bropat) Added default angle setting for IndoorCam Mini (T8414)
99
+ * (bropat) Added default angle idle time setting for IndoorCam Mini (T8414)
100
+ * (bropat) Added notification interval time setting for some supported cameras
101
+ * (bropat) Added calibrate command for some supported cameras
102
+ * (bropat) Added set default angle command for IndoorCam Mini (T8414
103
+ * (bropat) Added set privacy angle command for IndoorCam Mini (T8414)
104
+ * (bropat) Removed PREFER_LOCAL P2P connectivity mode. Default mode is now QUICKEST.
105
+ * (bropat) Added new charging status "solar charging" (value: 4; issue #127)
106
+ * (bropat) Fixed Eufy cloud authentication token renewal
107
+ * (bropat) Fixed some Eufy cloud authentication issues
108
+ * (bropat) Fixed authentication issues when changing country setting
109
+ * (bropat) Fixed possible wrong battery values on some devices
110
+ * (bropat) Fixed issue if device doesn't support P2P communication
111
+ * (bropat) Fixed issue #136
112
+ * (bropat) Fixed issue #122
113
+ * (bropat) Updated versions of the package dependencies
114
+
115
+ ### 1.6.6 (2022-02-12)
116
+
117
+ * (bropat) Fixed issue where no devices/stations are found (#116)
118
+
82
119
  ### 1.6.5 (2022-02-08)
83
120
 
84
121
  * (bropat) Fixed regression in authentication flow introduced when fixing issue #116
@@ -2,6 +2,7 @@ import { TypedEmitter } from "tiny-typed-emitter";
2
2
  import { Logger } from "ts-log";
3
3
  import { EufySecurityEvents, EufySecurityConfig } from "./interfaces";
4
4
  import { HTTPApi } from "./http/api";
5
+ import { LoginOptions } from "./http/interfaces";
5
6
  import { Station } from "./http/station";
6
7
  import { PushNotificationService } from "./push/service";
7
8
  import { Credentials } from "./push/models";
@@ -11,6 +12,7 @@ export declare class EufySecurity extends TypedEmitter<EufySecurityEvents> {
11
12
  private config;
12
13
  private log;
13
14
  private api;
15
+ private houses;
14
16
  private stations;
15
17
  private devices;
16
18
  private readonly P2P_REFRESH_INTERVAL_MIN;
@@ -24,9 +26,13 @@ export declare class EufySecurity extends TypedEmitter<EufySecurityEvents> {
24
26
  private persistentFile;
25
27
  private persistentData;
26
28
  private connected;
29
+ private retries;
27
30
  private refreshEufySecurityCloudTimeout?;
28
31
  private refreshEufySecurityP2PTimeout;
29
- constructor(config: EufySecurityConfig, log?: Logger);
32
+ private loadingDevices?;
33
+ private constructor();
34
+ static initialize(config: EufySecurityConfig, log?: Logger): Promise<EufySecurity>;
35
+ protected _initializeInternals(): Promise<void>;
30
36
  private initMQTT;
31
37
  getPushService(): PushNotificationService;
32
38
  private addStation;
@@ -35,15 +41,16 @@ export declare class EufySecurity extends TypedEmitter<EufySecurityEvents> {
35
41
  private addDevice;
36
42
  private removeDevice;
37
43
  private updateDevice;
38
- getDevices(): Array<Device>;
39
- getDevice(deviceSN: string): Device;
40
- getStationDevice(stationSN: string, channel: number): Device;
44
+ getDevices(): Promise<Array<Device>>;
45
+ getDevice(deviceSN: string): Promise<Device>;
46
+ getStationDevice(stationSN: string, channel: number): Promise<Device>;
41
47
  getStations(): Array<Station>;
42
48
  getStation(stationSN: string): Station;
43
49
  getApi(): HTTPApi;
44
50
  connectToStation(stationSN: string, p2pConnectionType?: P2PConnectionType): Promise<void>;
45
51
  isStationConnected(stationSN: string): boolean;
46
52
  isStationEnergySavingDevice(stationSN: string): boolean;
53
+ private handleHouses;
47
54
  private handleHubs;
48
55
  private onStationConnect;
49
56
  private onStationClose;
@@ -53,7 +60,7 @@ export declare class EufySecurity extends TypedEmitter<EufySecurityEvents> {
53
60
  setCameraMaxLivestreamDuration(seconds: number): void;
54
61
  getCameraMaxLivestreamDuration(): number;
55
62
  registerPushNotifications(credentials?: Credentials, persistentIds?: string[]): Promise<void>;
56
- connect(verifyCodeOrCaptcha?: string | null, captchaId?: string | null): Promise<boolean>;
63
+ connect(options?: LoginOptions): Promise<void>;
57
64
  getPushPersistentIds(): string[];
58
65
  private updateDeviceProperties;
59
66
  private onAPIClose;
@@ -63,7 +70,6 @@ export declare class EufySecurity extends TypedEmitter<EufySecurityEvents> {
63
70
  stopStationLivestream(deviceSN: string): Promise<void>;
64
71
  stopCloudLivestream(deviceSN: string): Promise<void>;
65
72
  private writePersistentData;
66
- private saveAPIBase;
67
73
  private saveCloudToken;
68
74
  private savePushCredentials;
69
75
  private savePushPersistentIds;
@@ -89,14 +95,10 @@ export declare class EufySecurity extends TypedEmitter<EufySecurityEvents> {
89
95
  private onStationGuardMode;
90
96
  private onStationCurrentMode;
91
97
  private onStationPropertyChanged;
92
- private onStationPropertyRenewed;
93
98
  private onStationRawPropertyChanged;
94
- private onStationRawPropertyRenewed;
95
99
  private onStationAlarmEvent;
96
100
  private onDevicePropertyChanged;
97
- private onDevicePropertyRenewed;
98
101
  private onDeviceRawPropertyChanged;
99
- private onDeviceRawPropertyRenewed;
100
102
  private onDeviceCryingDetected;
101
103
  private onDeviceSoundDetected;
102
104
  private onDevicePetDetected;
@@ -111,4 +113,6 @@ export declare class EufySecurity extends TypedEmitter<EufySecurityEvents> {
111
113
  private onStationWifiRssi;
112
114
  private onCaptchaRequest;
113
115
  private onFloodlightManualSwitch;
116
+ private onAuthTokenInvalidated;
117
+ private onTfaRequest;
114
118
  }