tsvesync 1.0.74 → 1.0.75

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.
@@ -65,4 +65,16 @@ export declare class VeSyncAir131 extends VeSyncFan {
65
65
  * Turn on display
66
66
  */
67
67
  turnOnDisplay(): Promise<boolean>;
68
+ /**
69
+ * Get active time in minutes
70
+ */
71
+ get activeTime(): number;
72
+ /**
73
+ * Display device info
74
+ */
75
+ display(): void;
76
+ /**
77
+ * Return JSON details for device
78
+ */
79
+ displayJSON(): string;
68
80
  }
@@ -19,7 +19,7 @@ class VeSyncAir131 extends vesyncFan_1.VeSyncFan {
19
19
  * Get device details
20
20
  */
21
21
  async getDetails() {
22
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
22
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
23
23
  logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
24
24
  const [response, status] = await this.callApi('/131airPurifier/v1/device/devicedetail', 'post', {
25
25
  acceptLanguage: 'en',
@@ -49,7 +49,8 @@ class VeSyncAir131 extends vesyncFan_1.VeSyncFan {
49
49
  filterLife: ((_h = (_g = response.result) === null || _g === void 0 ? void 0 : _g.result) === null || _h === void 0 ? void 0 : _h.filterLife) || 0,
50
50
  screenStatus: ((_k = (_j = response.result) === null || _j === void 0 ? void 0 : _j.result) === null || _k === void 0 ? void 0 : _k.display) ? 'on' : 'off',
51
51
  childLock: ((_m = (_l = response.result) === null || _l === void 0 ? void 0 : _l.result) === null || _m === void 0 ? void 0 : _m.childLock) || false,
52
- airQuality: ((_p = (_o = response.result) === null || _o === void 0 ? void 0 : _o.result) === null || _p === void 0 ? void 0 : _p.airQuality) || 0
52
+ airQuality: ((_p = (_o = response.result) === null || _o === void 0 ? void 0 : _o.result) === null || _p === void 0 ? void 0 : _p.airQuality) || 0,
53
+ active_time: ((_r = (_q = response.result) === null || _q === void 0 ? void 0 : _q.result) === null || _r === void 0 ? void 0 : _r.activeTime) || 0
53
54
  };
54
55
  return true;
55
56
  }
@@ -400,5 +401,46 @@ class VeSyncAir131 extends vesyncFan_1.VeSyncFan {
400
401
  }
401
402
  return success;
402
403
  }
404
+ /**
405
+ * Get active time in minutes
406
+ */
407
+ get activeTime() {
408
+ return this.details.active_time || 0;
409
+ }
410
+ /**
411
+ * Display device info
412
+ */
413
+ display() {
414
+ super.display();
415
+ const info = [
416
+ ['Mode: ', this.mode],
417
+ ['Speed: ', this.speed],
418
+ ['Filter Life: ', this.filterLife, '%'],
419
+ ['Screen Status: ', this.screenStatus],
420
+ ['Child Lock: ', this.childLock ? 'Enabled' : 'Disabled'],
421
+ ['Air Quality: ', this.airQuality],
422
+ ['Active Time: ', this.activeTime, 'minutes']
423
+ ];
424
+ for (const [key, value, unit = ''] of info) {
425
+ logger_1.logger.info(`${key.toString().padEnd(30, '.')} ${value}${unit}`);
426
+ }
427
+ }
428
+ /**
429
+ * Return JSON details for device
430
+ */
431
+ displayJSON() {
432
+ const baseInfo = JSON.parse(super.displayJSON());
433
+ const details = {
434
+ ...baseInfo,
435
+ 'Mode': this.mode,
436
+ 'Speed': this.speed.toString(),
437
+ 'Filter Life': this.filterLife.toString(),
438
+ 'Screen Status': this.screenStatus,
439
+ 'Child Lock': this.childLock ? 'Enabled' : 'Disabled',
440
+ 'Air Quality': this.airQuality,
441
+ 'Active Time': this.activeTime.toString()
442
+ };
443
+ return JSON.stringify(details, null, 4);
444
+ }
403
445
  }
404
446
  exports.VeSyncAir131 = VeSyncAir131;
@@ -76,4 +76,8 @@ export declare class VeSyncAirBypass extends VeSyncFan {
76
76
  * Turn on display
77
77
  */
78
78
  turnOnDisplay(): Promise<boolean>;
79
+ /**
80
+ * Get night light state
81
+ */
82
+ get nightLight(): string;
79
83
  }
@@ -122,11 +122,12 @@ class VeSyncAirBypass extends vesyncFan_1.VeSyncFan {
122
122
  * Change fan speed
123
123
  */
124
124
  async changeFanSpeed(speed) {
125
- // const speeds = this.config.levels ?? [];
126
- // if (!speeds.includes(speed)) {
127
- // logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
128
- // return false;
129
- // }
125
+ var _a;
126
+ const speeds = (_a = this.config.levels) !== null && _a !== void 0 ? _a : [];
127
+ if (!speeds.includes(speed)) {
128
+ logger_1.logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
129
+ return false;
130
+ }
130
131
  logger_1.logger.info(`Changing fan speed to ${speed} for device: ${this.deviceName}`);
131
132
  const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
132
133
  ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
@@ -282,6 +283,11 @@ class VeSyncAirBypass extends vesyncFan_1.VeSyncFan {
282
283
  logger_1.logger.error(`${error} for device: ${this.deviceName}`);
283
284
  throw new Error(error);
284
285
  }
286
+ // Check if device is on - timer can only be set when device is on
287
+ if (this.deviceStatus !== 'on') {
288
+ logger_1.logger.debug(`Cannot set timer when device is off: ${this.deviceName}`);
289
+ return false;
290
+ }
285
291
  logger_1.logger.debug(`Setting timer to ${hours} hours for device: ${this.deviceName}`);
286
292
  const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
287
293
  ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
@@ -405,6 +411,11 @@ class VeSyncAirBypass extends vesyncFan_1.VeSyncFan {
405
411
  * Set auto mode
406
412
  */
407
413
  async autoMode() {
414
+ // Check if auto mode is supported
415
+ if (!this.hasFeature('auto_mode')) {
416
+ logger_1.logger.debug(`Auto mode not supported for device: ${this.deviceName}`);
417
+ return false;
418
+ }
408
419
  logger_1.logger.debug(`Setting auto mode for device: ${this.deviceName}`);
409
420
  const success = await this.setMode('auto');
410
421
  if (!success) {
@@ -456,5 +467,11 @@ class VeSyncAirBypass extends vesyncFan_1.VeSyncFan {
456
467
  }
457
468
  return success;
458
469
  }
470
+ /**
471
+ * Get night light state
472
+ */
473
+ get nightLight() {
474
+ return this.details.night_light || 'off';
475
+ }
459
476
  }
460
477
  exports.VeSyncAirBypass = VeSyncAirBypass;
@@ -5,7 +5,6 @@ const airBypass_1 = require("./airBypass");
5
5
  const airBaseV2_1 = require("./airBaseV2");
6
6
  const air131_1 = require("./air131");
7
7
  const towerFan_1 = require("./towerFan");
8
- const humidifier_1 = require("./humidifier");
9
8
  const humid200300S_1 = require("./humid200300S");
10
9
  const superior6000S_1 = require("./superior6000S");
11
10
  const humid1000S_1 = require("./humid1000S");
@@ -19,8 +18,8 @@ var air131_2 = require("./air131");
19
18
  Object.defineProperty(exports, "VeSyncAir131", { enumerable: true, get: function () { return air131_2.VeSyncAir131; } });
20
19
  var towerFan_2 = require("./towerFan");
21
20
  Object.defineProperty(exports, "VeSyncTowerFan", { enumerable: true, get: function () { return towerFan_2.VeSyncTowerFan; } });
22
- var humidifier_2 = require("./humidifier");
23
- Object.defineProperty(exports, "VeSyncHumidifier", { enumerable: true, get: function () { return humidifier_2.VeSyncHumidifier; } });
21
+ var humidifier_1 = require("./humidifier");
22
+ Object.defineProperty(exports, "VeSyncHumidifier", { enumerable: true, get: function () { return humidifier_1.VeSyncHumidifier; } });
24
23
  var warmHumidifier_1 = require("./warmHumidifier");
25
24
  Object.defineProperty(exports, "VeSyncWarmHumidifier", { enumerable: true, get: function () { return warmHumidifier_1.VeSyncWarmHumidifier; } });
26
25
  var humid200300S_2 = require("./humid200300S");
@@ -75,10 +74,10 @@ exports.fanModules = {
75
74
  'LTF-F422_WJP': towerFan_1.VeSyncTowerFan,
76
75
  'LTF-F422S-WUS': towerFan_1.VeSyncTowerFan,
77
76
  // Classic Series
78
- 'Classic300S': humidifier_1.VeSyncHumidifier,
77
+ 'Classic300S': humid200300S_1.VeSyncHumid200300S,
79
78
  'Classic200S': humid200S_1.VeSyncHumid200S,
80
79
  // Dual Series
81
- 'Dual200S': humidifier_1.VeSyncHumidifier,
80
+ 'Dual200S': humid200300S_1.VeSyncHumid200300S,
82
81
  // LUH Series
83
82
  'LUH-A601S-WUSB': humid200300S_1.VeSyncHumid200300S,
84
83
  'LUH-A601S-AUSW': humid200300S_1.VeSyncHumid200300S,
@@ -11,158 +11,158 @@ exports.fanConfig = {
11
11
  // Core Series
12
12
  'Core200S': {
13
13
  module: 'VeSyncAirBypass',
14
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
14
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'sleep_mode'],
15
15
  levels: [1, 2, 3]
16
16
  },
17
17
  'Core300S': {
18
18
  module: 'VeSyncAirBypass',
19
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
19
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
20
20
  levels: [1, 2, 3, 4]
21
21
  },
22
22
  'Core400S': {
23
23
  module: 'VeSyncAirBypass',
24
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
24
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
25
25
  levels: [1, 2, 3, 4]
26
26
  },
27
27
  'Core600S': {
28
28
  module: 'VeSyncAirBypass',
29
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
29
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
30
30
  levels: [1, 2, 3, 4]
31
31
  },
32
32
  // LAP Series
33
33
  'LAP-C201S-AUSR': {
34
34
  module: 'VeSyncAirBypass',
35
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
35
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
36
36
  levels: [1, 2, 3]
37
37
  },
38
38
  'LAP-C202S-WUSR': {
39
39
  module: 'VeSyncAirBypass',
40
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
40
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
41
41
  levels: [1, 2, 3]
42
42
  },
43
43
  'LAP-C301S-WJP': {
44
44
  module: 'VeSyncAirBypass',
45
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
45
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
46
46
  levels: [1, 2, 3, 4]
47
47
  },
48
48
  'LAP-C302S-WUSB': {
49
49
  module: 'VeSyncAirBypass',
50
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
50
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
51
51
  levels: [1, 2, 3, 4]
52
52
  },
53
53
  'LAP-C301S-WAAA': {
54
54
  module: 'VeSyncAirBypass',
55
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
55
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
56
56
  levels: [1, 2, 3, 4]
57
57
  },
58
58
  'LAP-C401S-WJP': {
59
59
  module: 'VeSyncAirBypass',
60
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
60
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
61
61
  levels: [1, 2, 3, 4]
62
62
  },
63
63
  'LAP-C401S-WUSR': {
64
64
  module: 'VeSyncAirBypass',
65
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
65
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
66
66
  levels: [1, 2, 3, 4]
67
67
  },
68
68
  'LAP-C401S-WAAA': {
69
69
  module: 'VeSyncAirBypass',
70
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
70
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
71
71
  levels: [1, 2, 3, 4]
72
72
  },
73
73
  'LAP-C601S-WUS': {
74
74
  module: 'VeSyncAirBypass',
75
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
75
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
76
76
  levels: [1, 2, 3, 4]
77
77
  },
78
78
  'LAP-C601S-WUSR': {
79
79
  module: 'VeSyncAirBypass',
80
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
80
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
81
81
  levels: [1, 2, 3, 4]
82
82
  },
83
83
  'LAP-C601S-WEU': {
84
84
  module: 'VeSyncAirBypass',
85
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
85
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
86
86
  levels: [1, 2, 3, 4]
87
87
  },
88
88
  'LAP-V102S-AASR': {
89
89
  module: 'VeSyncAirBaseV2',
90
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
90
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
91
91
  levels: [1, 2, 3, 4]
92
92
  },
93
93
  'LAP-V102S-WUS': {
94
94
  module: 'VeSyncAirBaseV2',
95
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
95
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
96
96
  levels: [1, 2, 3, 4]
97
97
  },
98
98
  'LAP-V102S-WEU': {
99
99
  module: 'VeSyncAirBaseV2',
100
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
100
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
101
101
  levels: [1, 2, 3, 4]
102
102
  },
103
103
  'LAP-V102S-AUSR': {
104
104
  module: 'VeSyncAirBaseV2',
105
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
105
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
106
106
  levels: [1, 2, 3, 4]
107
107
  },
108
108
  'LAP-V102S-WJP': {
109
109
  module: 'VeSyncAirBaseV2',
110
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
110
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
111
111
  levels: [1, 2, 3, 4]
112
112
  },
113
113
  'LAP-V201S-AASR': {
114
114
  module: 'VeSyncAirBaseV2',
115
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
115
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
116
116
  levels: [1, 2, 3, 4]
117
117
  },
118
118
  'LAP-V201S-WJP': {
119
119
  module: 'VeSyncAirBaseV2',
120
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
120
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
121
121
  levels: [1, 2, 3, 4]
122
122
  },
123
123
  'LAP-V201S-WEU': {
124
124
  module: 'VeSyncAirBaseV2',
125
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
125
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
126
126
  levels: [1, 2, 3, 4]
127
127
  },
128
128
  'LAP-V201S-WUS': {
129
129
  module: 'VeSyncAirBaseV2',
130
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
130
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
131
131
  levels: [1, 2, 3, 4]
132
132
  },
133
133
  'LAP-V201-AUSR': {
134
134
  module: 'VeSyncAirBaseV2',
135
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
135
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
136
136
  levels: [1, 2, 3, 4]
137
137
  },
138
138
  'LAP-V201S-AUSR': {
139
139
  module: 'VeSyncAirBaseV2',
140
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
140
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
141
141
  levels: [1, 2, 3, 4]
142
142
  },
143
143
  'LAP-V201S-AEUR': {
144
144
  module: 'VeSyncAirBaseV2',
145
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
145
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
146
146
  levels: [1, 2, 3, 4]
147
147
  },
148
148
  'LAP-EL551S-AUS': {
149
149
  module: 'VeSyncAirBaseV2',
150
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
150
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode'],
151
151
  levels: [1, 2, 3]
152
152
  },
153
153
  'LAP-EL551S-AEUR': {
154
154
  module: 'VeSyncAirBaseV2',
155
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
155
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode'],
156
156
  levels: [1, 2, 3]
157
157
  },
158
158
  'LAP-EL551S-WEU': {
159
159
  module: 'VeSyncAirBaseV2',
160
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
160
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode'],
161
161
  levels: [1, 2, 3]
162
162
  },
163
163
  'LAP-EL551S-WUS': {
164
164
  module: 'VeSyncAirBaseV2',
165
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
165
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode'],
166
166
  levels: [1, 2, 3]
167
167
  },
168
168
  // LTF Series
@@ -290,12 +290,12 @@ exports.fanConfig = {
290
290
  // LV Series
291
291
  'LV-PUR131S': {
292
292
  module: 'VeSyncAir131',
293
- features: ['air_quality', 'display', 'child_lock', 'night_light', 'timer', 'fan_speed'],
293
+ features: ['air_quality', 'display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode'],
294
294
  levels: [1, 2, 3]
295
295
  },
296
296
  'LV-RH131S': {
297
297
  module: 'VeSyncAir131',
298
- features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed'],
298
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode'],
299
299
  levels: [1, 2, 3]
300
300
  }
301
301
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsvesync",
3
- "version": "1.0.74",
3
+ "version": "1.0.75",
4
4
  "description": "A TypeScript library for interacting with VeSync smart home devices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -57,7 +57,8 @@ export class VeSyncAir131 extends VeSyncFan {
57
57
  filterLife: response.result?.result?.filterLife || 0,
58
58
  screenStatus: response.result?.result?.display ? 'on' : 'off',
59
59
  childLock: response.result?.result?.childLock || false,
60
- airQuality: response.result?.result?.airQuality || 0
60
+ airQuality: response.result?.result?.airQuality || 0,
61
+ active_time: response.result?.result?.activeTime || 0
61
62
  };
62
63
  return true;
63
64
  }
@@ -483,4 +484,50 @@ export class VeSyncAir131 extends VeSyncFan {
483
484
  }
484
485
  return success;
485
486
  }
487
+
488
+ /**
489
+ * Get active time in minutes
490
+ */
491
+ get activeTime(): number {
492
+ return this.details.active_time || 0;
493
+ }
494
+
495
+ /**
496
+ * Display device info
497
+ */
498
+ override display(): void {
499
+ super.display();
500
+ const info = [
501
+ ['Mode: ', this.mode],
502
+ ['Speed: ', this.speed],
503
+ ['Filter Life: ', this.filterLife, '%'],
504
+ ['Screen Status: ', this.screenStatus],
505
+ ['Child Lock: ', this.childLock ? 'Enabled' : 'Disabled'],
506
+ ['Air Quality: ', this.airQuality],
507
+ ['Active Time: ', this.activeTime, 'minutes']
508
+ ];
509
+
510
+ for (const [key, value, unit = ''] of info) {
511
+ logger.info(`${key.toString().padEnd(30, '.')} ${value}${unit}`);
512
+ }
513
+ }
514
+
515
+ /**
516
+ * Return JSON details for device
517
+ */
518
+ override displayJSON(): string {
519
+ const baseInfo = JSON.parse(super.displayJSON());
520
+ const details: Record<string, string> = {
521
+ ...baseInfo,
522
+ 'Mode': this.mode,
523
+ 'Speed': this.speed.toString(),
524
+ 'Filter Life': this.filterLife.toString(),
525
+ 'Screen Status': this.screenStatus,
526
+ 'Child Lock': this.childLock ? 'Enabled' : 'Disabled',
527
+ 'Air Quality': this.airQuality,
528
+ 'Active Time': this.activeTime.toString()
529
+ };
530
+
531
+ return JSON.stringify(details, null, 4);
532
+ }
486
533
  }
@@ -148,11 +148,11 @@ export class VeSyncAirBypass extends VeSyncFan {
148
148
  * Change fan speed
149
149
  */
150
150
  async changeFanSpeed(speed: number): Promise<boolean> {
151
- // const speeds = this.config.levels ?? [];
152
- // if (!speeds.includes(speed)) {
153
- // logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
154
- // return false;
155
- // }
151
+ const speeds = this.config.levels ?? [];
152
+ if (!speeds.includes(speed)) {
153
+ logger.error(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')} for device: ${this.deviceName}`);
154
+ return false;
155
+ }
156
156
 
157
157
  logger.info(`Changing fan speed to ${speed} for device: ${this.deviceName}`);
158
158
 
@@ -346,6 +346,12 @@ export class VeSyncAirBypass extends VeSyncFan {
346
346
  throw new Error(error);
347
347
  }
348
348
 
349
+ // Check if device is on - timer can only be set when device is on
350
+ if (this.deviceStatus !== 'on') {
351
+ logger.debug(`Cannot set timer when device is off: ${this.deviceName}`);
352
+ return false;
353
+ }
354
+
349
355
  logger.debug(`Setting timer to ${hours} hours for device: ${this.deviceName}`);
350
356
 
351
357
  const [response, status] = await this.callApi(
@@ -500,6 +506,12 @@ export class VeSyncAirBypass extends VeSyncFan {
500
506
  * Set auto mode
501
507
  */
502
508
  async autoMode(): Promise<boolean> {
509
+ // Check if auto mode is supported
510
+ if (!this.hasFeature('auto_mode')) {
511
+ logger.debug(`Auto mode not supported for device: ${this.deviceName}`);
512
+ return false;
513
+ }
514
+
503
515
  logger.debug(`Setting auto mode for device: ${this.deviceName}`);
504
516
  const success = await this.setMode('auto');
505
517
  if (!success) {
@@ -555,4 +567,11 @@ export class VeSyncAirBypass extends VeSyncFan {
555
567
  }
556
568
  return success;
557
569
  }
570
+
571
+ /**
572
+ * Get night light state
573
+ */
574
+ get nightLight(): string {
575
+ return this.details.night_light || 'off';
576
+ }
558
577
  }
@@ -73,11 +73,11 @@ export const fanModules: Record<string, new (details: Record<string, any>, manag
73
73
  'LTF-F422S-WUS': VeSyncTowerFan,
74
74
 
75
75
  // Classic Series
76
- 'Classic300S': VeSyncHumidifier,
76
+ 'Classic300S': VeSyncHumid200300S,
77
77
  'Classic200S': VeSyncHumid200S,
78
78
 
79
79
  // Dual Series
80
- 'Dual200S': VeSyncHumidifier,
80
+ 'Dual200S': VeSyncHumid200300S,
81
81
 
82
82
  // LUH Series
83
83
  'LUH-A601S-WUSB': VeSyncHumid200300S,
@@ -19,159 +19,159 @@ export const fanConfig: FanConfig = {
19
19
  // Core Series
20
20
  'Core200S': {
21
21
  module: 'VeSyncAirBypass',
22
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
22
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'sleep_mode'],
23
23
  levels: [1, 2, 3]
24
24
  },
25
25
  'Core300S': {
26
26
  module: 'VeSyncAirBypass',
27
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
27
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
28
28
  levels: [1, 2, 3, 4]
29
29
  },
30
30
  'Core400S': {
31
31
  module: 'VeSyncAirBypass',
32
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
32
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
33
33
  levels: [1, 2, 3, 4]
34
34
  },
35
35
  'Core600S': {
36
36
  module: 'VeSyncAirBypass',
37
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
37
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
38
38
  levels: [1, 2, 3, 4]
39
39
  },
40
40
 
41
41
  // LAP Series
42
42
  'LAP-C201S-AUSR': {
43
43
  module: 'VeSyncAirBypass',
44
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
44
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
45
45
  levels: [1, 2, 3]
46
46
  },
47
47
  'LAP-C202S-WUSR': {
48
48
  module: 'VeSyncAirBypass',
49
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
49
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
50
50
  levels: [1, 2, 3]
51
51
  },
52
52
  'LAP-C301S-WJP': {
53
53
  module: 'VeSyncAirBypass',
54
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
54
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
55
55
  levels: [1, 2, 3, 4]
56
56
  },
57
57
  'LAP-C302S-WUSB': {
58
58
  module: 'VeSyncAirBypass',
59
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
59
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
60
60
  levels: [1, 2, 3, 4]
61
61
  },
62
62
  'LAP-C301S-WAAA': {
63
63
  module: 'VeSyncAirBypass',
64
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
64
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
65
65
  levels: [1, 2, 3, 4]
66
66
  },
67
67
  'LAP-C401S-WJP': {
68
68
  module: 'VeSyncAirBypass',
69
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
69
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
70
70
  levels: [1, 2, 3, 4]
71
71
  },
72
72
  'LAP-C401S-WUSR': {
73
73
  module: 'VeSyncAirBypass',
74
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
74
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
75
75
  levels: [1, 2, 3, 4]
76
76
  },
77
77
  'LAP-C401S-WAAA': {
78
78
  module: 'VeSyncAirBypass',
79
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
79
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
80
80
  levels: [1, 2, 3, 4]
81
81
  },
82
82
  'LAP-C601S-WUS': {
83
83
  module: 'VeSyncAirBypass',
84
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
84
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
85
85
  levels: [1, 2, 3, 4]
86
86
  },
87
87
  'LAP-C601S-WUSR': {
88
88
  module: 'VeSyncAirBypass',
89
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
89
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
90
90
  levels: [1, 2, 3, 4]
91
91
  },
92
92
  'LAP-C601S-WEU': {
93
93
  module: 'VeSyncAirBypass',
94
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
94
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode'],
95
95
  levels: [1, 2, 3, 4]
96
96
  },
97
97
  'LAP-V102S-AASR': {
98
98
  module: 'VeSyncAirBaseV2',
99
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
99
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
100
100
  levels: [1, 2, 3, 4]
101
101
  },
102
102
  'LAP-V102S-WUS': {
103
103
  module: 'VeSyncAirBaseV2',
104
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
104
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
105
105
  levels: [1, 2, 3, 4]
106
106
  },
107
107
  'LAP-V102S-WEU': {
108
108
  module: 'VeSyncAirBaseV2',
109
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
109
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
110
110
  levels: [1, 2, 3, 4]
111
111
  },
112
112
  'LAP-V102S-AUSR': {
113
113
  module: 'VeSyncAirBaseV2',
114
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
114
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
115
115
  levels: [1, 2, 3, 4]
116
116
  },
117
117
  'LAP-V102S-WJP': {
118
118
  module: 'VeSyncAirBaseV2',
119
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
119
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
120
120
  levels: [1, 2, 3, 4]
121
121
  },
122
122
  'LAP-V201S-AASR': {
123
123
  module: 'VeSyncAirBaseV2',
124
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
124
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
125
125
  levels: [1, 2, 3, 4]
126
126
  },
127
127
  'LAP-V201S-WJP': {
128
128
  module: 'VeSyncAirBaseV2',
129
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
129
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
130
130
  levels: [1, 2, 3, 4]
131
131
  },
132
132
  'LAP-V201S-WEU': {
133
133
  module: 'VeSyncAirBaseV2',
134
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
134
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
135
135
  levels: [1, 2, 3, 4]
136
136
  },
137
137
  'LAP-V201S-WUS': {
138
138
  module: 'VeSyncAirBaseV2',
139
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
139
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
140
140
  levels: [1, 2, 3, 4]
141
141
  },
142
142
  'LAP-V201-AUSR': {
143
143
  module: 'VeSyncAirBaseV2',
144
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
144
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
145
145
  levels: [1, 2, 3, 4]
146
146
  },
147
147
  'LAP-V201S-AUSR': {
148
148
  module: 'VeSyncAirBaseV2',
149
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
149
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
150
150
  levels: [1, 2, 3, 4]
151
151
  },
152
152
  'LAP-V201S-AEUR': {
153
153
  module: 'VeSyncAirBaseV2',
154
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
154
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode'],
155
155
  levels: [1, 2, 3, 4]
156
156
  },
157
157
  'LAP-EL551S-AUS': {
158
158
  module: 'VeSyncAirBaseV2',
159
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
159
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode'],
160
160
  levels: [1, 2, 3]
161
161
  },
162
162
  'LAP-EL551S-AEUR': {
163
163
  module: 'VeSyncAirBaseV2',
164
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
164
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode'],
165
165
  levels: [1, 2, 3]
166
166
  },
167
167
  'LAP-EL551S-WEU': {
168
168
  module: 'VeSyncAirBaseV2',
169
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
169
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode'],
170
170
  levels: [1, 2, 3]
171
171
  },
172
172
  'LAP-EL551S-WUS': {
173
173
  module: 'VeSyncAirBaseV2',
174
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
174
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode'],
175
175
  levels: [1, 2, 3]
176
176
  },
177
177
 
@@ -305,12 +305,12 @@ export const fanConfig: FanConfig = {
305
305
  // LV Series
306
306
  'LV-PUR131S': {
307
307
  module: 'VeSyncAir131',
308
- features: ['air_quality', 'display', 'child_lock', 'night_light', 'timer', 'fan_speed'],
308
+ features: ['air_quality', 'display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode'],
309
309
  levels: [1, 2, 3]
310
310
  },
311
311
  'LV-RH131S': {
312
312
  module: 'VeSyncAir131',
313
- features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed'],
313
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode'],
314
314
  levels: [1, 2, 3]
315
315
  }
316
316
  };