tsvesync 1.0.11

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 (138) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +227 -0
  3. package/api/vesync/VeSync.yaml +33 -0
  4. package/api/vesyncbulb/ESL100.yaml +74 -0
  5. package/api/vesyncbulb/ESL100CW.yaml +123 -0
  6. package/api/vesyncbulb/ESL100MC.yaml +169 -0
  7. package/api/vesyncbulb/XYD0001.yaml +193 -0
  8. package/api/vesyncfan/Classic200S.yaml +280 -0
  9. package/api/vesyncfan/Classic300S.yaml +278 -0
  10. package/api/vesyncfan/Core200S.yaml +256 -0
  11. package/api/vesyncfan/Core300S.yaml +281 -0
  12. package/api/vesyncfan/Core400S.yaml +281 -0
  13. package/api/vesyncfan/Core600S.yaml +281 -0
  14. package/api/vesyncfan/Dual200S.yaml +278 -0
  15. package/api/vesyncfan/LAP-C201S-AUSR.yaml +256 -0
  16. package/api/vesyncfan/LAP-C202S-WUSR.yaml +256 -0
  17. package/api/vesyncfan/LAP-C301S-WAAA.yaml +281 -0
  18. package/api/vesyncfan/LAP-C301S-WJP.yaml +281 -0
  19. package/api/vesyncfan/LAP-C302S-WUSB.yaml +281 -0
  20. package/api/vesyncfan/LAP-C401S-WAAA.yaml +281 -0
  21. package/api/vesyncfan/LAP-C401S-WJP.yaml +281 -0
  22. package/api/vesyncfan/LAP-C401S-WUSR.yaml +281 -0
  23. package/api/vesyncfan/LAP-C601S-WEU.yaml +281 -0
  24. package/api/vesyncfan/LAP-C601S-WUS.yaml +281 -0
  25. package/api/vesyncfan/LAP-C601S-WUSR.yaml +281 -0
  26. package/api/vesyncfan/LAP-EL551S-AEUR.yaml +167 -0
  27. package/api/vesyncfan/LAP-EL551S-AUS.yaml +167 -0
  28. package/api/vesyncfan/LAP-EL551S-WEU.yaml +167 -0
  29. package/api/vesyncfan/LAP-EL551S-WUS.yaml +167 -0
  30. package/api/vesyncfan/LAP-V102S-AASR.yaml +167 -0
  31. package/api/vesyncfan/LAP-V102S-AUSR.yaml +167 -0
  32. package/api/vesyncfan/LAP-V102S-WEU.yaml +167 -0
  33. package/api/vesyncfan/LAP-V102S-WJP.yaml +167 -0
  34. package/api/vesyncfan/LAP-V102S-WUS.yaml +167 -0
  35. package/api/vesyncfan/LAP-V201-AUSR.yaml +167 -0
  36. package/api/vesyncfan/LAP-V201S-AASR.yaml +167 -0
  37. package/api/vesyncfan/LAP-V201S-AEUR.yaml +167 -0
  38. package/api/vesyncfan/LAP-V201S-AUSR.yaml +167 -0
  39. package/api/vesyncfan/LAP-V201S-WEU.yaml +167 -0
  40. package/api/vesyncfan/LAP-V201S-WJP.yaml +167 -0
  41. package/api/vesyncfan/LAP-V201S-WUS.yaml +167 -0
  42. package/api/vesyncfan/LEH-S601S-WUS.yaml +303 -0
  43. package/api/vesyncfan/LEH-S601S-WUSR.yaml +82 -0
  44. package/api/vesyncfan/LTF-F422S-KEU.yaml +165 -0
  45. package/api/vesyncfan/LTF-F422S-WUS.yaml +165 -0
  46. package/api/vesyncfan/LTF-F422S-WUSR.yaml +167 -0
  47. package/api/vesyncfan/LTF-F422_WJP.yaml +165 -0
  48. package/api/vesyncfan/LUH-A601S-AUSW.yaml +82 -0
  49. package/api/vesyncfan/LUH-A601S-WUSB.yaml +305 -0
  50. package/api/vesyncfan/LUH-A602S-WEU.yaml +305 -0
  51. package/api/vesyncfan/LUH-A602S-WEUR.yaml +305 -0
  52. package/api/vesyncfan/LUH-A602S-WJP.yaml +305 -0
  53. package/api/vesyncfan/LUH-A602S-WUS.yaml +305 -0
  54. package/api/vesyncfan/LUH-A602S-WUSC.yaml +305 -0
  55. package/api/vesyncfan/LUH-A602S-WUSR.yaml +305 -0
  56. package/api/vesyncfan/LUH-D301S-WEU.yaml +305 -0
  57. package/api/vesyncfan/LUH-D301S-WJP.yaml +305 -0
  58. package/api/vesyncfan/LUH-D301S-WUSR.yaml +305 -0
  59. package/api/vesyncfan/LUH-M101S-WUS.yaml +278 -0
  60. package/api/vesyncfan/LUH-O451S-WEU.yaml +278 -0
  61. package/api/vesyncfan/LUH-O451S-WUS.yaml +278 -0
  62. package/api/vesyncfan/LUH-O451S-WUSR.yaml +305 -0
  63. package/api/vesyncfan/LUH-O601S-KUS.yaml +305 -0
  64. package/api/vesyncfan/LUH-O601S-WUS.yaml +305 -0
  65. package/api/vesyncfan/LV-PUR131S.yaml +108 -0
  66. package/api/vesyncfan/LV-RH131S.yaml +108 -0
  67. package/api/vesyncoutlet/ESO15-TB.yaml +124 -0
  68. package/api/vesyncoutlet/ESW01-EU.yaml +122 -0
  69. package/api/vesyncoutlet/ESW03-USA.yaml +122 -0
  70. package/api/vesyncoutlet/ESW15-USA.yaml +156 -0
  71. package/api/vesyncoutlet/wifi-switch-1.3.yaml +60 -0
  72. package/api/vesyncswitch/ESWD16.yaml +128 -0
  73. package/api/vesyncswitch/ESWL01.yaml +56 -0
  74. package/api/vesyncswitch/ESWL03.yaml +56 -0
  75. package/dist/lib/helpers.d.ts +87 -0
  76. package/dist/lib/helpers.js +222 -0
  77. package/dist/lib/helpers.js.map +1 -0
  78. package/dist/lib/vesync.d.ts +47 -0
  79. package/dist/lib/vesync.js +309 -0
  80. package/dist/lib/vesync.js.map +1 -0
  81. package/dist/lib/vesyncBaseDevice.d.ts +68 -0
  82. package/dist/lib/vesyncBaseDevice.js +116 -0
  83. package/dist/lib/vesyncBaseDevice.js.map +1 -0
  84. package/dist/lib/vesyncBulb.d.ts +0 -0
  85. package/dist/lib/vesyncBulb.js +2 -0
  86. package/dist/lib/vesyncBulb.js.map +1 -0
  87. package/dist/lib/vesyncFan.d.ts +92 -0
  88. package/dist/lib/vesyncFan.js +265 -0
  89. package/dist/lib/vesyncFan.js.map +1 -0
  90. package/dist/lib/vesyncKitchen.d.ts +0 -0
  91. package/dist/lib/vesyncKitchen.js +2 -0
  92. package/dist/lib/vesyncKitchen.js.map +1 -0
  93. package/dist/lib/vesyncOutlet.d.ts +0 -0
  94. package/dist/lib/vesyncOutlet.js +2 -0
  95. package/dist/lib/vesyncOutlet.js.map +1 -0
  96. package/dist/lib/vesyncSwitch.d.ts +0 -0
  97. package/dist/lib/vesyncSwitch.js +2 -0
  98. package/dist/lib/vesyncSwitch.js.map +1 -0
  99. package/dist/src/lib/helpers.d.ts +88 -0
  100. package/dist/src/lib/helpers.js +244 -0
  101. package/dist/src/lib/vesync.d.ts +89 -0
  102. package/dist/src/lib/vesync.js +430 -0
  103. package/dist/src/lib/vesyncBaseDevice.d.ts +43 -0
  104. package/dist/src/lib/vesyncBaseDevice.js +87 -0
  105. package/dist/src/lib/vesyncBulb.d.ts +79 -0
  106. package/dist/src/lib/vesyncBulb.js +198 -0
  107. package/dist/src/lib/vesyncBulbImpl.d.ts +38 -0
  108. package/dist/src/lib/vesyncBulbImpl.js +161 -0
  109. package/dist/src/lib/vesyncFan.d.ts +80 -0
  110. package/dist/src/lib/vesyncFan.js +406 -0
  111. package/dist/src/lib/vesyncFanImpl.d.ts +137 -0
  112. package/dist/src/lib/vesyncFanImpl.js +643 -0
  113. package/dist/src/lib/vesyncOutlet.d.ts +53 -0
  114. package/dist/src/lib/vesyncOutlet.js +98 -0
  115. package/dist/src/lib/vesyncOutletImpl.d.ts +70 -0
  116. package/dist/src/lib/vesyncOutletImpl.js +206 -0
  117. package/dist/src/lib/vesyncSwitch.d.ts +169 -0
  118. package/dist/src/lib/vesyncSwitch.js +414 -0
  119. package/dist/src/lib/vesyncSwitchImpl.d.ts +82 -0
  120. package/dist/src/lib/vesyncSwitchImpl.js +290 -0
  121. package/dist/test/testFeatures.d.ts +4 -0
  122. package/dist/test/testFeatures.js +394 -0
  123. package/dist/test/testService.d.ts +62 -0
  124. package/dist/test/testService.js +540 -0
  125. package/dist/test/testSpecial.d.ts +5 -0
  126. package/dist/test/testSpecial.js +227 -0
  127. package/package.json +53 -0
  128. package/src/lib/helpers.ts +290 -0
  129. package/src/lib/vesync.ts +530 -0
  130. package/src/lib/vesyncBaseDevice.ts +114 -0
  131. package/src/lib/vesyncBulb.ts +252 -0
  132. package/src/lib/vesyncBulbImpl.ts +215 -0
  133. package/src/lib/vesyncFan.ts +447 -0
  134. package/src/lib/vesyncFanImpl.ts +848 -0
  135. package/src/lib/vesyncOutlet.ts +148 -0
  136. package/src/lib/vesyncOutletImpl.ts +284 -0
  137. package/src/lib/vesyncSwitch.ts +546 -0
  138. package/src/lib/vesyncSwitchImpl.ts +408 -0
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /**
3
+ * VeSync Outlets
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.VeSyncOutlet = void 0;
7
+ const vesyncBaseDevice_1 = require("./vesyncBaseDevice");
8
+ const helpers_1 = require("./helpers");
9
+ /**
10
+ * VeSync Outlet Base Class
11
+ */
12
+ class VeSyncOutlet extends vesyncBaseDevice_1.VeSyncBaseDevice {
13
+ constructor(details, manager) {
14
+ super(details, manager);
15
+ this.energy = {};
16
+ this.details = details;
17
+ }
18
+ /**
19
+ * Get outlet details
20
+ */
21
+ async getDetails() {
22
+ const url = `/v1/${this.deviceType}/${this.deviceType}-${this.cid}/detail`;
23
+ const [response] = await helpers_1.Helpers.callApi(url, 'get', null, helpers_1.Helpers.reqHeaders(this.manager));
24
+ if (response?.code === 0) {
25
+ this.details = response.result;
26
+ this.deviceStatus = response.result.deviceStatus;
27
+ }
28
+ }
29
+ /**
30
+ * Update outlet energy data
31
+ */
32
+ async updateEnergy() {
33
+ const url = `/v1/${this.deviceType}/${this.deviceType}-${this.cid}/energy/detail`;
34
+ const [response] = await helpers_1.Helpers.callApi(url, 'get', null, helpers_1.Helpers.reqHeaders(this.manager));
35
+ if (response?.code === 0) {
36
+ this.energy = response.result;
37
+ }
38
+ }
39
+ /**
40
+ * Get outlet energy usage
41
+ */
42
+ async getEnergyUsage() {
43
+ await this.updateEnergy();
44
+ return {
45
+ power: this.energy.power || 'Not available',
46
+ voltage: this.energy.voltage || 'Not available',
47
+ energy_today: this.energy.energyToday || 'Not available',
48
+ energy_week: this.energy.energyWeek || 'Not available',
49
+ energy_month: this.energy.energyMonth || 'Not available',
50
+ energy_year: this.energy.energyYear || 'Not available'
51
+ };
52
+ }
53
+ /**
54
+ * Get outlet status
55
+ */
56
+ async getStatus() {
57
+ await this.getDetails();
58
+ return this.deviceStatus;
59
+ }
60
+ /**
61
+ * Get weekly energy data
62
+ */
63
+ async getWeeklyEnergy() {
64
+ const url = `/v1/${this.deviceType}/${this.deviceType}-${this.cid}/energy/week`;
65
+ const [response] = await helpers_1.Helpers.callApi(url, 'get', null, helpers_1.Helpers.reqHeaders(this.manager));
66
+ if (response?.code === 0) {
67
+ this.energy.week = response.result;
68
+ }
69
+ }
70
+ /**
71
+ * Get monthly energy data
72
+ */
73
+ async getMonthlyEnergy() {
74
+ const url = `/v1/${this.deviceType}/${this.deviceType}-${this.cid}/energy/month`;
75
+ const [response] = await helpers_1.Helpers.callApi(url, 'get', null, helpers_1.Helpers.reqHeaders(this.manager));
76
+ if (response?.code === 0) {
77
+ this.energy.month = response.result;
78
+ }
79
+ }
80
+ /**
81
+ * Get yearly energy data
82
+ */
83
+ async getYearlyEnergy() {
84
+ const url = `/v1/${this.deviceType}/${this.deviceType}-${this.cid}/energy/year`;
85
+ const [response] = await helpers_1.Helpers.callApi(url, 'get', null, helpers_1.Helpers.reqHeaders(this.manager));
86
+ if (response?.code === 0) {
87
+ this.energy.year = response.result;
88
+ }
89
+ }
90
+ /**
91
+ * Update outlet details and energy info
92
+ */
93
+ async update() {
94
+ await this.getDetails();
95
+ await this.updateEnergy();
96
+ }
97
+ }
98
+ exports.VeSyncOutlet = VeSyncOutlet;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * VeSync Outlet Implementations
3
+ */
4
+ import { VeSyncOutlet } from './vesyncOutlet';
5
+ import { VeSync } from './vesync';
6
+ /**
7
+ * VeSync 7A Outlet
8
+ */
9
+ export declare class VeSyncOutlet7A extends VeSyncOutlet {
10
+ constructor(details: Record<string, any>, manager: VeSync);
11
+ /**
12
+ * Turn outlet on
13
+ */
14
+ turnOn(): Promise<boolean>;
15
+ /**
16
+ * Turn outlet off
17
+ */
18
+ turnOff(): Promise<boolean>;
19
+ }
20
+ /**
21
+ * VeSync 10A Outlet
22
+ */
23
+ export declare class VeSyncOutlet10A extends VeSyncOutlet {
24
+ constructor(details: Record<string, any>, manager: VeSync);
25
+ /**
26
+ * Turn outlet on
27
+ */
28
+ turnOn(): Promise<boolean>;
29
+ /**
30
+ * Turn outlet off
31
+ */
32
+ turnOff(): Promise<boolean>;
33
+ }
34
+ /**
35
+ * VeSync 15A Outlet
36
+ */
37
+ export declare class VeSyncOutlet15A extends VeSyncOutlet {
38
+ constructor(details: Record<string, any>, manager: VeSync);
39
+ /**
40
+ * Turn outlet on
41
+ */
42
+ turnOn(): Promise<boolean>;
43
+ /**
44
+ * Turn outlet off
45
+ */
46
+ turnOff(): Promise<boolean>;
47
+ /**
48
+ * Turn on nightlight
49
+ */
50
+ turnOnNightlight(): Promise<boolean>;
51
+ /**
52
+ * Turn off nightlight
53
+ */
54
+ turnOffNightlight(): Promise<boolean>;
55
+ }
56
+ /**
57
+ * VeSync Outdoor Plug
58
+ */
59
+ export declare class VeSyncOutdoorPlug extends VeSyncOutlet {
60
+ constructor(details: Record<string, any>, manager: VeSync);
61
+ /**
62
+ * Turn outlet on
63
+ */
64
+ turnOn(): Promise<boolean>;
65
+ /**
66
+ * Turn outlet off
67
+ */
68
+ turnOff(): Promise<boolean>;
69
+ }
70
+ export declare const outletModules: Record<string, new (details: Record<string, any>, manager: VeSync) => VeSyncOutlet>;
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ /**
3
+ * VeSync Outlet Implementations
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.outletModules = exports.VeSyncOutdoorPlug = exports.VeSyncOutlet15A = exports.VeSyncOutlet10A = exports.VeSyncOutlet7A = void 0;
7
+ const vesyncOutlet_1 = require("./vesyncOutlet");
8
+ const helpers_1 = require("./helpers");
9
+ /**
10
+ * VeSync 7A Outlet
11
+ */
12
+ class VeSyncOutlet7A extends vesyncOutlet_1.VeSyncOutlet {
13
+ constructor(details, manager) {
14
+ super(details, manager);
15
+ }
16
+ /**
17
+ * Turn outlet on
18
+ */
19
+ async turnOn() {
20
+ const url = `/v1/wifi-switch-1.3/wifi-switch-1.3-${this.cid}/status/on`;
21
+ const [response] = await helpers_1.Helpers.callApi(url, 'put', null, helpers_1.Helpers.reqHeaders(this.manager));
22
+ if (response?.code === 0) {
23
+ this.deviceStatus = 'on';
24
+ return true;
25
+ }
26
+ return false;
27
+ }
28
+ /**
29
+ * Turn outlet off
30
+ */
31
+ async turnOff() {
32
+ const url = `/v1/wifi-switch-1.3/wifi-switch-1.3-${this.cid}/status/off`;
33
+ const [response] = await helpers_1.Helpers.callApi(url, 'put', null, helpers_1.Helpers.reqHeaders(this.manager));
34
+ if (response?.code === 0) {
35
+ this.deviceStatus = 'off';
36
+ return true;
37
+ }
38
+ return false;
39
+ }
40
+ }
41
+ exports.VeSyncOutlet7A = VeSyncOutlet7A;
42
+ /**
43
+ * VeSync 10A Outlet
44
+ */
45
+ class VeSyncOutlet10A extends vesyncOutlet_1.VeSyncOutlet {
46
+ constructor(details, manager) {
47
+ super(details, manager);
48
+ }
49
+ /**
50
+ * Turn outlet on
51
+ */
52
+ async turnOn() {
53
+ const body = {
54
+ ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
55
+ uuid: this.uuid,
56
+ status: 'on'
57
+ };
58
+ const [response] = await helpers_1.Helpers.callApi('/10a/v1/device/devicestatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
59
+ if (response?.code === 0) {
60
+ this.deviceStatus = 'on';
61
+ return true;
62
+ }
63
+ return false;
64
+ }
65
+ /**
66
+ * Turn outlet off
67
+ */
68
+ async turnOff() {
69
+ const body = {
70
+ ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
71
+ uuid: this.uuid,
72
+ status: 'off'
73
+ };
74
+ const [response] = await helpers_1.Helpers.callApi('/10a/v1/device/devicestatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
75
+ if (response?.code === 0) {
76
+ this.deviceStatus = 'off';
77
+ return true;
78
+ }
79
+ return false;
80
+ }
81
+ }
82
+ exports.VeSyncOutlet10A = VeSyncOutlet10A;
83
+ /**
84
+ * VeSync 15A Outlet
85
+ */
86
+ class VeSyncOutlet15A extends vesyncOutlet_1.VeSyncOutlet {
87
+ constructor(details, manager) {
88
+ super(details, manager);
89
+ }
90
+ /**
91
+ * Turn outlet on
92
+ */
93
+ async turnOn() {
94
+ const body = {
95
+ ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
96
+ uuid: this.uuid,
97
+ status: 'on'
98
+ };
99
+ const [response] = await helpers_1.Helpers.callApi('/15a/v1/device/devicestatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
100
+ if (response?.code === 0) {
101
+ this.deviceStatus = 'on';
102
+ return true;
103
+ }
104
+ return false;
105
+ }
106
+ /**
107
+ * Turn outlet off
108
+ */
109
+ async turnOff() {
110
+ const body = {
111
+ ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
112
+ uuid: this.uuid,
113
+ status: 'off'
114
+ };
115
+ const [response] = await helpers_1.Helpers.callApi('/15a/v1/device/devicestatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
116
+ if (response?.code === 0) {
117
+ this.deviceStatus = 'off';
118
+ return true;
119
+ }
120
+ return false;
121
+ }
122
+ /**
123
+ * Turn on nightlight
124
+ */
125
+ async turnOnNightlight() {
126
+ const body = {
127
+ ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
128
+ uuid: this.uuid,
129
+ mode: 'auto'
130
+ };
131
+ const [response] = await helpers_1.Helpers.callApi('/15a/v1/device/nightlightstatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
132
+ if (response?.code === 0) {
133
+ this.details.nightLightStatus = 'on';
134
+ return true;
135
+ }
136
+ return false;
137
+ }
138
+ /**
139
+ * Turn off nightlight
140
+ */
141
+ async turnOffNightlight() {
142
+ const body = {
143
+ ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
144
+ uuid: this.uuid,
145
+ mode: 'manual'
146
+ };
147
+ const [response] = await helpers_1.Helpers.callApi('/15a/v1/device/nightlightstatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
148
+ if (response?.code === 0) {
149
+ this.details.nightLightStatus = 'off';
150
+ return true;
151
+ }
152
+ return false;
153
+ }
154
+ }
155
+ exports.VeSyncOutlet15A = VeSyncOutlet15A;
156
+ /**
157
+ * VeSync Outdoor Plug
158
+ */
159
+ class VeSyncOutdoorPlug extends vesyncOutlet_1.VeSyncOutlet {
160
+ constructor(details, manager) {
161
+ super(details, manager);
162
+ }
163
+ /**
164
+ * Turn outlet on
165
+ */
166
+ async turnOn() {
167
+ const body = {
168
+ ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
169
+ uuid: this.uuid,
170
+ status: 'on',
171
+ switchNo: 1
172
+ };
173
+ const [response] = await helpers_1.Helpers.callApi('/outdoorsocket15a/v1/device/devicestatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
174
+ if (response?.code === 0) {
175
+ this.deviceStatus = 'on';
176
+ return true;
177
+ }
178
+ return false;
179
+ }
180
+ /**
181
+ * Turn outlet off
182
+ */
183
+ async turnOff() {
184
+ const body = {
185
+ ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
186
+ uuid: this.uuid,
187
+ status: 'off',
188
+ switchNo: 1
189
+ };
190
+ const [response] = await helpers_1.Helpers.callApi('/outdoorsocket15a/v1/device/devicestatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
191
+ if (response?.code === 0) {
192
+ this.deviceStatus = 'off';
193
+ return true;
194
+ }
195
+ return false;
196
+ }
197
+ }
198
+ exports.VeSyncOutdoorPlug = VeSyncOutdoorPlug;
199
+ // Export outlet modules dictionary
200
+ exports.outletModules = {
201
+ 'wifi-switch-1.3': VeSyncOutlet7A,
202
+ 'ESW03-USA': VeSyncOutlet10A,
203
+ 'ESW01-EU': VeSyncOutlet10A,
204
+ 'ESW15-USA': VeSyncOutlet15A,
205
+ 'ESO15-TB': VeSyncOutdoorPlug
206
+ };
@@ -0,0 +1,169 @@
1
+ /**
2
+ * VeSync Switch Classes
3
+ */
4
+ import { VeSyncBaseDevice } from './vesyncBaseDevice';
5
+ import { VeSync } from './vesync';
6
+ type DeviceConstructor = new (config: Record<string, any>, manager: VeSync) => VeSyncBaseDevice;
7
+ interface SwitchConfig {
8
+ [key: string]: {
9
+ module: string;
10
+ features: string[];
11
+ };
12
+ }
13
+ export declare const switchConfig: SwitchConfig;
14
+ /**
15
+ * Base class for VeSync Switches
16
+ */
17
+ export declare abstract class VeSyncSwitch extends VeSyncBaseDevice {
18
+ protected details: Record<string, any>;
19
+ protected features: string[];
20
+ constructor(details: Record<string, any>, manager: VeSync);
21
+ /**
22
+ * Get active time of switch
23
+ */
24
+ get activeTime(): number;
25
+ /**
26
+ * Return true if switch is dimmable
27
+ */
28
+ isDimmable(): boolean;
29
+ /**
30
+ * Return formatted device info to stdout
31
+ */
32
+ display(): void;
33
+ /**
34
+ * Return JSON details for switch
35
+ */
36
+ displayJSON(): string;
37
+ abstract getDetails(): Promise<void>;
38
+ abstract getConfig(): Promise<void>;
39
+ abstract turnOn(): Promise<boolean>;
40
+ abstract turnOff(): Promise<boolean>;
41
+ /**
42
+ * Update device details
43
+ */
44
+ update(): Promise<void>;
45
+ }
46
+ /**
47
+ * VeSync Wall Switch
48
+ */
49
+ export declare class VeSyncWallSwitch extends VeSyncSwitch {
50
+ constructor(details: Record<string, any>, manager: VeSync);
51
+ /**
52
+ * Get wall switch details
53
+ */
54
+ getDetails(): Promise<void>;
55
+ /**
56
+ * Get switch device configuration info
57
+ */
58
+ getConfig(): Promise<void>;
59
+ /**
60
+ * Turn off wall switch
61
+ */
62
+ turnOff(): Promise<boolean>;
63
+ /**
64
+ * Turn on wall switch
65
+ */
66
+ turnOn(): Promise<boolean>;
67
+ }
68
+ /**
69
+ * VeSync Dimmer Switch
70
+ */
71
+ export declare class VeSyncDimmerSwitch extends VeSyncSwitch {
72
+ private _brightness;
73
+ private _rgbValue;
74
+ private _rgbStatus;
75
+ private _indicatorLight;
76
+ constructor(details: Record<string, any>, manager: VeSync);
77
+ /**
78
+ * Get dimmer switch details
79
+ */
80
+ getDetails(): Promise<void>;
81
+ /**
82
+ * Get dimmer switch configuration info
83
+ */
84
+ getConfig(): Promise<void>;
85
+ /**
86
+ * Turn off dimmer switch
87
+ */
88
+ turnOff(): Promise<boolean>;
89
+ /**
90
+ * Turn on dimmer switch
91
+ */
92
+ turnOn(): Promise<boolean>;
93
+ /**
94
+ * Return brightness in percent
95
+ */
96
+ get brightness(): number;
97
+ /**
98
+ * Return faceplate brightness light status
99
+ */
100
+ get indicatorLightStatus(): string;
101
+ /**
102
+ * Return RGB faceplate light status
103
+ */
104
+ get rgbLightStatus(): string;
105
+ /**
106
+ * Return RGB light values
107
+ */
108
+ get rgbLightValue(): Record<string, number>;
109
+ /**
110
+ * Update device details
111
+ */
112
+ update(): Promise<void>;
113
+ /**
114
+ * Display device info
115
+ */
116
+ display(): void;
117
+ /**
118
+ * Return JSON details for dimmer switch
119
+ */
120
+ displayJSON(): string;
121
+ /**
122
+ * Set brightness level
123
+ * @param brightness - Brightness level (1-100)
124
+ */
125
+ setBrightness(brightness: number): Promise<boolean>;
126
+ /**
127
+ * Toggle indicator light status
128
+ * @param status - Light status ('on' or 'off')
129
+ */
130
+ indicatorLightToggle(status: string): Promise<boolean>;
131
+ /**
132
+ * Set RGB color values
133
+ * @param red - Red value (0-255)
134
+ * @param green - Green value (0-255)
135
+ * @param blue - Blue value (0-255)
136
+ */
137
+ rgbColorSet(red: number, green: number, blue: number): Promise<boolean>;
138
+ /**
139
+ * Toggle switch status
140
+ * @param status - Switch status ('on' or 'off')
141
+ */
142
+ switchToggle(status: string): Promise<boolean>;
143
+ /**
144
+ * Set faceplate RGB color status and optionally set RGB values
145
+ * @param status - RGB status ('on' or 'off')
146
+ * @param red - Optional red value (0-255)
147
+ * @param green - Optional green value (0-255)
148
+ * @param blue - Optional blue value (0-255)
149
+ */
150
+ rgbColorStatus(status: string, red?: number, green?: number, blue?: number): Promise<boolean>;
151
+ /**
152
+ * Turn RGB Color Off
153
+ */
154
+ rgbColorOff(): Promise<boolean>;
155
+ /**
156
+ * Turn RGB Color On
157
+ */
158
+ rgbColorOn(): Promise<boolean>;
159
+ /**
160
+ * Turn indicator light on
161
+ */
162
+ indicatorLightOn(): Promise<boolean>;
163
+ /**
164
+ * Turn indicator light off
165
+ */
166
+ indicatorLightOff(): Promise<boolean>;
167
+ }
168
+ export declare const switchModules: Record<string, DeviceConstructor>;
169
+ export {};