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
|
@@ -0,0 +1,909 @@
|
|
|
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
|
+
const logger_1 = require("./logger");
|
|
10
|
+
/**
|
|
11
|
+
* VeSync Air Purifier with Bypass
|
|
12
|
+
*/
|
|
13
|
+
class VeSyncAirBypass extends vesyncFan_1.VeSyncFan {
|
|
14
|
+
constructor(details, manager) {
|
|
15
|
+
super(details, manager);
|
|
16
|
+
this.modes = ['auto', 'manual', 'sleep'];
|
|
17
|
+
this.speeds = [1, 2, 3, 4, 5];
|
|
18
|
+
this.displayModes = ['on', 'off'];
|
|
19
|
+
this.childLockModes = ['on', 'off'];
|
|
20
|
+
logger_1.logger.debug(`Initialized VeSyncAirBypass device: ${this.deviceName}`);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get device details
|
|
24
|
+
*/
|
|
25
|
+
async getDetails() {
|
|
26
|
+
var _a;
|
|
27
|
+
logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
|
|
28
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
29
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
30
|
+
cid: this.cid,
|
|
31
|
+
configModule: this.configModule,
|
|
32
|
+
payload: {
|
|
33
|
+
data: {},
|
|
34
|
+
method: 'getPurifierStatus',
|
|
35
|
+
source: 'APP'
|
|
36
|
+
}
|
|
37
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
38
|
+
if (this.checkResponse([response, status], 'getDetails')) {
|
|
39
|
+
const result = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.result;
|
|
40
|
+
if (result) {
|
|
41
|
+
// Update device status
|
|
42
|
+
this.deviceStatus = result.enabled ? 'on' : 'off';
|
|
43
|
+
// Store device settings
|
|
44
|
+
this.details = {
|
|
45
|
+
mode: result.mode || '',
|
|
46
|
+
speed: result.level || 0,
|
|
47
|
+
filterLife: result.filter_life || 0,
|
|
48
|
+
screenStatus: result.display || false,
|
|
49
|
+
childLock: result.child_lock || false,
|
|
50
|
+
airQuality: result.air_quality || 0
|
|
51
|
+
};
|
|
52
|
+
// Store configuration if available
|
|
53
|
+
if (result.configuration) {
|
|
54
|
+
this.config = result.configuration;
|
|
55
|
+
}
|
|
56
|
+
logger_1.logger.debug(`Successfully got details for device: ${this.deviceName}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
logger_1.logger.error(`Failed to get details for device: ${this.deviceName}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Turn device on
|
|
65
|
+
*/
|
|
66
|
+
async turnOn() {
|
|
67
|
+
logger_1.logger.debug(`Turning on device: ${this.deviceName}`);
|
|
68
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
69
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
70
|
+
cid: this.cid,
|
|
71
|
+
configModule: this.configModule,
|
|
72
|
+
payload: {
|
|
73
|
+
data: {
|
|
74
|
+
enabled: true,
|
|
75
|
+
id: 0
|
|
76
|
+
},
|
|
77
|
+
method: 'setSwitch',
|
|
78
|
+
source: 'APP'
|
|
79
|
+
}
|
|
80
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
81
|
+
const success = this.checkResponse([response, status], 'turnOn');
|
|
82
|
+
if (!success) {
|
|
83
|
+
logger_1.logger.error(`Failed to turn on device: ${this.deviceName}`);
|
|
84
|
+
}
|
|
85
|
+
return success;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Turn device off
|
|
89
|
+
*/
|
|
90
|
+
async turnOff() {
|
|
91
|
+
logger_1.logger.debug(`Turning off device: ${this.deviceName}`);
|
|
92
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
93
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
94
|
+
cid: this.cid,
|
|
95
|
+
configModule: this.configModule,
|
|
96
|
+
payload: {
|
|
97
|
+
data: {
|
|
98
|
+
enabled: false,
|
|
99
|
+
id: 0
|
|
100
|
+
},
|
|
101
|
+
method: 'setSwitch',
|
|
102
|
+
source: 'APP'
|
|
103
|
+
}
|
|
104
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
105
|
+
const success = this.checkResponse([response, status], 'turnOff');
|
|
106
|
+
if (!success) {
|
|
107
|
+
logger_1.logger.error(`Failed to turn off device: ${this.deviceName}`);
|
|
108
|
+
}
|
|
109
|
+
return success;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Change fan speed
|
|
113
|
+
*/
|
|
114
|
+
async changeFanSpeed(speed) {
|
|
115
|
+
if (!this.speeds.includes(speed)) {
|
|
116
|
+
const error = `Invalid speed: ${speed}. Must be one of: ${this.speeds.join(', ')}`;
|
|
117
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
118
|
+
throw new Error(error);
|
|
119
|
+
}
|
|
120
|
+
logger_1.logger.debug(`Changing fan speed to ${speed} for device: ${this.deviceName}`);
|
|
121
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
122
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
123
|
+
cid: this.cid,
|
|
124
|
+
configModule: this.configModule,
|
|
125
|
+
payload: {
|
|
126
|
+
data: {
|
|
127
|
+
id: 0,
|
|
128
|
+
level: speed,
|
|
129
|
+
mode: 'manual',
|
|
130
|
+
type: 'wind'
|
|
131
|
+
},
|
|
132
|
+
method: 'setLevel',
|
|
133
|
+
source: 'APP'
|
|
134
|
+
}
|
|
135
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
136
|
+
const success = this.checkResponse([response, status], 'changeFanSpeed');
|
|
137
|
+
if (!success) {
|
|
138
|
+
logger_1.logger.error(`Failed to change fan speed to ${speed} for device: ${this.deviceName}`);
|
|
139
|
+
}
|
|
140
|
+
return success;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Set device mode
|
|
144
|
+
*/
|
|
145
|
+
async setMode(mode) {
|
|
146
|
+
if (!this.modes.includes(mode)) {
|
|
147
|
+
const error = `Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`;
|
|
148
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
149
|
+
throw new Error(error);
|
|
150
|
+
}
|
|
151
|
+
logger_1.logger.debug(`Setting mode to ${mode} for device: ${this.deviceName}`);
|
|
152
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
153
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
154
|
+
cid: this.cid,
|
|
155
|
+
configModule: this.configModule,
|
|
156
|
+
payload: {
|
|
157
|
+
data: {
|
|
158
|
+
mode
|
|
159
|
+
},
|
|
160
|
+
method: 'setPurifierMode',
|
|
161
|
+
source: 'APP'
|
|
162
|
+
}
|
|
163
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
164
|
+
const success = this.checkResponse([response, status], 'setMode');
|
|
165
|
+
if (!success) {
|
|
166
|
+
logger_1.logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
|
|
167
|
+
}
|
|
168
|
+
return success;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Set display status
|
|
172
|
+
*/
|
|
173
|
+
async setDisplay(enabled) {
|
|
174
|
+
if (!this.hasFeature('display')) {
|
|
175
|
+
const error = 'Display control not supported';
|
|
176
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
177
|
+
throw new Error(error);
|
|
178
|
+
}
|
|
179
|
+
logger_1.logger.debug(`Setting display to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
180
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
181
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
182
|
+
cid: this.cid,
|
|
183
|
+
configModule: this.configModule,
|
|
184
|
+
payload: {
|
|
185
|
+
data: {
|
|
186
|
+
state: enabled
|
|
187
|
+
},
|
|
188
|
+
method: 'setDisplay',
|
|
189
|
+
source: 'APP'
|
|
190
|
+
}
|
|
191
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
192
|
+
const success = this.checkResponse([response, status], 'setDisplay');
|
|
193
|
+
if (!success) {
|
|
194
|
+
logger_1.logger.error(`Failed to set display to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
195
|
+
}
|
|
196
|
+
return success;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Set child lock
|
|
200
|
+
*/
|
|
201
|
+
async setChildLock(enabled) {
|
|
202
|
+
if (!this.hasFeature('child_lock')) {
|
|
203
|
+
const error = 'Child lock not supported';
|
|
204
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
205
|
+
throw new Error(error);
|
|
206
|
+
}
|
|
207
|
+
logger_1.logger.debug(`Setting child lock to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
208
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
209
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
210
|
+
cid: this.cid,
|
|
211
|
+
configModule: this.configModule,
|
|
212
|
+
payload: {
|
|
213
|
+
data: {
|
|
214
|
+
state: enabled
|
|
215
|
+
},
|
|
216
|
+
method: 'setChildLock',
|
|
217
|
+
source: 'APP'
|
|
218
|
+
}
|
|
219
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
220
|
+
const success = this.checkResponse([response, status], 'setChildLock');
|
|
221
|
+
if (!success) {
|
|
222
|
+
logger_1.logger.error(`Failed to set child lock to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
223
|
+
}
|
|
224
|
+
return success;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Set timer
|
|
228
|
+
*/
|
|
229
|
+
async setTimer(hours) {
|
|
230
|
+
if (!this.hasFeature('timer')) {
|
|
231
|
+
const error = 'Timer not supported';
|
|
232
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
233
|
+
throw new Error(error);
|
|
234
|
+
}
|
|
235
|
+
logger_1.logger.debug(`Setting timer to ${hours} hours for device: ${this.deviceName}`);
|
|
236
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
237
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
238
|
+
cid: this.cid,
|
|
239
|
+
configModule: this.configModule,
|
|
240
|
+
payload: {
|
|
241
|
+
data: {
|
|
242
|
+
action: 'off',
|
|
243
|
+
total: hours * 3600
|
|
244
|
+
},
|
|
245
|
+
method: 'addTimer',
|
|
246
|
+
source: 'APP'
|
|
247
|
+
}
|
|
248
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
249
|
+
const success = this.checkResponse([response, status], 'setTimer');
|
|
250
|
+
if (!success) {
|
|
251
|
+
logger_1.logger.error(`Failed to set timer to ${hours} hours for device: ${this.deviceName}`);
|
|
252
|
+
}
|
|
253
|
+
return success;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Clear timer
|
|
257
|
+
*/
|
|
258
|
+
async clearTimer() {
|
|
259
|
+
if (!this.hasFeature('timer')) {
|
|
260
|
+
const error = 'Timer not supported';
|
|
261
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
262
|
+
throw new Error(error);
|
|
263
|
+
}
|
|
264
|
+
logger_1.logger.debug(`Clearing timer for device: ${this.deviceName}`);
|
|
265
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
266
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
267
|
+
cid: this.cid,
|
|
268
|
+
configModule: this.configModule,
|
|
269
|
+
payload: {
|
|
270
|
+
data: {},
|
|
271
|
+
method: 'deleteTimer',
|
|
272
|
+
source: 'APP'
|
|
273
|
+
}
|
|
274
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
275
|
+
const success = this.checkResponse([response, status], 'clearTimer');
|
|
276
|
+
if (!success) {
|
|
277
|
+
logger_1.logger.error(`Failed to clear timer for device: ${this.deviceName}`);
|
|
278
|
+
}
|
|
279
|
+
return success;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Turn automatic stop on
|
|
283
|
+
*/
|
|
284
|
+
async automaticStopOn() {
|
|
285
|
+
logger_1.logger.debug(`Setting automatic stop on for device: ${this.deviceName}`);
|
|
286
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
287
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
288
|
+
cid: this.cid,
|
|
289
|
+
configModule: this.configModule,
|
|
290
|
+
payload: {
|
|
291
|
+
data: {
|
|
292
|
+
enabled: true
|
|
293
|
+
},
|
|
294
|
+
method: 'setAutomaticStop',
|
|
295
|
+
source: 'APP'
|
|
296
|
+
}
|
|
297
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
298
|
+
const success = this.checkResponse([response, status], 'automaticStopOn');
|
|
299
|
+
if (!success) {
|
|
300
|
+
logger_1.logger.error(`Failed to set automatic stop on for device: ${this.deviceName}`);
|
|
301
|
+
}
|
|
302
|
+
return success;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Turn automatic stop off
|
|
306
|
+
*/
|
|
307
|
+
async automaticStopOff() {
|
|
308
|
+
logger_1.logger.debug(`Setting automatic stop off for device: ${this.deviceName}`);
|
|
309
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
310
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
311
|
+
cid: this.cid,
|
|
312
|
+
configModule: this.configModule,
|
|
313
|
+
payload: {
|
|
314
|
+
data: {
|
|
315
|
+
enabled: false
|
|
316
|
+
},
|
|
317
|
+
method: 'setAutomaticStop',
|
|
318
|
+
source: 'APP'
|
|
319
|
+
}
|
|
320
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
321
|
+
const success = this.checkResponse([response, status], 'automaticStopOff');
|
|
322
|
+
if (!success) {
|
|
323
|
+
logger_1.logger.error(`Failed to set automatic stop off for device: ${this.deviceName}`);
|
|
324
|
+
}
|
|
325
|
+
return success;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Set auto mode
|
|
329
|
+
*/
|
|
330
|
+
async autoMode() {
|
|
331
|
+
logger_1.logger.debug(`Setting auto mode for device: ${this.deviceName}`);
|
|
332
|
+
const success = await this.setMode('auto');
|
|
333
|
+
if (!success) {
|
|
334
|
+
logger_1.logger.error(`Failed to set auto mode for device: ${this.deviceName}`);
|
|
335
|
+
}
|
|
336
|
+
return success;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Set manual mode
|
|
340
|
+
*/
|
|
341
|
+
async manualMode() {
|
|
342
|
+
logger_1.logger.debug(`Setting manual mode for device: ${this.deviceName}`);
|
|
343
|
+
const success = await this.setMode('manual');
|
|
344
|
+
if (!success) {
|
|
345
|
+
logger_1.logger.error(`Failed to set manual mode for device: ${this.deviceName}`);
|
|
346
|
+
}
|
|
347
|
+
return success;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Set sleep mode
|
|
351
|
+
*/
|
|
352
|
+
async sleepMode() {
|
|
353
|
+
logger_1.logger.debug(`Setting sleep mode for device: ${this.deviceName}`);
|
|
354
|
+
const success = await this.setMode('sleep');
|
|
355
|
+
if (!success) {
|
|
356
|
+
logger_1.logger.error(`Failed to set sleep mode for device: ${this.deviceName}`);
|
|
357
|
+
}
|
|
358
|
+
return success;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Turn off display
|
|
362
|
+
*/
|
|
363
|
+
async turnOffDisplay() {
|
|
364
|
+
logger_1.logger.debug(`Turning off display for device: ${this.deviceName}`);
|
|
365
|
+
const success = await this.setDisplay(false);
|
|
366
|
+
if (!success) {
|
|
367
|
+
logger_1.logger.error(`Failed to turn off display for device: ${this.deviceName}`);
|
|
368
|
+
}
|
|
369
|
+
return success;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Turn on display
|
|
373
|
+
*/
|
|
374
|
+
async turnOnDisplay() {
|
|
375
|
+
logger_1.logger.debug(`Turning on display for device: ${this.deviceName}`);
|
|
376
|
+
const success = await this.setDisplay(true);
|
|
377
|
+
if (!success) {
|
|
378
|
+
logger_1.logger.error(`Failed to turn on display for device: ${this.deviceName}`);
|
|
379
|
+
}
|
|
380
|
+
return success;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
exports.VeSyncAirBypass = VeSyncAirBypass;
|
|
384
|
+
/**
|
|
385
|
+
* VeSync Humidifier Base Class
|
|
386
|
+
*/
|
|
387
|
+
class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
|
|
388
|
+
constructor(details, manager) {
|
|
389
|
+
super(details, manager);
|
|
390
|
+
this.modes = ['auto', 'manual', 'sleep'];
|
|
391
|
+
this.speeds = [1, 2, 3];
|
|
392
|
+
this.displayModes = ['on', 'off'];
|
|
393
|
+
this.mistLevels = [1, 2, 3];
|
|
394
|
+
this.humidityRange = { min: 30, max: 80 };
|
|
395
|
+
logger_1.logger.debug(`Initialized VeSyncHumidifier device: ${this.deviceName}`);
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Get device details
|
|
399
|
+
*/
|
|
400
|
+
async getDetails() {
|
|
401
|
+
logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
|
|
402
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
403
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
404
|
+
cid: this.cid,
|
|
405
|
+
configModule: this.configModule,
|
|
406
|
+
payload: {
|
|
407
|
+
data: {},
|
|
408
|
+
method: 'getHumidifierStatus',
|
|
409
|
+
source: 'APP'
|
|
410
|
+
}
|
|
411
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
412
|
+
const success = this.checkResponse([response, status], 'getDetails');
|
|
413
|
+
if (success) {
|
|
414
|
+
this.details = response.result.result;
|
|
415
|
+
logger_1.logger.debug(`Successfully got details for device: ${this.deviceName}`);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
logger_1.logger.error(`Failed to get details for device: ${this.deviceName}`);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Turn device on
|
|
423
|
+
*/
|
|
424
|
+
async turnOn() {
|
|
425
|
+
logger_1.logger.debug(`Turning on device: ${this.deviceName}`);
|
|
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
|
+
enabled: true,
|
|
433
|
+
id: 0
|
|
434
|
+
},
|
|
435
|
+
method: 'setSwitch',
|
|
436
|
+
source: 'APP'
|
|
437
|
+
}
|
|
438
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
439
|
+
const success = this.checkResponse([response, status], 'turnOn');
|
|
440
|
+
if (!success) {
|
|
441
|
+
logger_1.logger.error(`Failed to turn on device: ${this.deviceName}`);
|
|
442
|
+
}
|
|
443
|
+
return success;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Turn device off
|
|
447
|
+
*/
|
|
448
|
+
async turnOff() {
|
|
449
|
+
logger_1.logger.debug(`Turning off device: ${this.deviceName}`);
|
|
450
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
451
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
452
|
+
cid: this.cid,
|
|
453
|
+
configModule: this.configModule,
|
|
454
|
+
payload: {
|
|
455
|
+
data: {
|
|
456
|
+
enabled: false,
|
|
457
|
+
id: 0
|
|
458
|
+
},
|
|
459
|
+
method: 'setSwitch',
|
|
460
|
+
source: 'APP'
|
|
461
|
+
}
|
|
462
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
463
|
+
const success = this.checkResponse([response, status], 'turnOff');
|
|
464
|
+
if (!success) {
|
|
465
|
+
logger_1.logger.error(`Failed to turn off device: ${this.deviceName}`);
|
|
466
|
+
}
|
|
467
|
+
return success;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Change fan speed
|
|
471
|
+
*/
|
|
472
|
+
async changeFanSpeed(speed) {
|
|
473
|
+
if (!this.speeds.includes(speed)) {
|
|
474
|
+
const error = `Invalid speed: ${speed}. Must be one of: ${this.speeds.join(', ')}`;
|
|
475
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
476
|
+
throw new Error(error);
|
|
477
|
+
}
|
|
478
|
+
logger_1.logger.debug(`Changing fan speed to ${speed} for device: ${this.deviceName}`);
|
|
479
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
480
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
481
|
+
cid: this.cid,
|
|
482
|
+
configModule: this.configModule,
|
|
483
|
+
payload: {
|
|
484
|
+
data: {
|
|
485
|
+
id: 0,
|
|
486
|
+
level: speed,
|
|
487
|
+
type: 'wind'
|
|
488
|
+
},
|
|
489
|
+
method: 'setLevel',
|
|
490
|
+
source: 'APP'
|
|
491
|
+
}
|
|
492
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
493
|
+
const success = this.checkResponse([response, status], 'changeFanSpeed');
|
|
494
|
+
if (!success) {
|
|
495
|
+
logger_1.logger.error(`Failed to change fan speed to ${speed} for device: ${this.deviceName}`);
|
|
496
|
+
}
|
|
497
|
+
return success;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Set device mode
|
|
501
|
+
*/
|
|
502
|
+
async setMode(mode) {
|
|
503
|
+
if (!this.modes.includes(mode)) {
|
|
504
|
+
const error = `Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`;
|
|
505
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
506
|
+
throw new Error(error);
|
|
507
|
+
}
|
|
508
|
+
logger_1.logger.debug(`Setting mode to ${mode} for device: ${this.deviceName}`);
|
|
509
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
510
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
511
|
+
cid: this.cid,
|
|
512
|
+
configModule: this.configModule,
|
|
513
|
+
payload: {
|
|
514
|
+
data: {
|
|
515
|
+
mode
|
|
516
|
+
},
|
|
517
|
+
method: 'setHumidifierMode',
|
|
518
|
+
source: 'APP'
|
|
519
|
+
}
|
|
520
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
521
|
+
const success = this.checkResponse([response, status], 'setMode');
|
|
522
|
+
if (!success) {
|
|
523
|
+
logger_1.logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
|
|
524
|
+
}
|
|
525
|
+
return success;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Set mist level
|
|
529
|
+
*/
|
|
530
|
+
async setMistLevel(level) {
|
|
531
|
+
if (!this.hasFeature('mist')) {
|
|
532
|
+
const error = 'Mist control not supported';
|
|
533
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
534
|
+
throw new Error(error);
|
|
535
|
+
}
|
|
536
|
+
if (!this.mistLevels.includes(level)) {
|
|
537
|
+
const error = `Invalid mist level: ${level}. Must be one of: ${this.mistLevels.join(', ')}`;
|
|
538
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
539
|
+
throw new Error(error);
|
|
540
|
+
}
|
|
541
|
+
logger_1.logger.debug(`Setting mist level to ${level} for device: ${this.deviceName}`);
|
|
542
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
543
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
544
|
+
cid: this.cid,
|
|
545
|
+
configModule: this.configModule,
|
|
546
|
+
payload: {
|
|
547
|
+
data: {
|
|
548
|
+
mistLevel: level
|
|
549
|
+
},
|
|
550
|
+
method: 'setMistLevel',
|
|
551
|
+
source: 'APP'
|
|
552
|
+
}
|
|
553
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
554
|
+
const success = this.checkResponse([response, status], 'setMistLevel');
|
|
555
|
+
if (!success) {
|
|
556
|
+
logger_1.logger.error(`Failed to set mist level to ${level} for device: ${this.deviceName}`);
|
|
557
|
+
}
|
|
558
|
+
return success;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Set target humidity
|
|
562
|
+
*/
|
|
563
|
+
async setHumidity(humidity) {
|
|
564
|
+
if (!this.hasFeature('humidity')) {
|
|
565
|
+
const error = 'Humidity control not supported';
|
|
566
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
567
|
+
throw new Error(error);
|
|
568
|
+
}
|
|
569
|
+
if (humidity < this.humidityRange.min || humidity > this.humidityRange.max) {
|
|
570
|
+
const error = `Invalid humidity: ${humidity}. Must be between ${this.humidityRange.min} and ${this.humidityRange.max}`;
|
|
571
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
572
|
+
throw new Error(error);
|
|
573
|
+
}
|
|
574
|
+
logger_1.logger.debug(`Setting target humidity to ${humidity}% for device: ${this.deviceName}`);
|
|
575
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
576
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
577
|
+
cid: this.cid,
|
|
578
|
+
configModule: this.configModule,
|
|
579
|
+
payload: {
|
|
580
|
+
data: {
|
|
581
|
+
targetHumidity: humidity
|
|
582
|
+
},
|
|
583
|
+
method: 'setTargetHumidity',
|
|
584
|
+
source: 'APP'
|
|
585
|
+
}
|
|
586
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
587
|
+
const success = this.checkResponse([response, status], 'setHumidity');
|
|
588
|
+
if (!success) {
|
|
589
|
+
logger_1.logger.error(`Failed to set target humidity to ${humidity}% for device: ${this.deviceName}`);
|
|
590
|
+
}
|
|
591
|
+
return success;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Set display status
|
|
595
|
+
*/
|
|
596
|
+
async setDisplay(enabled) {
|
|
597
|
+
if (!this.hasFeature('display')) {
|
|
598
|
+
const error = 'Display control not supported';
|
|
599
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
600
|
+
throw new Error(error);
|
|
601
|
+
}
|
|
602
|
+
logger_1.logger.debug(`Setting display to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
603
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
604
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
605
|
+
cid: this.cid,
|
|
606
|
+
configModule: this.configModule,
|
|
607
|
+
payload: {
|
|
608
|
+
data: {
|
|
609
|
+
state: enabled
|
|
610
|
+
},
|
|
611
|
+
method: 'setDisplay',
|
|
612
|
+
source: 'APP'
|
|
613
|
+
}
|
|
614
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
615
|
+
const success = this.checkResponse([response, status], 'setDisplay');
|
|
616
|
+
if (!success) {
|
|
617
|
+
logger_1.logger.error(`Failed to set display to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
618
|
+
}
|
|
619
|
+
return success;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Set timer
|
|
623
|
+
*/
|
|
624
|
+
async setTimer(hours) {
|
|
625
|
+
if (!this.hasFeature('timer')) {
|
|
626
|
+
const error = 'Timer not supported';
|
|
627
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
628
|
+
throw new Error(error);
|
|
629
|
+
}
|
|
630
|
+
logger_1.logger.debug(`Setting timer to ${hours} hours for device: ${this.deviceName}`);
|
|
631
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
632
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
633
|
+
cid: this.cid,
|
|
634
|
+
configModule: this.configModule,
|
|
635
|
+
payload: {
|
|
636
|
+
data: {
|
|
637
|
+
action: 'off',
|
|
638
|
+
total: hours * 3600
|
|
639
|
+
},
|
|
640
|
+
method: 'addTimer',
|
|
641
|
+
source: 'APP'
|
|
642
|
+
}
|
|
643
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
644
|
+
const success = this.checkResponse([response, status], 'setTimer');
|
|
645
|
+
if (!success) {
|
|
646
|
+
logger_1.logger.error(`Failed to set timer to ${hours} hours for device: ${this.deviceName}`);
|
|
647
|
+
}
|
|
648
|
+
return success;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Clear timer
|
|
652
|
+
*/
|
|
653
|
+
async clearTimer() {
|
|
654
|
+
if (!this.hasFeature('timer')) {
|
|
655
|
+
const error = 'Timer not supported';
|
|
656
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
657
|
+
throw new Error(error);
|
|
658
|
+
}
|
|
659
|
+
logger_1.logger.debug(`Clearing timer for device: ${this.deviceName}`);
|
|
660
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
661
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
662
|
+
cid: this.cid,
|
|
663
|
+
configModule: this.configModule,
|
|
664
|
+
payload: {
|
|
665
|
+
data: {},
|
|
666
|
+
method: 'deleteTimer',
|
|
667
|
+
source: 'APP'
|
|
668
|
+
}
|
|
669
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
670
|
+
const success = this.checkResponse([response, status], 'clearTimer');
|
|
671
|
+
if (!success) {
|
|
672
|
+
logger_1.logger.error(`Failed to clear timer for device: ${this.deviceName}`);
|
|
673
|
+
}
|
|
674
|
+
return success;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Turn automatic stop on
|
|
678
|
+
*/
|
|
679
|
+
async automaticStopOn() {
|
|
680
|
+
logger_1.logger.debug(`Setting automatic stop on for device: ${this.deviceName}`);
|
|
681
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
682
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
683
|
+
cid: this.cid,
|
|
684
|
+
configModule: this.configModule,
|
|
685
|
+
payload: {
|
|
686
|
+
data: {
|
|
687
|
+
enabled: true
|
|
688
|
+
},
|
|
689
|
+
method: 'setAutomaticStop',
|
|
690
|
+
source: 'APP'
|
|
691
|
+
}
|
|
692
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
693
|
+
const success = this.checkResponse([response, status], 'automaticStopOn');
|
|
694
|
+
if (!success) {
|
|
695
|
+
logger_1.logger.error(`Failed to set automatic stop on for device: ${this.deviceName}`);
|
|
696
|
+
}
|
|
697
|
+
return success;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Turn automatic stop off
|
|
701
|
+
*/
|
|
702
|
+
async automaticStopOff() {
|
|
703
|
+
logger_1.logger.debug(`Setting automatic stop off for device: ${this.deviceName}`);
|
|
704
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
705
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
706
|
+
cid: this.cid,
|
|
707
|
+
configModule: this.configModule,
|
|
708
|
+
payload: {
|
|
709
|
+
data: {
|
|
710
|
+
enabled: false
|
|
711
|
+
},
|
|
712
|
+
method: 'setAutomaticStop',
|
|
713
|
+
source: 'APP'
|
|
714
|
+
}
|
|
715
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
716
|
+
const success = this.checkResponse([response, status], 'automaticStopOff');
|
|
717
|
+
if (!success) {
|
|
718
|
+
logger_1.logger.error(`Failed to set automatic stop off for device: ${this.deviceName}`);
|
|
719
|
+
}
|
|
720
|
+
return success;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Set auto mode
|
|
724
|
+
*/
|
|
725
|
+
async setAutoMode() {
|
|
726
|
+
logger_1.logger.debug(`Setting auto mode for device: ${this.deviceName}`);
|
|
727
|
+
const success = await this.setMode('auto');
|
|
728
|
+
if (!success) {
|
|
729
|
+
logger_1.logger.error(`Failed to set auto mode for device: ${this.deviceName}`);
|
|
730
|
+
}
|
|
731
|
+
return success;
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Set manual mode
|
|
735
|
+
*/
|
|
736
|
+
async setManualMode() {
|
|
737
|
+
logger_1.logger.debug(`Setting manual mode for device: ${this.deviceName}`);
|
|
738
|
+
const success = await this.setMode('manual');
|
|
739
|
+
if (!success) {
|
|
740
|
+
logger_1.logger.error(`Failed to set manual mode for device: ${this.deviceName}`);
|
|
741
|
+
}
|
|
742
|
+
return success;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Turn off display
|
|
746
|
+
*/
|
|
747
|
+
async turnOffDisplay() {
|
|
748
|
+
logger_1.logger.debug(`Turning off display for device: ${this.deviceName}`);
|
|
749
|
+
const success = await this.setDisplay(false);
|
|
750
|
+
if (!success) {
|
|
751
|
+
logger_1.logger.error(`Failed to turn off display for device: ${this.deviceName}`);
|
|
752
|
+
}
|
|
753
|
+
return success;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Turn on display
|
|
757
|
+
*/
|
|
758
|
+
async turnOnDisplay() {
|
|
759
|
+
logger_1.logger.debug(`Turning on display for device: ${this.deviceName}`);
|
|
760
|
+
const success = await this.setDisplay(true);
|
|
761
|
+
if (!success) {
|
|
762
|
+
logger_1.logger.error(`Failed to turn on display for device: ${this.deviceName}`);
|
|
763
|
+
}
|
|
764
|
+
return success;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
exports.VeSyncHumidifier = VeSyncHumidifier;
|
|
768
|
+
/**
|
|
769
|
+
* VeSync Warm Humidifier Class
|
|
770
|
+
*/
|
|
771
|
+
class VeSyncWarmHumidifier extends VeSyncHumidifier {
|
|
772
|
+
constructor(details, manager) {
|
|
773
|
+
super(details, manager);
|
|
774
|
+
this.warmLevels = [1, 2, 3];
|
|
775
|
+
logger_1.logger.debug(`Initialized VeSyncWarmHumidifier device: ${this.deviceName}`);
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Set warm mist level
|
|
779
|
+
*/
|
|
780
|
+
async setWarmLevel(level) {
|
|
781
|
+
if (!this.hasFeature('warm')) {
|
|
782
|
+
const error = 'Warm mist control not supported';
|
|
783
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
784
|
+
throw new Error(error);
|
|
785
|
+
}
|
|
786
|
+
if (!this.warmLevels.includes(level)) {
|
|
787
|
+
const error = `Invalid warm level: ${level}. Must be one of: ${this.warmLevels.join(', ')}`;
|
|
788
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
789
|
+
throw new Error(error);
|
|
790
|
+
}
|
|
791
|
+
logger_1.logger.debug(`Setting warm level to ${level} for device: ${this.deviceName}`);
|
|
792
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
793
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
794
|
+
cid: this.cid,
|
|
795
|
+
configModule: this.configModule,
|
|
796
|
+
payload: {
|
|
797
|
+
data: {
|
|
798
|
+
warmLevel: level
|
|
799
|
+
},
|
|
800
|
+
method: 'setWarmLevel',
|
|
801
|
+
source: 'APP'
|
|
802
|
+
}
|
|
803
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
804
|
+
const success = this.checkResponse([response, status], 'setWarmLevel');
|
|
805
|
+
if (!success) {
|
|
806
|
+
logger_1.logger.error(`Failed to set warm level to ${level} for device: ${this.deviceName}`);
|
|
807
|
+
}
|
|
808
|
+
return success;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Set drying mode enabled
|
|
812
|
+
*/
|
|
813
|
+
async setDryingModeEnabled(enabled) {
|
|
814
|
+
if (!this.hasFeature('drying')) {
|
|
815
|
+
const error = 'Drying mode not supported';
|
|
816
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
817
|
+
throw new Error(error);
|
|
818
|
+
}
|
|
819
|
+
logger_1.logger.debug(`Setting drying mode to ${enabled} for device: ${this.deviceName}`);
|
|
820
|
+
const [response, status] = await helpers_1.Helpers.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
821
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
822
|
+
cid: this.cid,
|
|
823
|
+
configModule: this.configModule,
|
|
824
|
+
payload: {
|
|
825
|
+
data: {
|
|
826
|
+
autoDryingSwitch: enabled ? 1 : 0
|
|
827
|
+
},
|
|
828
|
+
method: 'setDryingMode',
|
|
829
|
+
source: 'APP'
|
|
830
|
+
}
|
|
831
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
832
|
+
const success = this.checkResponse([response, status], 'setDryingModeEnabled');
|
|
833
|
+
if (!success) {
|
|
834
|
+
logger_1.logger.error(`Failed to set drying mode to ${enabled} for device: ${this.deviceName}`);
|
|
835
|
+
}
|
|
836
|
+
return success;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
exports.VeSyncWarmHumidifier = VeSyncWarmHumidifier;
|
|
840
|
+
// Export fan modules dictionary
|
|
841
|
+
exports.fanModules = {
|
|
842
|
+
// Core Series
|
|
843
|
+
'Core200S': VeSyncAirBypass,
|
|
844
|
+
'Core300S': VeSyncAirBypass,
|
|
845
|
+
'Core400S': VeSyncAirBypass,
|
|
846
|
+
'Core600S': VeSyncAirBypass,
|
|
847
|
+
// LAP Series
|
|
848
|
+
'LAP-C201S-AUSR': VeSyncAirBypass,
|
|
849
|
+
'LAP-C202S-WUSR': VeSyncAirBypass,
|
|
850
|
+
'LAP-C301S-WJP': VeSyncAirBypass,
|
|
851
|
+
'LAP-C302S-WUSB': VeSyncAirBypass,
|
|
852
|
+
'LAP-C301S-WAAA': VeSyncAirBypass,
|
|
853
|
+
'LAP-C401S-WJP': VeSyncAirBypass,
|
|
854
|
+
'LAP-C401S-WUSR': VeSyncAirBypass,
|
|
855
|
+
'LAP-C401S-WAAA': VeSyncAirBypass,
|
|
856
|
+
'LAP-C601S-WUS': VeSyncAirBypass,
|
|
857
|
+
'LAP-C601S-WUSR': VeSyncAirBypass,
|
|
858
|
+
'LAP-C601S-WEU': VeSyncAirBypass,
|
|
859
|
+
'LAP-V102S-AASR': VeSyncAirBypass,
|
|
860
|
+
'LAP-V102S-WUS': VeSyncAirBypass,
|
|
861
|
+
'LAP-V102S-WEU': VeSyncAirBypass,
|
|
862
|
+
'LAP-V102S-AUSR': VeSyncAirBypass,
|
|
863
|
+
'LAP-V102S-WJP': VeSyncAirBypass,
|
|
864
|
+
'LAP-V201S-AASR': VeSyncAirBypass,
|
|
865
|
+
'LAP-V201S-WJP': VeSyncAirBypass,
|
|
866
|
+
'LAP-V201S-WEU': VeSyncAirBypass,
|
|
867
|
+
'LAP-V201S-WUS': VeSyncAirBypass,
|
|
868
|
+
'LAP-V201-AUSR': VeSyncAirBypass,
|
|
869
|
+
'LAP-V201S-AUSR': VeSyncAirBypass,
|
|
870
|
+
'LAP-V201S-AEUR': VeSyncAirBypass,
|
|
871
|
+
'LAP-EL551S-AUS': VeSyncAirBypass,
|
|
872
|
+
'LAP-EL551S-AEUR': VeSyncAirBypass,
|
|
873
|
+
'LAP-EL551S-WEU': VeSyncAirBypass,
|
|
874
|
+
'LAP-EL551S-WUS': VeSyncAirBypass,
|
|
875
|
+
// LTF Series
|
|
876
|
+
'LTF-F422S-KEU': VeSyncAirBypass,
|
|
877
|
+
'LTF-F422S-WUSR': VeSyncAirBypass,
|
|
878
|
+
'LTF-F422_WJP': VeSyncAirBypass,
|
|
879
|
+
'LTF-F422S-WUS': VeSyncAirBypass,
|
|
880
|
+
// Classic Series
|
|
881
|
+
'Classic300S': VeSyncHumidifier,
|
|
882
|
+
'Classic200S': VeSyncHumidifier,
|
|
883
|
+
// Dual Series
|
|
884
|
+
'Dual200S': VeSyncHumidifier,
|
|
885
|
+
// LUH Series
|
|
886
|
+
'LUH-A601S-WUSB': VeSyncWarmHumidifier,
|
|
887
|
+
'LUH-A601S-AUSW': VeSyncWarmHumidifier,
|
|
888
|
+
'LUH-D301S-WUSR': VeSyncWarmHumidifier,
|
|
889
|
+
'LUH-D301S-WJP': VeSyncWarmHumidifier,
|
|
890
|
+
'LUH-D301S-WEU': VeSyncWarmHumidifier,
|
|
891
|
+
'LUH-A602S-WUSR': VeSyncWarmHumidifier,
|
|
892
|
+
'LUH-A602S-WUS': VeSyncWarmHumidifier,
|
|
893
|
+
'LUH-A602S-WEUR': VeSyncWarmHumidifier,
|
|
894
|
+
'LUH-A602S-WEU': VeSyncWarmHumidifier,
|
|
895
|
+
'LUH-A602S-WJP': VeSyncWarmHumidifier,
|
|
896
|
+
'LUH-A602S-WUSC': VeSyncWarmHumidifier,
|
|
897
|
+
'LUH-O451S-WEU': VeSyncWarmHumidifier,
|
|
898
|
+
'LUH-O451S-WUS': VeSyncWarmHumidifier,
|
|
899
|
+
'LUH-O451S-WUSR': VeSyncWarmHumidifier,
|
|
900
|
+
'LUH-O601S-WUS': VeSyncWarmHumidifier,
|
|
901
|
+
'LUH-O601S-KUS': VeSyncWarmHumidifier,
|
|
902
|
+
'LUH-M101S-WUS': VeSyncWarmHumidifier,
|
|
903
|
+
// LEH Series
|
|
904
|
+
'LEH-S601S-WUS': VeSyncWarmHumidifier,
|
|
905
|
+
'LEH-S601S-WUSR': VeSyncWarmHumidifier,
|
|
906
|
+
// LV Series
|
|
907
|
+
'LV-PUR131S': VeSyncAirBypass,
|
|
908
|
+
'LV-RH131S': VeSyncAirBypass
|
|
909
|
+
};
|