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.
- package/dist/index.d.ts +7 -0
- package/dist/index.js +25 -0
- package/dist/lib/helpers.d.ts +52 -51
- package/dist/lib/helpers.js +135 -112
- package/dist/lib/logger.d.ts +23 -0
- package/dist/lib/logger.js +54 -0
- package/dist/lib/vesync.d.ts +57 -15
- package/dist/lib/vesync.js +341 -217
- package/dist/lib/vesyncBaseDevice.d.ts +25 -50
- package/dist/lib/vesyncBaseDevice.js +63 -90
- package/dist/lib/vesyncBulb.d.ts +88 -0
- package/dist/lib/vesyncBulb.js +295 -1
- package/dist/lib/vesyncBulbImpl.d.ts +38 -0
- package/dist/lib/vesyncBulbImpl.js +230 -0
- package/dist/lib/vesyncFan.d.ts +55 -67
- package/dist/lib/vesyncFan.js +366 -213
- package/dist/lib/vesyncFanImpl.d.ts +173 -0
- package/dist/lib/vesyncFanImpl.js +909 -0
- package/dist/lib/vesyncOutlet.d.ts +70 -0
- package/dist/lib/vesyncOutlet.js +213 -1
- package/dist/lib/vesyncOutletImpl.d.ts +70 -0
- package/dist/lib/vesyncOutletImpl.js +245 -0
- package/dist/lib/vesyncSwitch.d.ts +45 -0
- package/dist/lib/vesyncSwitch.js +77 -1
- package/dist/lib/vesyncSwitchImpl.d.ts +82 -0
- package/dist/lib/vesyncSwitchImpl.js +344 -0
- package/package.json +1 -1
- package/src/index.ts +14 -0
- package/src/lib/helpers.ts +3 -2
- package/src/lib/logger.ts +60 -0
- package/src/lib/vesync.ts +42 -43
- package/src/lib/vesyncBaseDevice.ts +8 -7
- package/src/lib/vesyncBulb.ts +138 -30
- package/src/lib/vesyncBulbImpl.ts +113 -44
- package/src/lib/vesyncFan.ts +2 -4
- package/src/lib/vesyncFanImpl.ts +314 -42
- package/src/lib/vesyncOutlet.ts +140 -13
- package/src/lib/vesyncOutletImpl.ts +41 -0
- package/src/lib/vesyncSwitch.ts +3 -454
- package/src/lib/vesyncSwitchImpl.ts +66 -16
package/dist/lib/vesync.d.ts
CHANGED
|
@@ -1,47 +1,89 @@
|
|
|
1
|
-
|
|
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:
|
|
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
|
-
|
|
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(
|
|
38
|
+
set debug(flag: boolean);
|
|
39
|
+
/**
|
|
40
|
+
* Get/Set redact mode
|
|
41
|
+
*/
|
|
29
42
|
get redact(): boolean;
|
|
30
|
-
set redact(
|
|
43
|
+
set redact(flag: boolean);
|
|
44
|
+
/**
|
|
45
|
+
* Get/Set energy update interval
|
|
46
|
+
*/
|
|
31
47
|
get energyUpdateInterval(): number;
|
|
32
|
-
set energyUpdateInterval(
|
|
48
|
+
set energyUpdateInterval(interval: number);
|
|
33
49
|
/**
|
|
34
|
-
* Test if device should be removed
|
|
50
|
+
* Test if device should be removed
|
|
35
51
|
*/
|
|
36
|
-
static removeDevTest(device: VeSyncBaseDevice, newList:
|
|
52
|
+
static removeDevTest(device: VeSyncBaseDevice, newList: any[]): boolean;
|
|
37
53
|
/**
|
|
38
|
-
*
|
|
54
|
+
* Test if new device should be added
|
|
39
55
|
*/
|
|
40
|
-
|
|
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
|
-
|
|
46
|
-
|
|
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
|
}
|