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.
@@ -16,153 +16,153 @@ exports.fanConfig = {
16
16
  },
17
17
  'Core300S': {
18
18
  module: 'VeSyncAirBypass',
19
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer'],
19
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
24
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
29
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
35
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
40
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
45
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
50
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
55
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
60
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
65
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
70
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
75
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
80
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
85
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
90
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
95
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
100
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
105
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
110
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed'],
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'],
115
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
120
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
125
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
130
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
135
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
140
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
145
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed'],
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'],
150
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
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'],
155
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
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'],
160
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
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'],
165
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed'],
166
166
  levels: [1, 2, 3]
167
167
  },
168
168
  // LTF Series
@@ -289,13 +289,13 @@ exports.fanConfig = {
289
289
  },
290
290
  // LV Series
291
291
  'LV-PUR131S': {
292
- module: 'VeSyncAirBypass',
293
- features: ['air_quality', 'display', 'child_lock', 'night_light', 'timer'],
292
+ module: 'VeSyncAir131',
293
+ features: ['air_quality', 'display', 'child_lock', 'night_light', 'timer', 'fan_speed'],
294
294
  levels: [1, 2, 3]
295
295
  },
296
296
  'LV-RH131S': {
297
- module: 'VeSyncAirBypass',
298
- features: ['display', 'child_lock', 'night_light', 'timer'],
297
+ module: 'VeSyncAir131',
298
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed'],
299
299
  levels: [1, 2, 3]
300
300
  }
301
301
  };
@@ -322,6 +322,40 @@ class VeSyncFan extends vesyncBaseDevice_1.VeSyncBaseDevice {
322
322
  hasFeature(feature) {
323
323
  return this.config.features.includes(feature);
324
324
  }
325
+ /**
326
+ * Check if feature is supported in current mode
327
+ */
328
+ isFeatureSupportedInCurrentMode(feature) {
329
+ // First check if the feature is supported at all
330
+ if (!this.hasFeature(feature)) {
331
+ return false;
332
+ }
333
+ // Check mode-specific restrictions
334
+ const currentMode = this.mode;
335
+ // Some features are not supported in sleep mode
336
+ if (currentMode === 'sleep') {
337
+ // Display and child lock are not supported in sleep mode
338
+ if (feature === 'display' || feature === 'child_lock') {
339
+ return false;
340
+ }
341
+ }
342
+ // Fan speed is only supported in manual mode for some devices
343
+ if (feature === 'fan_speed' && this.deviceType.startsWith('LV-')) {
344
+ return currentMode === 'manual';
345
+ }
346
+ // Auto mode is not supported on Core200S
347
+ if (feature === 'auto_mode' && this.deviceType.includes('Core200S')) {
348
+ return false;
349
+ }
350
+ // Feature is supported in current mode
351
+ return true;
352
+ }
353
+ /**
354
+ * Get maximum fan speed level
355
+ */
356
+ getMaxFanSpeed() {
357
+ return this.config.levels ? Math.max(...this.config.levels) : 3;
358
+ }
325
359
  /**
326
360
  * Get current mode
327
361
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsvesync",
3
- "version": "1.0.72",
3
+ "version": "1.0.74",
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",
@@ -39,9 +39,11 @@
39
39
  "js-yaml": "^4.1.0"
40
40
  },
41
41
  "devDependencies": {
42
+ "@types/inquirer": "^9.0.7",
42
43
  "@types/js-yaml": "^4.0.9",
43
44
  "@types/node": "^22.10.2",
44
45
  "dotenv": "^16.4.7",
46
+ "inquirer": "^12.4.2",
45
47
  "ts-node": "^10.9.2",
46
48
  "typescript": "^5.7.2"
47
49
  },