tsvesync 1.0.51 → 1.0.52
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/lib/vesyncFan.js +23 -46
- package/dist/lib/vesyncFanImpl.d.ts +0 -29
- package/dist/lib/vesyncFanImpl.js +38 -130
- package/package.json +1 -1
- package/src/lib/vesyncFan.ts +23 -46
- package/src/lib/vesyncFanImpl.ts +37 -142
package/dist/lib/vesyncFan.js
CHANGED
|
@@ -189,121 +189,98 @@ exports.fanConfig = {
|
|
|
189
189
|
// Classic Series
|
|
190
190
|
'Classic300S': {
|
|
191
191
|
module: 'VeSyncHumidifier',
|
|
192
|
-
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
193
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
192
|
+
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
194
193
|
},
|
|
195
194
|
'Classic200S': {
|
|
196
195
|
module: 'VeSyncHumidifier',
|
|
197
|
-
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
198
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
196
|
+
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
199
197
|
},
|
|
200
198
|
// Dual Series
|
|
201
199
|
'Dual200S': {
|
|
202
200
|
module: 'VeSyncHumidifier',
|
|
203
|
-
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
204
|
-
levels: [1, 2]
|
|
201
|
+
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
205
202
|
},
|
|
206
203
|
// LUH Series
|
|
207
204
|
'LUH-A601S-WUSB': {
|
|
208
205
|
module: 'VeSyncWarmHumidifier',
|
|
209
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
210
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
206
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
211
207
|
},
|
|
212
208
|
'LUH-A601S-AUSW': {
|
|
213
209
|
module: 'VeSyncWarmHumidifier',
|
|
214
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
215
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
210
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
216
211
|
},
|
|
217
212
|
'LUH-D301S-WUSR': {
|
|
218
213
|
module: 'VeSyncWarmHumidifier',
|
|
219
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
220
|
-
levels: [1, 2]
|
|
214
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
221
215
|
},
|
|
222
216
|
'LUH-D301S-WJP': {
|
|
223
217
|
module: 'VeSyncWarmHumidifier',
|
|
224
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
225
|
-
levels: [1, 2]
|
|
218
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
226
219
|
},
|
|
227
220
|
'LUH-D301S-WEU': {
|
|
228
221
|
module: 'VeSyncWarmHumidifier',
|
|
229
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
230
|
-
levels: [1, 2]
|
|
222
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
231
223
|
},
|
|
232
224
|
'LUH-A602S-WUSR': {
|
|
233
225
|
module: 'VeSyncWarmHumidifier',
|
|
234
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
235
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
226
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
236
227
|
},
|
|
237
228
|
'LUH-A602S-WUS': {
|
|
238
229
|
module: 'VeSyncWarmHumidifier',
|
|
239
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
240
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
230
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
241
231
|
},
|
|
242
232
|
'LUH-A602S-WEUR': {
|
|
243
233
|
module: 'VeSyncWarmHumidifier',
|
|
244
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
245
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
234
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
246
235
|
},
|
|
247
236
|
'LUH-A602S-WEU': {
|
|
248
237
|
module: 'VeSyncWarmHumidifier',
|
|
249
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
250
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
238
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
251
239
|
},
|
|
252
240
|
'LUH-A602S-WJP': {
|
|
253
241
|
module: 'VeSyncWarmHumidifier',
|
|
254
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
255
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
242
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
256
243
|
},
|
|
257
244
|
'LUH-A602S-WUSC': {
|
|
258
245
|
module: 'VeSyncWarmHumidifier',
|
|
259
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
260
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
246
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
261
247
|
},
|
|
262
248
|
'LUH-O451S-WEU': {
|
|
263
249
|
module: 'VeSyncWarmHumidifier',
|
|
264
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
265
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
250
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
266
251
|
},
|
|
267
252
|
'LUH-O451S-WUS': {
|
|
268
253
|
module: 'VeSyncWarmHumidifier',
|
|
269
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
270
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
254
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
271
255
|
},
|
|
272
256
|
'LUH-O451S-WUSR': {
|
|
273
257
|
module: 'VeSyncWarmHumidifier',
|
|
274
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
275
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
258
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
276
259
|
},
|
|
277
260
|
'LUH-O601S-WUS': {
|
|
278
261
|
module: 'VeSyncWarmHumidifier',
|
|
279
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
280
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
262
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
281
263
|
},
|
|
282
264
|
'LUH-O601S-KUS': {
|
|
283
265
|
module: 'VeSyncWarmHumidifier',
|
|
284
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
285
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
266
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
286
267
|
},
|
|
287
268
|
'LUH-M101S-WUS': {
|
|
288
269
|
module: 'VeSyncWarmHumidifier',
|
|
289
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
290
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
270
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
291
271
|
},
|
|
292
272
|
'LUH-M101S-WEUR': {
|
|
293
273
|
module: 'VeSyncWarmHumidifier',
|
|
294
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
295
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
274
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
296
275
|
},
|
|
297
276
|
// LEH Series
|
|
298
277
|
'LEH-S601S-WUS': {
|
|
299
278
|
module: 'VeSyncWarmHumidifier',
|
|
300
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode', 'drying']
|
|
301
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
279
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode', 'drying']
|
|
302
280
|
},
|
|
303
281
|
'LEH-S601S-WUSR': {
|
|
304
282
|
module: 'VeSyncWarmHumidifier',
|
|
305
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode', 'drying']
|
|
306
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
283
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode', 'drying']
|
|
307
284
|
},
|
|
308
285
|
// LV Series
|
|
309
286
|
'LV-PUR131S': {
|
|
@@ -91,40 +91,11 @@ export declare class VeSyncHumidifier extends VeSyncFan {
|
|
|
91
91
|
min: number;
|
|
92
92
|
max: number;
|
|
93
93
|
};
|
|
94
|
-
protected readonly states: readonly ["inactive", "idle", "humidifying"];
|
|
95
94
|
constructor(details: Record<string, any>, manager: VeSync);
|
|
96
|
-
/**
|
|
97
|
-
* Get current operational state
|
|
98
|
-
*/
|
|
99
|
-
get currentState(): string;
|
|
100
|
-
/**
|
|
101
|
-
* Get water level percentage
|
|
102
|
-
*/
|
|
103
|
-
get waterLevel(): number;
|
|
104
|
-
/**
|
|
105
|
-
* Get water tank status
|
|
106
|
-
*/
|
|
107
|
-
get waterTankLifted(): boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Get oscillation state
|
|
110
|
-
*/
|
|
111
|
-
get oscillationEnabled(): boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Set oscillation state
|
|
114
|
-
*/
|
|
115
|
-
setOscillation(enabled: boolean): Promise<boolean>;
|
|
116
95
|
/**
|
|
117
96
|
* Get device details
|
|
118
97
|
*/
|
|
119
98
|
getDetails(): Promise<Boolean>;
|
|
120
|
-
/**
|
|
121
|
-
* Display device info
|
|
122
|
-
*/
|
|
123
|
-
display(): void;
|
|
124
|
-
/**
|
|
125
|
-
* Return JSON details
|
|
126
|
-
*/
|
|
127
|
-
displayJSON(): string;
|
|
128
99
|
/**
|
|
129
100
|
* Turn device on
|
|
130
101
|
*/
|
|
@@ -26,7 +26,6 @@ class VeSyncAirBypass extends vesyncFan_1.VeSyncFan {
|
|
|
26
26
|
const body = {
|
|
27
27
|
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
28
28
|
cid: this.cid,
|
|
29
|
-
deviceId: this.cid, // Add deviceId to match YAML spec
|
|
30
29
|
configModule: this.configModule,
|
|
31
30
|
payload: {
|
|
32
31
|
method,
|
|
@@ -242,11 +241,10 @@ class VeSyncAirBypass extends vesyncFan_1.VeSyncFan {
|
|
|
242
241
|
* Set device mode
|
|
243
242
|
*/
|
|
244
243
|
async setMode(mode) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
logger_1.logger.
|
|
248
|
-
|
|
249
|
-
return false;
|
|
244
|
+
if (!this.modes.includes(mode)) {
|
|
245
|
+
const error = `Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`;
|
|
246
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
247
|
+
throw new Error(error);
|
|
250
248
|
}
|
|
251
249
|
logger_1.logger.debug(`Setting mode to ${mode} for device: ${this.deviceName}`);
|
|
252
250
|
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
@@ -255,15 +253,15 @@ class VeSyncAirBypass extends vesyncFan_1.VeSyncFan {
|
|
|
255
253
|
configModule: this.configModule,
|
|
256
254
|
payload: {
|
|
257
255
|
data: {
|
|
258
|
-
|
|
256
|
+
mode
|
|
259
257
|
},
|
|
260
|
-
method: '
|
|
258
|
+
method: 'setPurifierMode',
|
|
261
259
|
source: 'APP'
|
|
262
260
|
}
|
|
263
261
|
}, helpers_1.Helpers.reqHeaderBypass());
|
|
264
262
|
const success = this.checkResponse([response, status], 'setMode');
|
|
265
263
|
if (!success) {
|
|
266
|
-
logger_1.logger.
|
|
264
|
+
logger_1.logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
|
|
267
265
|
}
|
|
268
266
|
return success;
|
|
269
267
|
}
|
|
@@ -490,7 +488,6 @@ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
|
|
|
490
488
|
this.modes = ['auto', 'manual', 'sleep'];
|
|
491
489
|
this.displayModes = ['on', 'off'];
|
|
492
490
|
this.humidityRange = { min: 30, max: 80 };
|
|
493
|
-
this.states = ['inactive', 'idle', 'humidifying'];
|
|
494
491
|
// Set mist levels based on model
|
|
495
492
|
switch (this.deviceType) {
|
|
496
493
|
case 'Dual200S':
|
|
@@ -505,66 +502,6 @@ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
|
|
|
505
502
|
}
|
|
506
503
|
logger_1.logger.debug(`Initialized VeSyncHumidifier device: ${this.deviceName}`);
|
|
507
504
|
}
|
|
508
|
-
/**
|
|
509
|
-
* Get current operational state
|
|
510
|
-
*/
|
|
511
|
-
get currentState() {
|
|
512
|
-
if (this.deviceStatus === 'off') {
|
|
513
|
-
return 'inactive';
|
|
514
|
-
}
|
|
515
|
-
if (this.details.water_lacks) {
|
|
516
|
-
return 'idle';
|
|
517
|
-
}
|
|
518
|
-
return 'humidifying';
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Get water level percentage
|
|
522
|
-
*/
|
|
523
|
-
get waterLevel() {
|
|
524
|
-
var _a;
|
|
525
|
-
return (_a = this.details.water_level) !== null && _a !== void 0 ? _a : 0;
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Get water tank status
|
|
529
|
-
*/
|
|
530
|
-
get waterTankLifted() {
|
|
531
|
-
var _a;
|
|
532
|
-
return (_a = this.details.water_tank_lifted) !== null && _a !== void 0 ? _a : false;
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* Get oscillation state
|
|
536
|
-
*/
|
|
537
|
-
get oscillationEnabled() {
|
|
538
|
-
var _a;
|
|
539
|
-
return (_a = this.details.oscillation_enabled) !== null && _a !== void 0 ? _a : false;
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* Set oscillation state
|
|
543
|
-
*/
|
|
544
|
-
async setOscillation(enabled) {
|
|
545
|
-
if (!this.hasFeature('oscillation')) {
|
|
546
|
-
logger_1.logger.debug('Oscillation not supported');
|
|
547
|
-
return false;
|
|
548
|
-
}
|
|
549
|
-
logger_1.logger.debug(`Setting oscillation to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
550
|
-
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
551
|
-
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
552
|
-
cid: this.cid,
|
|
553
|
-
configModule: this.configModule,
|
|
554
|
-
payload: {
|
|
555
|
-
data: {
|
|
556
|
-
oscillationEnabled: enabled
|
|
557
|
-
},
|
|
558
|
-
method: 'setSwing',
|
|
559
|
-
source: 'APP'
|
|
560
|
-
}
|
|
561
|
-
}, helpers_1.Helpers.reqHeaderBypass());
|
|
562
|
-
const success = this.checkResponse([response, status], 'setOscillation');
|
|
563
|
-
if (!success) {
|
|
564
|
-
logger_1.logger.debug('Error setting oscillation');
|
|
565
|
-
}
|
|
566
|
-
return success;
|
|
567
|
-
}
|
|
568
505
|
/**
|
|
569
506
|
* Get device details
|
|
570
507
|
*/
|
|
@@ -596,13 +533,12 @@ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
|
|
|
596
533
|
humidity: result.humidity || 0,
|
|
597
534
|
mist_level: result.mistLevel || 0,
|
|
598
535
|
mist_virtual_level: result.virtualLevel || 0,
|
|
536
|
+
warm_level: result.warmLevel || 0,
|
|
599
537
|
water_lacks: result.waterLacks || false,
|
|
600
|
-
water_level: result.waterLevel || 0,
|
|
601
|
-
water_tank_lifted: result.waterTankLifted || false,
|
|
602
538
|
humidity_high: result.humidityHigh || false,
|
|
539
|
+
water_tank_lifted: result.waterTankLifted || false,
|
|
603
540
|
display: result.display || false,
|
|
604
541
|
automatic_stop: result.automaticStop || false,
|
|
605
|
-
oscillation_enabled: result.oscillationEnabled || false,
|
|
606
542
|
configuration: result.configuration || {},
|
|
607
543
|
connection_status: result.connectionStatus || null
|
|
608
544
|
};
|
|
@@ -610,34 +546,6 @@ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
|
|
|
610
546
|
}
|
|
611
547
|
return success;
|
|
612
548
|
}
|
|
613
|
-
/**
|
|
614
|
-
* Display device info
|
|
615
|
-
*/
|
|
616
|
-
display() {
|
|
617
|
-
super.display();
|
|
618
|
-
const info = [
|
|
619
|
-
['Current State: ', this.currentState],
|
|
620
|
-
['Water Level: ', this.waterLevel, '%'],
|
|
621
|
-
['Water Tank: ', this.waterTankLifted ? 'Lifted' : 'Seated'],
|
|
622
|
-
['Oscillation: ', this.oscillationEnabled ? 'On' : 'Off']
|
|
623
|
-
];
|
|
624
|
-
for (const [key, value, unit = ''] of info) {
|
|
625
|
-
logger_1.logger.info(`${key.toString().padEnd(30, '.')} ${value}${unit}`);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
/**
|
|
629
|
-
* Return JSON details
|
|
630
|
-
*/
|
|
631
|
-
displayJSON() {
|
|
632
|
-
const baseInfo = JSON.parse(super.displayJSON());
|
|
633
|
-
return JSON.stringify({
|
|
634
|
-
...baseInfo,
|
|
635
|
-
'Current State': this.currentState,
|
|
636
|
-
'Water Level': this.waterLevel,
|
|
637
|
-
'Water Tank': this.waterTankLifted ? 'Lifted' : 'Seated',
|
|
638
|
-
'Oscillation': this.oscillationEnabled ? 'On' : 'Off'
|
|
639
|
-
}, null, 4);
|
|
640
|
-
}
|
|
641
549
|
/**
|
|
642
550
|
* Turn device on
|
|
643
551
|
*/
|
|
@@ -702,9 +610,9 @@ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
|
|
|
702
610
|
*/
|
|
703
611
|
async setMistLevel(level) {
|
|
704
612
|
if (!this.mistLevels.includes(level)) {
|
|
705
|
-
|
|
706
|
-
logger_1.logger.
|
|
707
|
-
|
|
613
|
+
const error = `Invalid mist level: ${level}. Must be one of: ${this.mistLevels.join(', ')}`;
|
|
614
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
615
|
+
throw new Error(error);
|
|
708
616
|
}
|
|
709
617
|
logger_1.logger.info(`Setting mist level to ${level} for device: ${this.deviceName}`);
|
|
710
618
|
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
@@ -713,9 +621,9 @@ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
|
|
|
713
621
|
configModule: this.configModule,
|
|
714
622
|
payload: {
|
|
715
623
|
data: {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
624
|
+
id: 0,
|
|
625
|
+
level: level,
|
|
626
|
+
type: 'mist'
|
|
719
627
|
},
|
|
720
628
|
method: 'setVirtualLevel',
|
|
721
629
|
source: 'APP'
|
|
@@ -723,7 +631,7 @@ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
|
|
|
723
631
|
}, helpers_1.Helpers.reqHeaderBypass());
|
|
724
632
|
const success = this.checkResponse([response, status], 'setMistLevel');
|
|
725
633
|
if (!success) {
|
|
726
|
-
logger_1.logger.
|
|
634
|
+
logger_1.logger.error(`Failed to set mist level to ${level} for device: ${this.deviceName}`);
|
|
727
635
|
}
|
|
728
636
|
return success;
|
|
729
637
|
}
|
|
@@ -738,11 +646,10 @@ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
|
|
|
738
646
|
* Set device mode
|
|
739
647
|
*/
|
|
740
648
|
async setMode(mode) {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
logger_1.logger.
|
|
744
|
-
|
|
745
|
-
return false;
|
|
649
|
+
if (!this.modes.includes(mode)) {
|
|
650
|
+
const error = `Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`;
|
|
651
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
652
|
+
throw new Error(error);
|
|
746
653
|
}
|
|
747
654
|
logger_1.logger.debug(`Setting mode to ${mode} for device: ${this.deviceName}`);
|
|
748
655
|
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
@@ -751,7 +658,7 @@ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
|
|
|
751
658
|
configModule: this.configModule,
|
|
752
659
|
payload: {
|
|
753
660
|
data: {
|
|
754
|
-
|
|
661
|
+
mode
|
|
755
662
|
},
|
|
756
663
|
method: 'setHumidifierMode',
|
|
757
664
|
source: 'APP'
|
|
@@ -759,7 +666,7 @@ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
|
|
|
759
666
|
}, helpers_1.Helpers.reqHeaderBypass());
|
|
760
667
|
const success = this.checkResponse([response, status], 'setMode');
|
|
761
668
|
if (!success) {
|
|
762
|
-
logger_1.logger.
|
|
669
|
+
logger_1.logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
|
|
763
670
|
}
|
|
764
671
|
return success;
|
|
765
672
|
}
|
|
@@ -1009,11 +916,10 @@ class VeSyncWarmHumidifier extends VeSyncHumidifier {
|
|
|
1009
916
|
* Set device mode
|
|
1010
917
|
*/
|
|
1011
918
|
async setMode(mode) {
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
logger_1.logger.
|
|
1015
|
-
|
|
1016
|
-
return false;
|
|
919
|
+
if (!this.modes.includes(mode)) {
|
|
920
|
+
const error = `Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`;
|
|
921
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
922
|
+
throw new Error(error);
|
|
1017
923
|
}
|
|
1018
924
|
logger_1.logger.debug(`Setting mode to ${mode} for device: ${this.deviceName}`);
|
|
1019
925
|
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
@@ -1022,15 +928,18 @@ class VeSyncWarmHumidifier extends VeSyncHumidifier {
|
|
|
1022
928
|
configModule: this.configModule,
|
|
1023
929
|
payload: {
|
|
1024
930
|
data: {
|
|
1025
|
-
|
|
931
|
+
mode
|
|
1026
932
|
},
|
|
1027
933
|
method: 'setHumidifierMode',
|
|
1028
934
|
source: 'APP'
|
|
1029
935
|
}
|
|
1030
936
|
}, helpers_1.Helpers.reqHeaderBypass());
|
|
1031
937
|
const success = this.checkResponse([response, status], 'setMode');
|
|
1032
|
-
if (
|
|
1033
|
-
|
|
938
|
+
if (success) {
|
|
939
|
+
this.details.mode = mode;
|
|
940
|
+
}
|
|
941
|
+
else {
|
|
942
|
+
logger_1.logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
|
|
1034
943
|
}
|
|
1035
944
|
return success;
|
|
1036
945
|
}
|
|
@@ -1039,13 +948,14 @@ class VeSyncWarmHumidifier extends VeSyncHumidifier {
|
|
|
1039
948
|
*/
|
|
1040
949
|
async setWarmLevel(level) {
|
|
1041
950
|
if (!this.hasFeature('warm')) {
|
|
1042
|
-
|
|
1043
|
-
|
|
951
|
+
const error = 'Warm mist control not supported';
|
|
952
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
953
|
+
throw new Error(error);
|
|
1044
954
|
}
|
|
1045
955
|
if (!this.warmLevels.includes(level)) {
|
|
1046
|
-
|
|
1047
|
-
logger_1.logger.
|
|
1048
|
-
|
|
956
|
+
const error = `Invalid warm level: ${level}. Must be one of: ${this.warmLevels.join(', ')}`;
|
|
957
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
958
|
+
throw new Error(error);
|
|
1049
959
|
}
|
|
1050
960
|
logger_1.logger.debug(`Setting warm level to ${level} for device: ${this.deviceName}`);
|
|
1051
961
|
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
@@ -1184,7 +1094,6 @@ class VeSyncAirBaseV2 extends VeSyncAirBypass {
|
|
|
1184
1094
|
const body = {
|
|
1185
1095
|
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
1186
1096
|
cid: this.cid,
|
|
1187
|
-
deviceId: this.cid, // Add deviceId to match YAML spec
|
|
1188
1097
|
configModule: this.configModule,
|
|
1189
1098
|
payload: {
|
|
1190
1099
|
method,
|
|
@@ -1593,7 +1502,6 @@ class VeSyncTowerFan extends VeSyncAirBaseV2 {
|
|
|
1593
1502
|
const body = {
|
|
1594
1503
|
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
1595
1504
|
cid: this.cid,
|
|
1596
|
-
deviceId: this.cid, // Add deviceId to match YAML spec
|
|
1597
1505
|
configModule: this.configModule,
|
|
1598
1506
|
payload: {
|
|
1599
1507
|
method,
|
package/package.json
CHANGED
package/src/lib/vesyncFan.ts
CHANGED
|
@@ -200,124 +200,101 @@ export const fanConfig: FanConfig = {
|
|
|
200
200
|
// Classic Series
|
|
201
201
|
'Classic300S': {
|
|
202
202
|
module: 'VeSyncHumidifier',
|
|
203
|
-
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
204
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
203
|
+
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
205
204
|
},
|
|
206
205
|
'Classic200S': {
|
|
207
206
|
module: 'VeSyncHumidifier',
|
|
208
|
-
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
209
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
207
|
+
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
210
208
|
},
|
|
211
209
|
|
|
212
210
|
// Dual Series
|
|
213
211
|
'Dual200S': {
|
|
214
212
|
module: 'VeSyncHumidifier',
|
|
215
|
-
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
216
|
-
levels: [1, 2]
|
|
213
|
+
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode']
|
|
217
214
|
},
|
|
218
215
|
|
|
219
216
|
// LUH Series
|
|
220
217
|
'LUH-A601S-WUSB': {
|
|
221
218
|
module: 'VeSyncWarmHumidifier',
|
|
222
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
223
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
219
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
224
220
|
},
|
|
225
221
|
'LUH-A601S-AUSW': {
|
|
226
222
|
module: 'VeSyncWarmHumidifier',
|
|
227
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
228
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
223
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
229
224
|
},
|
|
230
225
|
'LUH-D301S-WUSR': {
|
|
231
226
|
module: 'VeSyncWarmHumidifier',
|
|
232
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
233
|
-
levels: [1, 2]
|
|
227
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
234
228
|
},
|
|
235
229
|
'LUH-D301S-WJP': {
|
|
236
230
|
module: 'VeSyncWarmHumidifier',
|
|
237
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
238
|
-
levels: [1, 2]
|
|
231
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
239
232
|
},
|
|
240
233
|
'LUH-D301S-WEU': {
|
|
241
234
|
module: 'VeSyncWarmHumidifier',
|
|
242
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
243
|
-
levels: [1, 2]
|
|
235
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
244
236
|
},
|
|
245
237
|
'LUH-A602S-WUSR': {
|
|
246
238
|
module: 'VeSyncWarmHumidifier',
|
|
247
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
248
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
239
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
249
240
|
},
|
|
250
241
|
'LUH-A602S-WUS': {
|
|
251
242
|
module: 'VeSyncWarmHumidifier',
|
|
252
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
253
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
243
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
254
244
|
},
|
|
255
245
|
'LUH-A602S-WEUR': {
|
|
256
246
|
module: 'VeSyncWarmHumidifier',
|
|
257
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
258
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
247
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
259
248
|
},
|
|
260
249
|
'LUH-A602S-WEU': {
|
|
261
250
|
module: 'VeSyncWarmHumidifier',
|
|
262
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
263
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
251
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
264
252
|
},
|
|
265
253
|
'LUH-A602S-WJP': {
|
|
266
254
|
module: 'VeSyncWarmHumidifier',
|
|
267
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
268
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
255
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
269
256
|
},
|
|
270
257
|
'LUH-A602S-WUSC': {
|
|
271
258
|
module: 'VeSyncWarmHumidifier',
|
|
272
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
273
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
259
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
274
260
|
},
|
|
275
261
|
'LUH-O451S-WEU': {
|
|
276
262
|
module: 'VeSyncWarmHumidifier',
|
|
277
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
278
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
263
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
279
264
|
},
|
|
280
265
|
'LUH-O451S-WUS': {
|
|
281
266
|
module: 'VeSyncWarmHumidifier',
|
|
282
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
283
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
267
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
284
268
|
},
|
|
285
269
|
'LUH-O451S-WUSR': {
|
|
286
270
|
module: 'VeSyncWarmHumidifier',
|
|
287
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
288
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
271
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
289
272
|
},
|
|
290
273
|
'LUH-O601S-WUS': {
|
|
291
274
|
module: 'VeSyncWarmHumidifier',
|
|
292
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
293
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
275
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
294
276
|
},
|
|
295
277
|
'LUH-O601S-KUS': {
|
|
296
278
|
module: 'VeSyncWarmHumidifier',
|
|
297
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
298
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
279
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
299
280
|
},
|
|
300
281
|
'LUH-M101S-WUS': {
|
|
301
282
|
module: 'VeSyncWarmHumidifier',
|
|
302
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
303
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
283
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
304
284
|
},
|
|
305
285
|
'LUH-M101S-WEUR': {
|
|
306
286
|
module: 'VeSyncWarmHumidifier',
|
|
307
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
308
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
287
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode']
|
|
309
288
|
},
|
|
310
289
|
|
|
311
290
|
// LEH Series
|
|
312
291
|
'LEH-S601S-WUS': {
|
|
313
292
|
module: 'VeSyncWarmHumidifier',
|
|
314
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode', 'drying']
|
|
315
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
293
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode', 'drying']
|
|
316
294
|
},
|
|
317
295
|
'LEH-S601S-WUSR': {
|
|
318
296
|
module: 'VeSyncWarmHumidifier',
|
|
319
|
-
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode', 'drying']
|
|
320
|
-
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
297
|
+
features: ['display', 'humidity', 'mist', 'warm', 'timer', 'auto_mode', 'drying']
|
|
321
298
|
},
|
|
322
299
|
|
|
323
300
|
// LV Series
|
package/src/lib/vesyncFanImpl.ts
CHANGED
|
@@ -28,7 +28,6 @@ export class VeSyncAirBypass extends VeSyncFan {
|
|
|
28
28
|
const body = {
|
|
29
29
|
...Helpers.reqBody(this.manager, 'bypassV2'),
|
|
30
30
|
cid: this.cid,
|
|
31
|
-
deviceId: this.cid, // Add deviceId to match YAML spec
|
|
32
31
|
configModule: this.configModule,
|
|
33
32
|
payload: {
|
|
34
33
|
method,
|
|
@@ -297,11 +296,10 @@ export class VeSyncAirBypass extends VeSyncFan {
|
|
|
297
296
|
* Set device mode
|
|
298
297
|
*/
|
|
299
298
|
async setMode(mode: string): Promise<boolean> {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
logger.
|
|
303
|
-
|
|
304
|
-
return false;
|
|
299
|
+
if (!this.modes.includes(mode as any)) {
|
|
300
|
+
const error = `Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`;
|
|
301
|
+
logger.error(`${error} for device: ${this.deviceName}`);
|
|
302
|
+
throw new Error(error);
|
|
305
303
|
}
|
|
306
304
|
|
|
307
305
|
logger.debug(`Setting mode to ${mode} for device: ${this.deviceName}`);
|
|
@@ -314,9 +312,9 @@ export class VeSyncAirBypass extends VeSyncFan {
|
|
|
314
312
|
configModule: this.configModule,
|
|
315
313
|
payload: {
|
|
316
314
|
data: {
|
|
317
|
-
|
|
315
|
+
mode
|
|
318
316
|
},
|
|
319
|
-
method: '
|
|
317
|
+
method: 'setPurifierMode',
|
|
320
318
|
source: 'APP'
|
|
321
319
|
}
|
|
322
320
|
},
|
|
@@ -325,7 +323,7 @@ export class VeSyncAirBypass extends VeSyncFan {
|
|
|
325
323
|
|
|
326
324
|
const success = this.checkResponse([response, status], 'setMode');
|
|
327
325
|
if (!success) {
|
|
328
|
-
logger.
|
|
326
|
+
logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
|
|
329
327
|
}
|
|
330
328
|
return success;
|
|
331
329
|
}
|
|
@@ -602,7 +600,6 @@ export class VeSyncHumidifier extends VeSyncFan {
|
|
|
602
600
|
protected readonly mistLevels: number[];
|
|
603
601
|
protected readonly displayModes = ['on', 'off'] as const;
|
|
604
602
|
protected readonly humidityRange = { min: 30, max: 80 };
|
|
605
|
-
protected readonly states = ['inactive', 'idle', 'humidifying'] as const;
|
|
606
603
|
|
|
607
604
|
constructor(details: Record<string, any>, manager: VeSync) {
|
|
608
605
|
super(details, manager);
|
|
@@ -621,75 +618,6 @@ export class VeSyncHumidifier extends VeSyncFan {
|
|
|
621
618
|
logger.debug(`Initialized VeSyncHumidifier device: ${this.deviceName}`);
|
|
622
619
|
}
|
|
623
620
|
|
|
624
|
-
/**
|
|
625
|
-
* Get current operational state
|
|
626
|
-
*/
|
|
627
|
-
get currentState(): string {
|
|
628
|
-
if (this.deviceStatus === 'off') {
|
|
629
|
-
return 'inactive';
|
|
630
|
-
}
|
|
631
|
-
if (this.details.water_lacks) {
|
|
632
|
-
return 'idle';
|
|
633
|
-
}
|
|
634
|
-
return 'humidifying';
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* Get water level percentage
|
|
639
|
-
*/
|
|
640
|
-
get waterLevel(): number {
|
|
641
|
-
return this.details.water_level ?? 0;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Get water tank status
|
|
646
|
-
*/
|
|
647
|
-
get waterTankLifted(): boolean {
|
|
648
|
-
return this.details.water_tank_lifted ?? false;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* Get oscillation state
|
|
653
|
-
*/
|
|
654
|
-
get oscillationEnabled(): boolean {
|
|
655
|
-
return this.details.oscillation_enabled ?? false;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* Set oscillation state
|
|
660
|
-
*/
|
|
661
|
-
async setOscillation(enabled: boolean): Promise<boolean> {
|
|
662
|
-
if (!this.hasFeature('oscillation')) {
|
|
663
|
-
logger.debug('Oscillation not supported');
|
|
664
|
-
return false;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
logger.debug(`Setting oscillation to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
668
|
-
const [response, status] = await this.callApi(
|
|
669
|
-
'/cloud/v2/deviceManaged/bypassV2',
|
|
670
|
-
'post',
|
|
671
|
-
{
|
|
672
|
-
...Helpers.reqBody(this.manager, 'bypassV2'),
|
|
673
|
-
cid: this.cid,
|
|
674
|
-
configModule: this.configModule,
|
|
675
|
-
payload: {
|
|
676
|
-
data: {
|
|
677
|
-
oscillationEnabled: enabled
|
|
678
|
-
},
|
|
679
|
-
method: 'setSwing',
|
|
680
|
-
source: 'APP'
|
|
681
|
-
}
|
|
682
|
-
},
|
|
683
|
-
Helpers.reqHeaderBypass()
|
|
684
|
-
);
|
|
685
|
-
|
|
686
|
-
const success = this.checkResponse([response, status], 'setOscillation');
|
|
687
|
-
if (!success) {
|
|
688
|
-
logger.debug('Error setting oscillation');
|
|
689
|
-
}
|
|
690
|
-
return success;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
621
|
/**
|
|
694
622
|
* Get device details
|
|
695
623
|
*/
|
|
@@ -727,13 +655,12 @@ export class VeSyncHumidifier extends VeSyncFan {
|
|
|
727
655
|
humidity: result.humidity || 0,
|
|
728
656
|
mist_level: result.mistLevel || 0,
|
|
729
657
|
mist_virtual_level: result.virtualLevel || 0,
|
|
658
|
+
warm_level: result.warmLevel || 0,
|
|
730
659
|
water_lacks: result.waterLacks || false,
|
|
731
|
-
water_level: result.waterLevel || 0,
|
|
732
|
-
water_tank_lifted: result.waterTankLifted || false,
|
|
733
660
|
humidity_high: result.humidityHigh || false,
|
|
661
|
+
water_tank_lifted: result.waterTankLifted || false,
|
|
734
662
|
display: result.display || false,
|
|
735
663
|
automatic_stop: result.automaticStop || false,
|
|
736
|
-
oscillation_enabled: result.oscillationEnabled || false,
|
|
737
664
|
configuration: result.configuration || {},
|
|
738
665
|
connection_status: result.connectionStatus || null
|
|
739
666
|
};
|
|
@@ -742,37 +669,6 @@ export class VeSyncHumidifier extends VeSyncFan {
|
|
|
742
669
|
return success;
|
|
743
670
|
}
|
|
744
671
|
|
|
745
|
-
/**
|
|
746
|
-
* Display device info
|
|
747
|
-
*/
|
|
748
|
-
override display(): void {
|
|
749
|
-
super.display();
|
|
750
|
-
const info = [
|
|
751
|
-
['Current State: ', this.currentState],
|
|
752
|
-
['Water Level: ', this.waterLevel, '%'],
|
|
753
|
-
['Water Tank: ', this.waterTankLifted ? 'Lifted' : 'Seated'],
|
|
754
|
-
['Oscillation: ', this.oscillationEnabled ? 'On' : 'Off']
|
|
755
|
-
];
|
|
756
|
-
|
|
757
|
-
for (const [key, value, unit = ''] of info) {
|
|
758
|
-
logger.info(`${key.toString().padEnd(30, '.')} ${value}${unit}`);
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
* Return JSON details
|
|
764
|
-
*/
|
|
765
|
-
override displayJSON(): string {
|
|
766
|
-
const baseInfo = JSON.parse(super.displayJSON());
|
|
767
|
-
return JSON.stringify({
|
|
768
|
-
...baseInfo,
|
|
769
|
-
'Current State': this.currentState,
|
|
770
|
-
'Water Level': this.waterLevel,
|
|
771
|
-
'Water Tank': this.waterTankLifted ? 'Lifted' : 'Seated',
|
|
772
|
-
'Oscillation': this.oscillationEnabled ? 'On' : 'Off'
|
|
773
|
-
}, null, 4);
|
|
774
|
-
}
|
|
775
|
-
|
|
776
672
|
/**
|
|
777
673
|
* Turn device on
|
|
778
674
|
*/
|
|
@@ -844,9 +740,9 @@ export class VeSyncHumidifier extends VeSyncFan {
|
|
|
844
740
|
*/
|
|
845
741
|
async setMistLevel(level: number): Promise<boolean> {
|
|
846
742
|
if (!this.mistLevels.includes(level)) {
|
|
847
|
-
|
|
848
|
-
logger.
|
|
849
|
-
|
|
743
|
+
const error = `Invalid mist level: ${level}. Must be one of: ${this.mistLevels.join(', ')}`;
|
|
744
|
+
logger.error(`${error} for device: ${this.deviceName}`);
|
|
745
|
+
throw new Error(error);
|
|
850
746
|
}
|
|
851
747
|
|
|
852
748
|
logger.info(`Setting mist level to ${level} for device: ${this.deviceName}`);
|
|
@@ -859,9 +755,9 @@ export class VeSyncHumidifier extends VeSyncFan {
|
|
|
859
755
|
configModule: this.configModule,
|
|
860
756
|
payload: {
|
|
861
757
|
data: {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
758
|
+
id: 0,
|
|
759
|
+
level: level,
|
|
760
|
+
type: 'mist'
|
|
865
761
|
},
|
|
866
762
|
method: 'setVirtualLevel',
|
|
867
763
|
source: 'APP'
|
|
@@ -872,7 +768,7 @@ export class VeSyncHumidifier extends VeSyncFan {
|
|
|
872
768
|
|
|
873
769
|
const success = this.checkResponse([response, status], 'setMistLevel');
|
|
874
770
|
if (!success) {
|
|
875
|
-
logger.
|
|
771
|
+
logger.error(`Failed to set mist level to ${level} for device: ${this.deviceName}`);
|
|
876
772
|
}
|
|
877
773
|
return success;
|
|
878
774
|
}
|
|
@@ -889,11 +785,10 @@ export class VeSyncHumidifier extends VeSyncFan {
|
|
|
889
785
|
* Set device mode
|
|
890
786
|
*/
|
|
891
787
|
async setMode(mode: string): Promise<boolean> {
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
logger.
|
|
895
|
-
|
|
896
|
-
return false;
|
|
788
|
+
if (!this.modes.includes(mode as any)) {
|
|
789
|
+
const error = `Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`;
|
|
790
|
+
logger.error(`${error} for device: ${this.deviceName}`);
|
|
791
|
+
throw new Error(error);
|
|
897
792
|
}
|
|
898
793
|
|
|
899
794
|
logger.debug(`Setting mode to ${mode} for device: ${this.deviceName}`);
|
|
@@ -906,7 +801,7 @@ export class VeSyncHumidifier extends VeSyncFan {
|
|
|
906
801
|
configModule: this.configModule,
|
|
907
802
|
payload: {
|
|
908
803
|
data: {
|
|
909
|
-
|
|
804
|
+
mode
|
|
910
805
|
},
|
|
911
806
|
method: 'setHumidifierMode',
|
|
912
807
|
source: 'APP'
|
|
@@ -917,7 +812,7 @@ export class VeSyncHumidifier extends VeSyncFan {
|
|
|
917
812
|
|
|
918
813
|
const success = this.checkResponse([response, status], 'setMode');
|
|
919
814
|
if (!success) {
|
|
920
|
-
logger.
|
|
815
|
+
logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
|
|
921
816
|
}
|
|
922
817
|
return success;
|
|
923
818
|
}
|
|
@@ -1222,11 +1117,10 @@ export class VeSyncWarmHumidifier extends VeSyncHumidifier {
|
|
|
1222
1117
|
* Set device mode
|
|
1223
1118
|
*/
|
|
1224
1119
|
async setMode(mode: string): Promise<boolean> {
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
logger.
|
|
1228
|
-
|
|
1229
|
-
return false;
|
|
1120
|
+
if (!this.modes.includes(mode as any)) {
|
|
1121
|
+
const error = `Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`;
|
|
1122
|
+
logger.error(`${error} for device: ${this.deviceName}`);
|
|
1123
|
+
throw new Error(error);
|
|
1230
1124
|
}
|
|
1231
1125
|
|
|
1232
1126
|
logger.debug(`Setting mode to ${mode} for device: ${this.deviceName}`);
|
|
@@ -1239,7 +1133,7 @@ export class VeSyncWarmHumidifier extends VeSyncHumidifier {
|
|
|
1239
1133
|
configModule: this.configModule,
|
|
1240
1134
|
payload: {
|
|
1241
1135
|
data: {
|
|
1242
|
-
|
|
1136
|
+
mode
|
|
1243
1137
|
},
|
|
1244
1138
|
method: 'setHumidifierMode',
|
|
1245
1139
|
source: 'APP'
|
|
@@ -1249,8 +1143,10 @@ export class VeSyncWarmHumidifier extends VeSyncHumidifier {
|
|
|
1249
1143
|
);
|
|
1250
1144
|
|
|
1251
1145
|
const success = this.checkResponse([response, status], 'setMode');
|
|
1252
|
-
if (
|
|
1253
|
-
|
|
1146
|
+
if (success) {
|
|
1147
|
+
this.details.mode = mode;
|
|
1148
|
+
} else {
|
|
1149
|
+
logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
|
|
1254
1150
|
}
|
|
1255
1151
|
return success;
|
|
1256
1152
|
}
|
|
@@ -1260,14 +1156,15 @@ export class VeSyncWarmHumidifier extends VeSyncHumidifier {
|
|
|
1260
1156
|
*/
|
|
1261
1157
|
async setWarmLevel(level: number): Promise<boolean> {
|
|
1262
1158
|
if (!this.hasFeature('warm')) {
|
|
1263
|
-
|
|
1264
|
-
|
|
1159
|
+
const error = 'Warm mist control not supported';
|
|
1160
|
+
logger.error(`${error} for device: ${this.deviceName}`);
|
|
1161
|
+
throw new Error(error);
|
|
1265
1162
|
}
|
|
1266
1163
|
|
|
1267
1164
|
if (!this.warmLevels.includes(level)) {
|
|
1268
|
-
|
|
1269
|
-
logger.
|
|
1270
|
-
|
|
1165
|
+
const error = `Invalid warm level: ${level}. Must be one of: ${this.warmLevels.join(', ')}`;
|
|
1166
|
+
logger.error(`${error} for device: ${this.deviceName}`);
|
|
1167
|
+
throw new Error(error);
|
|
1271
1168
|
}
|
|
1272
1169
|
|
|
1273
1170
|
logger.debug(`Setting warm level to ${level} for device: ${this.deviceName}`);
|
|
@@ -1433,7 +1330,6 @@ export class VeSyncAirBaseV2 extends VeSyncAirBypass {
|
|
|
1433
1330
|
const body = {
|
|
1434
1331
|
...Helpers.reqBody(this.manager, 'bypassV2'),
|
|
1435
1332
|
cid: this.cid,
|
|
1436
|
-
deviceId: this.cid, // Add deviceId to match YAML spec
|
|
1437
1333
|
configModule: this.configModule,
|
|
1438
1334
|
payload: {
|
|
1439
1335
|
method,
|
|
@@ -1954,7 +1850,6 @@ export class VeSyncTowerFan extends VeSyncAirBaseV2 {
|
|
|
1954
1850
|
const body = {
|
|
1955
1851
|
...Helpers.reqBody(this.manager, 'bypassV2'),
|
|
1956
1852
|
cid: this.cid,
|
|
1957
|
-
deviceId: this.cid, // Add deviceId to match YAML spec
|
|
1958
1853
|
configModule: this.configModule,
|
|
1959
1854
|
payload: {
|
|
1960
1855
|
method,
|