tsvesync 1.0.90 → 1.0.92

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.
@@ -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', 'timer', 'fan_speed', 'sleep_mode'],
22
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
27
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
32
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
37
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
44
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
49
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
54
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
59
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
64
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
69
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
74
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
79
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
84
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
89
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
94
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode'],
99
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
104
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
109
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
114
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
119
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
124
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
129
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
134
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
139
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
144
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
149
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
154
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
159
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
164
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
169
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
174
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
308
+ features: ['air_quality', 'display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
313
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
314
314
  levels: [1, 2, 3]
315
315
  }
316
316
  };
@@ -322,10 +322,14 @@ export abstract class VeSyncFan extends VeSyncBaseDevice {
322
322
  protected details: {
323
323
  mode?: string;
324
324
  speed?: number;
325
- filter_life?: number;
325
+ filter_life?: number | { percent: number };
326
326
  screen_status?: 'on' | 'off';
327
327
  child_lock?: boolean;
328
- air_quality?: string;
328
+ air_quality?: string | number;
329
+ air_quality_value?: number;
330
+ pm1?: number;
331
+ pm10?: number;
332
+ aq_percent?: number;
329
333
  humidity?: number;
330
334
  mist_level?: number;
331
335
  warm_level?: number;
@@ -417,7 +421,16 @@ export abstract class VeSyncFan extends VeSyncBaseDevice {
417
421
  * Get filter life percentage
418
422
  */
419
423
  get filterLife(): number {
420
- return this.details.filter_life ?? 0;
424
+ // Handle different filter_life formats from different devices
425
+ const filterLife = this.details.filter_life;
426
+
427
+ // For Air131 devices, filter_life is an object with percent property
428
+ if (typeof filterLife === 'object' && filterLife !== null && 'percent' in filterLife) {
429
+ return filterLife.percent ?? 0;
430
+ }
431
+
432
+ // For other devices, filter_life is a direct number
433
+ return typeof filterLife === 'number' ? filterLife : 0;
421
434
  }
422
435
 
423
436
  /**
@@ -435,12 +448,47 @@ export abstract class VeSyncFan extends VeSyncBaseDevice {
435
448
  }
436
449
 
437
450
  /**
438
- * Get air quality (if supported)
451
+ * Get air quality level (if supported)
439
452
  */
440
- get airQuality(): string {
453
+ get airQualityLevel(): string | number {
441
454
  return this.details.air_quality ?? '';
442
455
  }
443
456
 
457
+ /**
458
+ * Get air quality (alias for airQualityLevel for backward compatibility)
459
+ */
460
+ get airQuality(): string | number {
461
+ return this.airQualityLevel;
462
+ }
463
+
464
+ /**
465
+ * Get air quality value - PM2.5 in μg/m³ (if supported)
466
+ */
467
+ get airQualityValue(): number {
468
+ return this.details.air_quality_value ?? 0;
469
+ }
470
+
471
+ /**
472
+ * Get PM1 value (if supported)
473
+ */
474
+ get pm1(): number {
475
+ return this.details.pm1 ?? 0;
476
+ }
477
+
478
+ /**
479
+ * Get PM10 value (if supported)
480
+ */
481
+ get pm10(): number {
482
+ return this.details.pm10 ?? 0;
483
+ }
484
+
485
+ /**
486
+ * Get air quality percentage (if supported)
487
+ */
488
+ get aqPercent(): number {
489
+ return this.details.aq_percent ?? 0;
490
+ }
491
+
444
492
  /**
445
493
  * Get humidity level (if supported)
446
494
  */
@@ -491,7 +539,19 @@ export abstract class VeSyncFan extends VeSyncBaseDevice {
491
539
  info.push(['Child Lock: ', this.childLock ? 'Enabled' : 'Disabled']);
492
540
  }
493
541
  if (this.hasFeature('air_quality')) {
494
- info.push(['Air Quality: ', this.airQuality]);
542
+ info.push(['Air Quality Level: ', this.airQualityLevel]);
543
+ if (this.airQualityValue > 0) {
544
+ info.push(['Air Quality Value: ', this.airQualityValue, ' μg/m³']);
545
+ }
546
+ if (this.pm1 > 0) {
547
+ info.push(['PM1: ', this.pm1, ' μg/m³']);
548
+ }
549
+ if (this.pm10 > 0) {
550
+ info.push(['PM10: ', this.pm10, ' μg/m³']);
551
+ }
552
+ if (this.aqPercent > 0) {
553
+ info.push(['AQ Percent: ', this.aqPercent, '%']);
554
+ }
495
555
  }
496
556
  if (this.hasFeature('humidity')) {
497
557
  info.push(['Humidity: ', this.humidity, '%']);
@@ -534,7 +594,19 @@ export abstract class VeSyncFan extends VeSyncBaseDevice {
534
594
  details['Child Lock'] = this.childLock ? 'Enabled' : 'Disabled';
535
595
  }
536
596
  if (this.hasFeature('air_quality')) {
537
- details['Air Quality'] = this.airQuality;
597
+ details['Air Quality Level'] = this.airQualityLevel.toString();
598
+ if (this.airQualityValue > 0) {
599
+ details['Air Quality Value'] = this.airQualityValue.toString();
600
+ }
601
+ if (this.pm1 > 0) {
602
+ details['PM1'] = this.pm1.toString();
603
+ }
604
+ if (this.pm10 > 0) {
605
+ details['PM10'] = this.pm10.toString();
606
+ }
607
+ if (this.aqPercent > 0) {
608
+ details['AQ Percent'] = this.aqPercent.toString();
609
+ }
538
610
  }
539
611
  if (this.hasFeature('humidity')) {
540
612
  details['Humidity'] = this.humidity.toString();