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,643 @@
1
+ "use strict";
2
+ /**
3
+ * VeSync Fan Implementations
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fanModules = exports.VeSyncWarmHumidifier = exports.VeSyncHumidifier = exports.VeSyncAirBypass = void 0;
7
+ const vesyncFan_1 = require("./vesyncFan");
8
+ const helpers_1 = require("./helpers");
9
+ /**
10
+ * VeSync Air Purifier with Bypass
11
+ */
12
+ class VeSyncAirBypass extends vesyncFan_1.VeSyncFan {
13
+ constructor(details, manager) {
14
+ super(details, manager);
15
+ this.modes = ['auto', 'manual', 'sleep'];
16
+ this.speeds = [1, 2, 3, 4, 5];
17
+ this.displayModes = ['on', 'off'];
18
+ this.childLockModes = ['on', 'off'];
19
+ }
20
+ /**
21
+ * Get device details
22
+ */
23
+ async getDetails() {
24
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
25
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
26
+ cid: this.cid,
27
+ configModule: this.configModule,
28
+ payload: {
29
+ data: {},
30
+ method: 'getPurifierStatus',
31
+ source: 'APP'
32
+ }
33
+ }, helpers_1.Helpers.reqHeaderBypass());
34
+ if (this.checkResponse([response, status], 'getDetails')) {
35
+ const result = response?.result?.result;
36
+ if (result) {
37
+ // Update device status
38
+ this.deviceStatus = result.enabled ? 'on' : 'off';
39
+ // Store device settings
40
+ this.details = {
41
+ mode: result.mode || '',
42
+ speed: result.level || 0,
43
+ filterLife: result.filter_life || 0,
44
+ screenStatus: result.display || false,
45
+ childLock: result.child_lock || false,
46
+ airQuality: result.air_quality || 0
47
+ };
48
+ // Store configuration if available
49
+ if (result.configuration) {
50
+ this.config = result.configuration;
51
+ }
52
+ }
53
+ }
54
+ }
55
+ /**
56
+ * Turn device on
57
+ */
58
+ async turnOn() {
59
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
60
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
61
+ cid: this.cid,
62
+ configModule: this.configModule,
63
+ payload: {
64
+ data: {
65
+ enabled: true,
66
+ id: 0
67
+ },
68
+ method: 'setSwitch',
69
+ source: 'APP'
70
+ }
71
+ }, helpers_1.Helpers.reqHeaderBypass());
72
+ return this.checkResponse([response, status], 'turnOn');
73
+ }
74
+ /**
75
+ * Turn device off
76
+ */
77
+ async turnOff() {
78
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
79
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
80
+ cid: this.cid,
81
+ configModule: this.configModule,
82
+ payload: {
83
+ data: {
84
+ enabled: false,
85
+ id: 0
86
+ },
87
+ method: 'setSwitch',
88
+ source: 'APP'
89
+ }
90
+ }, helpers_1.Helpers.reqHeaderBypass());
91
+ return this.checkResponse([response, status], 'turnOff');
92
+ }
93
+ /**
94
+ * Change fan speed
95
+ */
96
+ async changeFanSpeed(speed) {
97
+ if (!this.speeds.includes(speed)) {
98
+ throw new Error(`Invalid speed: ${speed}. Must be one of: ${this.speeds.join(', ')}`);
99
+ }
100
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
101
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
102
+ cid: this.cid,
103
+ configModule: this.configModule,
104
+ payload: {
105
+ data: {
106
+ id: 0,
107
+ level: speed,
108
+ mode: 'manual',
109
+ type: 'wind'
110
+ },
111
+ method: 'setLevel',
112
+ source: 'APP'
113
+ }
114
+ }, helpers_1.Helpers.reqHeaderBypass());
115
+ return this.checkResponse([response, status], 'changeFanSpeed');
116
+ }
117
+ /**
118
+ * Set device mode
119
+ */
120
+ async setMode(mode) {
121
+ if (!this.modes.includes(mode)) {
122
+ throw new Error(`Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`);
123
+ }
124
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
125
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
126
+ cid: this.cid,
127
+ configModule: this.configModule,
128
+ payload: {
129
+ data: {
130
+ mode
131
+ },
132
+ method: 'setPurifierMode',
133
+ source: 'APP'
134
+ }
135
+ }, helpers_1.Helpers.reqHeaderBypass());
136
+ return this.checkResponse([response, status], 'setMode');
137
+ }
138
+ /**
139
+ * Set display status
140
+ */
141
+ async setDisplay(enabled) {
142
+ if (!this.hasFeature('display')) {
143
+ throw new Error('Display control not supported');
144
+ }
145
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
146
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
147
+ cid: this.cid,
148
+ configModule: this.configModule,
149
+ payload: {
150
+ data: {
151
+ state: enabled
152
+ },
153
+ method: 'setDisplay',
154
+ source: 'APP'
155
+ }
156
+ }, helpers_1.Helpers.reqHeaderBypass());
157
+ return this.checkResponse([response, status], 'setDisplay');
158
+ }
159
+ /**
160
+ * Set child lock
161
+ */
162
+ async setChildLock(enabled) {
163
+ if (!this.hasFeature('child_lock')) {
164
+ throw new Error('Child lock not supported');
165
+ }
166
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
167
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
168
+ cid: this.cid,
169
+ configModule: this.configModule,
170
+ payload: {
171
+ data: {
172
+ state: enabled
173
+ },
174
+ method: 'setChildLock',
175
+ source: 'APP'
176
+ }
177
+ }, helpers_1.Helpers.reqHeaderBypass());
178
+ return this.checkResponse([response, status], 'setChildLock');
179
+ }
180
+ /**
181
+ * Set timer
182
+ */
183
+ async setTimer(hours) {
184
+ if (!this.hasFeature('timer')) {
185
+ throw new Error('Timer not supported');
186
+ }
187
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
188
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
189
+ cid: this.cid,
190
+ configModule: this.configModule,
191
+ payload: {
192
+ data: {
193
+ action: 'off',
194
+ total: hours * 3600
195
+ },
196
+ method: 'addTimer',
197
+ source: 'APP'
198
+ }
199
+ }, helpers_1.Helpers.reqHeaderBypass());
200
+ return this.checkResponse([response, status], 'setTimer');
201
+ }
202
+ /**
203
+ * Clear timer
204
+ */
205
+ async clearTimer() {
206
+ if (!this.hasFeature('timer')) {
207
+ throw new Error('Timer not supported');
208
+ }
209
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
210
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
211
+ cid: this.cid,
212
+ configModule: this.configModule,
213
+ payload: {
214
+ data: {},
215
+ method: 'deleteTimer',
216
+ source: 'APP'
217
+ }
218
+ }, helpers_1.Helpers.reqHeaderBypass());
219
+ return this.checkResponse([response, status], 'clearTimer');
220
+ }
221
+ /**
222
+ * Turn automatic stop on
223
+ */
224
+ async automaticStopOn() {
225
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
226
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
227
+ cid: this.cid,
228
+ configModule: this.configModule,
229
+ payload: {
230
+ data: {
231
+ enabled: true
232
+ },
233
+ method: 'setAutomaticStop',
234
+ source: 'APP'
235
+ }
236
+ }, helpers_1.Helpers.reqHeaderBypass());
237
+ return this.checkResponse([response, status], 'automaticStopOn');
238
+ }
239
+ /**
240
+ * Turn automatic stop off
241
+ */
242
+ async automaticStopOff() {
243
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
244
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
245
+ cid: this.cid,
246
+ configModule: this.configModule,
247
+ payload: {
248
+ data: {
249
+ enabled: false
250
+ },
251
+ method: 'setAutomaticStop',
252
+ source: 'APP'
253
+ }
254
+ }, helpers_1.Helpers.reqHeaderBypass());
255
+ return this.checkResponse([response, status], 'automaticStopOff');
256
+ }
257
+ }
258
+ exports.VeSyncAirBypass = VeSyncAirBypass;
259
+ /**
260
+ * VeSync Humidifier Base Class
261
+ */
262
+ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
263
+ constructor(details, manager) {
264
+ super(details, manager);
265
+ this.modes = ['auto', 'manual', 'sleep'];
266
+ this.speeds = [1, 2, 3];
267
+ this.displayModes = ['on', 'off'];
268
+ this.mistLevels = [1, 2, 3];
269
+ this.humidityRange = { min: 30, max: 80 };
270
+ }
271
+ /**
272
+ * Get device details
273
+ */
274
+ async getDetails() {
275
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
276
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
277
+ cid: this.cid,
278
+ configModule: this.configModule,
279
+ payload: {
280
+ data: {},
281
+ method: 'getHumidifierStatus',
282
+ source: 'APP'
283
+ }
284
+ }, helpers_1.Helpers.reqHeaderBypass());
285
+ if (this.checkResponse([response, status], 'getDetails')) {
286
+ this.details = response.result.result;
287
+ }
288
+ }
289
+ /**
290
+ * Turn device on
291
+ */
292
+ async turnOn() {
293
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
294
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
295
+ cid: this.cid,
296
+ configModule: this.configModule,
297
+ payload: {
298
+ data: {
299
+ enabled: true,
300
+ id: 0
301
+ },
302
+ method: 'setSwitch',
303
+ source: 'APP'
304
+ }
305
+ }, helpers_1.Helpers.reqHeaderBypass());
306
+ return this.checkResponse([response, status], 'turnOn');
307
+ }
308
+ /**
309
+ * Turn device off
310
+ */
311
+ async turnOff() {
312
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
313
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
314
+ cid: this.cid,
315
+ configModule: this.configModule,
316
+ payload: {
317
+ data: {
318
+ enabled: false,
319
+ id: 0
320
+ },
321
+ method: 'setSwitch',
322
+ source: 'APP'
323
+ }
324
+ }, helpers_1.Helpers.reqHeaderBypass());
325
+ return this.checkResponse([response, status], 'turnOff');
326
+ }
327
+ /**
328
+ * Change fan speed
329
+ */
330
+ async changeFanSpeed(speed) {
331
+ if (!this.speeds.includes(speed)) {
332
+ throw new Error(`Invalid speed: ${speed}. Must be one of: ${this.speeds.join(', ')}`);
333
+ }
334
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
335
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
336
+ cid: this.cid,
337
+ configModule: this.configModule,
338
+ payload: {
339
+ data: {
340
+ id: 0,
341
+ level: speed,
342
+ type: 'wind'
343
+ },
344
+ method: 'setLevel',
345
+ source: 'APP'
346
+ }
347
+ }, helpers_1.Helpers.reqHeaderBypass());
348
+ return this.checkResponse([response, status], 'changeFanSpeed');
349
+ }
350
+ /**
351
+ * Set device mode
352
+ */
353
+ async setMode(mode) {
354
+ if (!this.modes.includes(mode)) {
355
+ throw new Error(`Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`);
356
+ }
357
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
358
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
359
+ cid: this.cid,
360
+ configModule: this.configModule,
361
+ payload: {
362
+ data: {
363
+ mode
364
+ },
365
+ method: 'setHumidifierMode',
366
+ source: 'APP'
367
+ }
368
+ }, helpers_1.Helpers.reqHeaderBypass());
369
+ return this.checkResponse([response, status], 'setMode');
370
+ }
371
+ /**
372
+ * Set mist level
373
+ */
374
+ async setMistLevel(level) {
375
+ if (!this.hasFeature('mist')) {
376
+ throw new Error('Mist control not supported');
377
+ }
378
+ if (!this.mistLevels.includes(level)) {
379
+ throw new Error(`Invalid mist level: ${level}. Must be one of: ${this.mistLevels.join(', ')}`);
380
+ }
381
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
382
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
383
+ cid: this.cid,
384
+ configModule: this.configModule,
385
+ payload: {
386
+ data: {
387
+ mistLevel: level
388
+ },
389
+ method: 'setMistLevel',
390
+ source: 'APP'
391
+ }
392
+ }, helpers_1.Helpers.reqHeaderBypass());
393
+ return this.checkResponse([response, status], 'setMistLevel');
394
+ }
395
+ /**
396
+ * Set target humidity
397
+ */
398
+ async setHumidity(humidity) {
399
+ if (!this.hasFeature('humidity')) {
400
+ throw new Error('Humidity control not supported');
401
+ }
402
+ if (humidity < this.humidityRange.min || humidity > this.humidityRange.max) {
403
+ throw new Error(`Invalid humidity: ${humidity}. Must be between ${this.humidityRange.min} and ${this.humidityRange.max}`);
404
+ }
405
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
406
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
407
+ cid: this.cid,
408
+ configModule: this.configModule,
409
+ payload: {
410
+ data: {
411
+ targetHumidity: humidity
412
+ },
413
+ method: 'setTargetHumidity',
414
+ source: 'APP'
415
+ }
416
+ }, helpers_1.Helpers.reqHeaderBypass());
417
+ return this.checkResponse([response, status], 'setHumidity');
418
+ }
419
+ /**
420
+ * Set display status
421
+ */
422
+ async setDisplay(enabled) {
423
+ if (!this.hasFeature('display')) {
424
+ throw new Error('Display control not supported');
425
+ }
426
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
427
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
428
+ cid: this.cid,
429
+ configModule: this.configModule,
430
+ payload: {
431
+ data: {
432
+ state: enabled
433
+ },
434
+ method: 'setDisplay',
435
+ source: 'APP'
436
+ }
437
+ }, helpers_1.Helpers.reqHeaderBypass());
438
+ return this.checkResponse([response, status], 'setDisplay');
439
+ }
440
+ /**
441
+ * Set timer
442
+ */
443
+ async setTimer(hours) {
444
+ if (!this.hasFeature('timer')) {
445
+ throw new Error('Timer not supported');
446
+ }
447
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
448
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
449
+ cid: this.cid,
450
+ configModule: this.configModule,
451
+ payload: {
452
+ data: {
453
+ action: 'off',
454
+ total: hours * 3600
455
+ },
456
+ method: 'addTimer',
457
+ source: 'APP'
458
+ }
459
+ }, helpers_1.Helpers.reqHeaderBypass());
460
+ return this.checkResponse([response, status], 'setTimer');
461
+ }
462
+ /**
463
+ * Clear timer
464
+ */
465
+ async clearTimer() {
466
+ if (!this.hasFeature('timer')) {
467
+ throw new Error('Timer not supported');
468
+ }
469
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
470
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
471
+ cid: this.cid,
472
+ configModule: this.configModule,
473
+ payload: {
474
+ data: {},
475
+ method: 'deleteTimer',
476
+ source: 'APP'
477
+ }
478
+ }, helpers_1.Helpers.reqHeaderBypass());
479
+ return this.checkResponse([response, status], 'clearTimer');
480
+ }
481
+ /**
482
+ * Turn automatic stop on
483
+ */
484
+ async automaticStopOn() {
485
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
486
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
487
+ cid: this.cid,
488
+ configModule: this.configModule,
489
+ payload: {
490
+ data: {
491
+ enabled: true
492
+ },
493
+ method: 'setAutomaticStop',
494
+ source: 'APP'
495
+ }
496
+ }, helpers_1.Helpers.reqHeaderBypass());
497
+ return this.checkResponse([response, status], 'automaticStopOn');
498
+ }
499
+ /**
500
+ * Turn automatic stop off
501
+ */
502
+ async automaticStopOff() {
503
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
504
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
505
+ cid: this.cid,
506
+ configModule: this.configModule,
507
+ payload: {
508
+ data: {
509
+ enabled: false
510
+ },
511
+ method: 'setAutomaticStop',
512
+ source: 'APP'
513
+ }
514
+ }, helpers_1.Helpers.reqHeaderBypass());
515
+ return this.checkResponse([response, status], 'automaticStopOff');
516
+ }
517
+ }
518
+ exports.VeSyncHumidifier = VeSyncHumidifier;
519
+ /**
520
+ * VeSync Warm Humidifier Class
521
+ */
522
+ class VeSyncWarmHumidifier extends VeSyncHumidifier {
523
+ constructor(details, manager) {
524
+ super(details, manager);
525
+ this.warmLevels = [1, 2, 3];
526
+ }
527
+ /**
528
+ * Set warm mist level
529
+ */
530
+ async setWarmLevel(level) {
531
+ if (!this.hasFeature('warm')) {
532
+ throw new Error('Warm mist control not supported');
533
+ }
534
+ if (!this.warmLevels.includes(level)) {
535
+ throw new Error(`Invalid warm level: ${level}. Must be one of: ${this.warmLevels.join(', ')}`);
536
+ }
537
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
538
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
539
+ cid: this.cid,
540
+ configModule: this.configModule,
541
+ payload: {
542
+ data: {
543
+ warmLevel: level
544
+ },
545
+ method: 'setWarmLevel',
546
+ source: 'APP'
547
+ }
548
+ }, helpers_1.Helpers.reqHeaderBypass());
549
+ return this.checkResponse([response, status], 'setWarmLevel');
550
+ }
551
+ /**
552
+ * Set drying mode enabled
553
+ */
554
+ async setDryingModeEnabled(enabled) {
555
+ if (!this.hasFeature('drying')) {
556
+ throw new Error('Drying mode not supported');
557
+ }
558
+ const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
559
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
560
+ cid: this.cid,
561
+ configModule: this.configModule,
562
+ payload: {
563
+ data: {
564
+ autoDryingSwitch: enabled ? 1 : 0
565
+ },
566
+ method: 'setDryingMode',
567
+ source: 'APP'
568
+ }
569
+ }, helpers_1.Helpers.reqHeaderBypass());
570
+ return this.checkResponse([response, status], 'setDryingModeEnabled');
571
+ }
572
+ }
573
+ exports.VeSyncWarmHumidifier = VeSyncWarmHumidifier;
574
+ // Export fan modules dictionary
575
+ exports.fanModules = {
576
+ // Core Series
577
+ 'Core200S': VeSyncAirBypass,
578
+ 'Core300S': VeSyncAirBypass,
579
+ 'Core400S': VeSyncAirBypass,
580
+ 'Core600S': VeSyncAirBypass,
581
+ // LAP Series
582
+ 'LAP-C201S-AUSR': VeSyncAirBypass,
583
+ 'LAP-C202S-WUSR': VeSyncAirBypass,
584
+ 'LAP-C301S-WJP': VeSyncAirBypass,
585
+ 'LAP-C302S-WUSB': VeSyncAirBypass,
586
+ 'LAP-C301S-WAAA': VeSyncAirBypass,
587
+ 'LAP-C401S-WJP': VeSyncAirBypass,
588
+ 'LAP-C401S-WUSR': VeSyncAirBypass,
589
+ 'LAP-C401S-WAAA': VeSyncAirBypass,
590
+ 'LAP-C601S-WUS': VeSyncAirBypass,
591
+ 'LAP-C601S-WUSR': VeSyncAirBypass,
592
+ 'LAP-C601S-WEU': VeSyncAirBypass,
593
+ 'LAP-V102S-AASR': VeSyncAirBypass,
594
+ 'LAP-V102S-WUS': VeSyncAirBypass,
595
+ 'LAP-V102S-WEU': VeSyncAirBypass,
596
+ 'LAP-V102S-AUSR': VeSyncAirBypass,
597
+ 'LAP-V102S-WJP': VeSyncAirBypass,
598
+ 'LAP-V201S-AASR': VeSyncAirBypass,
599
+ 'LAP-V201S-WJP': VeSyncAirBypass,
600
+ 'LAP-V201S-WEU': VeSyncAirBypass,
601
+ 'LAP-V201S-WUS': VeSyncAirBypass,
602
+ 'LAP-V201-AUSR': VeSyncAirBypass,
603
+ 'LAP-V201S-AUSR': VeSyncAirBypass,
604
+ 'LAP-V201S-AEUR': VeSyncAirBypass,
605
+ 'LAP-EL551S-AUS': VeSyncAirBypass,
606
+ 'LAP-EL551S-AEUR': VeSyncAirBypass,
607
+ 'LAP-EL551S-WEU': VeSyncAirBypass,
608
+ 'LAP-EL551S-WUS': VeSyncAirBypass,
609
+ // LTF Series
610
+ 'LTF-F422S-KEU': VeSyncAirBypass,
611
+ 'LTF-F422S-WUSR': VeSyncAirBypass,
612
+ 'LTF-F422_WJP': VeSyncAirBypass,
613
+ 'LTF-F422S-WUS': VeSyncAirBypass,
614
+ // Classic Series
615
+ 'Classic300S': VeSyncHumidifier,
616
+ 'Classic200S': VeSyncHumidifier,
617
+ // Dual Series
618
+ 'Dual200S': VeSyncHumidifier,
619
+ // LUH Series
620
+ 'LUH-A601S-WUSB': VeSyncWarmHumidifier,
621
+ 'LUH-A601S-AUSW': VeSyncWarmHumidifier,
622
+ 'LUH-D301S-WUSR': VeSyncWarmHumidifier,
623
+ 'LUH-D301S-WJP': VeSyncWarmHumidifier,
624
+ 'LUH-D301S-WEU': VeSyncWarmHumidifier,
625
+ 'LUH-A602S-WUSR': VeSyncWarmHumidifier,
626
+ 'LUH-A602S-WUS': VeSyncWarmHumidifier,
627
+ 'LUH-A602S-WEUR': VeSyncWarmHumidifier,
628
+ 'LUH-A602S-WEU': VeSyncWarmHumidifier,
629
+ 'LUH-A602S-WJP': VeSyncWarmHumidifier,
630
+ 'LUH-A602S-WUSC': VeSyncWarmHumidifier,
631
+ 'LUH-O451S-WEU': VeSyncWarmHumidifier,
632
+ 'LUH-O451S-WUS': VeSyncWarmHumidifier,
633
+ 'LUH-O451S-WUSR': VeSyncWarmHumidifier,
634
+ 'LUH-O601S-WUS': VeSyncWarmHumidifier,
635
+ 'LUH-O601S-KUS': VeSyncWarmHumidifier,
636
+ 'LUH-M101S-WUS': VeSyncWarmHumidifier,
637
+ // LEH Series
638
+ 'LEH-S601S-WUS': VeSyncWarmHumidifier,
639
+ 'LEH-S601S-WUSR': VeSyncWarmHumidifier,
640
+ // LV Series
641
+ 'LV-PUR131S': VeSyncAirBypass,
642
+ 'LV-RH131S': VeSyncAirBypass
643
+ };
@@ -0,0 +1,53 @@
1
+ /**
2
+ * VeSync Outlets
3
+ */
4
+ import { VeSyncBaseDevice } from './vesyncBaseDevice';
5
+ import { VeSync } from './vesync';
6
+ /**
7
+ * VeSync Outlet Base Class
8
+ */
9
+ export declare abstract class VeSyncOutlet extends VeSyncBaseDevice {
10
+ protected energy: Record<string, any>;
11
+ protected details: Record<string, any>;
12
+ constructor(details: Record<string, any>, manager: VeSync);
13
+ /**
14
+ * Get outlet details
15
+ */
16
+ getDetails(): Promise<void>;
17
+ /**
18
+ * Update outlet energy data
19
+ */
20
+ updateEnergy(): Promise<void>;
21
+ /**
22
+ * Get outlet energy usage
23
+ */
24
+ getEnergyUsage(): Promise<Record<string, any>>;
25
+ /**
26
+ * Get outlet status
27
+ */
28
+ getStatus(): Promise<string>;
29
+ /**
30
+ * Get weekly energy data
31
+ */
32
+ getWeeklyEnergy(): Promise<void>;
33
+ /**
34
+ * Get monthly energy data
35
+ */
36
+ getMonthlyEnergy(): Promise<void>;
37
+ /**
38
+ * Get yearly energy data
39
+ */
40
+ getYearlyEnergy(): Promise<void>;
41
+ /**
42
+ * Update outlet details and energy info
43
+ */
44
+ update(): Promise<void>;
45
+ /**
46
+ * Turn outlet on
47
+ */
48
+ abstract turnOn(): Promise<boolean>;
49
+ /**
50
+ * Turn outlet off
51
+ */
52
+ abstract turnOff(): Promise<boolean>;
53
+ }