tsvesync 1.0.72 → 1.0.74

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.
@@ -1,5 +1,6 @@
1
1
  import { VeSyncAirBypass } from './airBypass';
2
2
  import { VeSyncAirBaseV2 } from './airBaseV2';
3
+ import { VeSyncAir131 } from './air131';
3
4
  import { VeSyncTowerFan } from './towerFan';
4
5
  import { VeSyncHumidifier } from './humidifier';
5
6
  import { VeSyncWarmHumidifier } from './warmHumidifier';
@@ -13,6 +14,7 @@ import { VeSync } from '../vesync';
13
14
  // Re-export all classes
14
15
  export { VeSyncAirBypass } from './airBypass';
15
16
  export { VeSyncAirBaseV2 } from './airBaseV2';
17
+ export { VeSyncAir131 } from './air131';
16
18
  export { VeSyncTowerFan } from './towerFan';
17
19
  export { VeSyncHumidifier } from './humidifier';
18
20
  export { VeSyncWarmHumidifier } from './warmHumidifier';
@@ -102,6 +104,6 @@ export const fanModules: Record<string, new (details: Record<string, any>, manag
102
104
  'LEH-S601S-WUSR': VeSyncSuperior6000S,
103
105
 
104
106
  // LV Series
105
- 'LV-PUR131S': VeSyncAirBypass,
106
- 'LV-RH131S': VeSyncAirBypass
107
+ 'LV-PUR131S': VeSyncAir131,
108
+ 'LV-RH131S': VeSyncAir131
107
109
  };
@@ -8,7 +8,7 @@ import { logger } from './logger';
8
8
 
9
9
  interface FanConfig {
10
10
  [key: string]: {
11
- module: 'VeSyncAirBypass' | 'VeSyncHumidifier' | 'VeSyncWarmHumidifier' | 'VeSyncTowerFan' | 'VeSyncAirBaseV2' | 'VeSyncSuperior6000S' | 'VeSyncHumid1000S' | 'VeSyncHumid200S';
11
+ module: 'VeSyncAirBypass' | 'VeSyncHumidifier' | 'VeSyncWarmHumidifier' | 'VeSyncTowerFan' | 'VeSyncAirBaseV2' | 'VeSyncSuperior6000S' | 'VeSyncHumid1000S' | 'VeSyncHumid200S' | 'VeSyncAir131';
12
12
  features: string[];
13
13
  levels?: number[];
14
14
  };
@@ -24,154 +24,154 @@ export const fanConfig: FanConfig = {
24
24
  },
25
25
  'Core300S': {
26
26
  module: 'VeSyncAirBypass',
27
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer'],
27
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
32
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
37
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
44
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
49
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
54
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
59
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
64
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
69
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
74
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
79
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
84
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
89
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
94
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
99
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
104
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
109
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
114
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
119
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
124
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
129
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
134
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
139
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
144
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
149
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
154
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
159
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
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'],
164
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
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'],
169
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
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'],
174
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
175
175
  levels: [1, 2, 3]
176
176
  },
177
177
 
@@ -304,13 +304,13 @@ export const fanConfig: FanConfig = {
304
304
 
305
305
  // LV Series
306
306
  'LV-PUR131S': {
307
- module: 'VeSyncAirBypass',
308
- features: ['air_quality', 'display', 'child_lock', 'night_light', 'timer'],
307
+ module: 'VeSyncAir131',
308
+ features: ['air_quality', 'display', 'child_lock', 'night_light', 'timer', 'fan_speed'],
309
309
  levels: [1, 2, 3]
310
310
  },
311
311
  'LV-RH131S': {
312
- module: 'VeSyncAirBypass',
313
- features: ['display', 'child_lock', 'night_light', 'timer'],
312
+ module: 'VeSyncAir131',
313
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed'],
314
314
  levels: [1, 2, 3]
315
315
  }
316
316
  };
@@ -336,7 +336,7 @@ export abstract class VeSyncFan extends VeSyncBaseDevice {
336
336
  protected speed_dict: Record<string, any> = {};
337
337
  protected _timer: number | { duration: number; action: string } | null = null;
338
338
  protected config: {
339
- module: 'VeSyncAirBypass' | 'VeSyncHumidifier' | 'VeSyncWarmHumidifier' | 'VeSyncTowerFan' | 'VeSyncAirBaseV2' | 'VeSyncSuperior6000S' | 'VeSyncHumid1000S' | 'VeSyncHumid200S';
339
+ module: 'VeSyncAirBypass' | 'VeSyncHumidifier' | 'VeSyncWarmHumidifier' | 'VeSyncTowerFan' | 'VeSyncAirBaseV2' | 'VeSyncSuperior6000S' | 'VeSyncHumid1000S' | 'VeSyncHumid200S' | 'VeSyncAir131';
340
340
  features: string[];
341
341
  levels?: number[];
342
342
  };
@@ -358,6 +358,47 @@ export abstract class VeSyncFan extends VeSyncBaseDevice {
358
358
  return this.config.features.includes(feature);
359
359
  }
360
360
 
361
+ /**
362
+ * Check if feature is supported in current mode
363
+ */
364
+ isFeatureSupportedInCurrentMode(feature: string): boolean {
365
+ // First check if the feature is supported at all
366
+ if (!this.hasFeature(feature)) {
367
+ return false;
368
+ }
369
+
370
+ // Check mode-specific restrictions
371
+ const currentMode = this.mode;
372
+
373
+ // Some features are not supported in sleep mode
374
+ if (currentMode === 'sleep') {
375
+ // Display and child lock are not supported in sleep mode
376
+ if (feature === 'display' || feature === 'child_lock') {
377
+ return false;
378
+ }
379
+ }
380
+
381
+ // Fan speed is only supported in manual mode for some devices
382
+ if (feature === 'fan_speed' && this.deviceType.startsWith('LV-')) {
383
+ return currentMode === 'manual';
384
+ }
385
+
386
+ // Auto mode is not supported on Core200S
387
+ if (feature === 'auto_mode' && this.deviceType.includes('Core200S')) {
388
+ return false;
389
+ }
390
+
391
+ // Feature is supported in current mode
392
+ return true;
393
+ }
394
+
395
+ /**
396
+ * Get maximum fan speed level
397
+ */
398
+ getMaxFanSpeed(): number {
399
+ return this.config.levels ? Math.max(...this.config.levels) : 3;
400
+ }
401
+
361
402
  /**
362
403
  * Get current mode
363
404
  */