tsvesync 1.0.11 → 1.0.13

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 (40) hide show
  1. package/dist/index.d.ts +7 -0
  2. package/dist/index.js +25 -0
  3. package/dist/lib/helpers.d.ts +52 -51
  4. package/dist/lib/helpers.js +135 -112
  5. package/dist/lib/logger.d.ts +23 -0
  6. package/dist/lib/logger.js +54 -0
  7. package/dist/lib/vesync.d.ts +57 -15
  8. package/dist/lib/vesync.js +341 -217
  9. package/dist/lib/vesyncBaseDevice.d.ts +25 -50
  10. package/dist/lib/vesyncBaseDevice.js +63 -90
  11. package/dist/lib/vesyncBulb.d.ts +88 -0
  12. package/dist/lib/vesyncBulb.js +295 -1
  13. package/dist/lib/vesyncBulbImpl.d.ts +38 -0
  14. package/dist/lib/vesyncBulbImpl.js +230 -0
  15. package/dist/lib/vesyncFan.d.ts +55 -67
  16. package/dist/lib/vesyncFan.js +366 -213
  17. package/dist/lib/vesyncFanImpl.d.ts +173 -0
  18. package/dist/lib/vesyncFanImpl.js +909 -0
  19. package/dist/lib/vesyncOutlet.d.ts +70 -0
  20. package/dist/lib/vesyncOutlet.js +213 -1
  21. package/dist/lib/vesyncOutletImpl.d.ts +70 -0
  22. package/dist/lib/vesyncOutletImpl.js +245 -0
  23. package/dist/lib/vesyncSwitch.d.ts +45 -0
  24. package/dist/lib/vesyncSwitch.js +77 -1
  25. package/dist/lib/vesyncSwitchImpl.d.ts +82 -0
  26. package/dist/lib/vesyncSwitchImpl.js +344 -0
  27. package/package.json +1 -1
  28. package/src/index.ts +14 -0
  29. package/src/lib/helpers.ts +3 -2
  30. package/src/lib/logger.ts +60 -0
  31. package/src/lib/vesync.ts +42 -43
  32. package/src/lib/vesyncBaseDevice.ts +8 -7
  33. package/src/lib/vesyncBulb.ts +138 -30
  34. package/src/lib/vesyncBulbImpl.ts +113 -44
  35. package/src/lib/vesyncFan.ts +2 -4
  36. package/src/lib/vesyncFanImpl.ts +314 -42
  37. package/src/lib/vesyncOutlet.ts +140 -13
  38. package/src/lib/vesyncOutletImpl.ts +41 -0
  39. package/src/lib/vesyncSwitch.ts +3 -454
  40. package/src/lib/vesyncSwitchImpl.ts +66 -16
@@ -1,47 +1,89 @@
1
- import { VeSyncBaseDevice, DeviceDetails } from './vesyncBaseDevice';
1
+ /**
2
+ * VeSync API Device Library
3
+ */
4
+ import { VeSyncBaseDevice } from './vesyncBaseDevice';
5
+ /**
6
+ * VeSync Manager Class
7
+ */
2
8
  export declare class VeSync {
3
- [x: number]: [any, number];
4
9
  private _debug;
5
10
  private _redact;
6
11
  private _energyUpdateInterval;
7
12
  private _energyCheck;
8
13
  private _devList;
14
+ private _lastUpdateTs;
15
+ private _inProcess;
9
16
  username: string;
10
17
  password: string;
11
18
  token: string | null;
12
19
  accountId: string | null;
13
20
  countryCode: string | null;
14
- devices: any | null;
21
+ devices: VeSyncBaseDevice[] | null;
15
22
  enabled: boolean;
16
23
  updateInterval: number;
17
- lastUpdateTs: number | null;
18
- inProcess: boolean;
19
24
  timeZone: string;
20
25
  fans: VeSyncBaseDevice[];
21
26
  outlets: VeSyncBaseDevice[];
22
27
  switches: VeSyncBaseDevice[];
23
28
  bulbs: VeSyncBaseDevice[];
24
29
  scales: VeSyncBaseDevice[];
25
- kitchen: VeSyncBaseDevice[];
30
+ /**
31
+ * Initialize VeSync Manager
32
+ */
26
33
  constructor(username: string, password: string, timeZone?: string, debug?: boolean, redact?: boolean);
34
+ /**
35
+ * Get/Set debug mode
36
+ */
27
37
  get debug(): boolean;
28
- set debug(newFlag: boolean);
38
+ set debug(flag: boolean);
39
+ /**
40
+ * Get/Set redact mode
41
+ */
29
42
  get redact(): boolean;
30
- set redact(newFlag: boolean);
43
+ set redact(flag: boolean);
44
+ /**
45
+ * Get/Set energy update interval
46
+ */
31
47
  get energyUpdateInterval(): number;
32
- set energyUpdateInterval(newEnergyUpdate: number);
48
+ set energyUpdateInterval(interval: number);
33
49
  /**
34
- * Test if device should be removed - false = Remove
50
+ * Test if device should be removed
35
51
  */
36
- static removeDevTest(device: VeSyncBaseDevice, newList: DeviceDetails[]): boolean;
52
+ static removeDevTest(device: VeSyncBaseDevice, newList: any[]): boolean;
37
53
  /**
38
- * Login to VeSync server
54
+ * Test if new device should be added
39
55
  */
40
- login(): Promise<boolean>;
56
+ addDevTest(newDev: Record<string, any>): boolean;
57
+ /**
58
+ * Remove devices not found in device list return
59
+ */
60
+ removeOldDevices(devices: any[]): boolean;
61
+ /**
62
+ * Correct devices without cid or uuid
63
+ */
64
+ static setDevId(devices: any[]): any[];
65
+ /**
66
+ * Process device list and instantiate device objects
67
+ */
68
+ processDevices(devList: any[]): boolean;
41
69
  /**
42
70
  * Get list of VeSync devices
43
71
  */
44
72
  getDevices(): Promise<boolean>;
45
- const body: import("./helpers").RequestBody;
46
- if(: any, response: any): any;
73
+ /**
74
+ * Login to VeSync server
75
+ */
76
+ login(): Promise<boolean>;
77
+ /**
78
+ * Test if update interval has been exceeded
79
+ */
80
+ deviceTimeCheck(): boolean;
81
+ /**
82
+ * Update device list and details
83
+ */
84
+ update(): Promise<void>;
85
+ /**
86
+ * Create device instance from details
87
+ */
88
+ createDevice(details: Record<string, any>): VeSyncBaseDevice | null;
47
89
  }