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.
@@ -11,158 +11,158 @@ exports.fanConfig = {
11
11
  // Core Series
12
12
  'Core200S': {
13
13
  module: 'VeSyncAirBypass',
14
- features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'sleep_mode'],
14
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
19
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
24
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
29
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
35
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
40
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
45
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
50
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
55
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
60
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
65
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
70
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
75
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
80
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode', 'sleep_mode'],
85
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'sleep_mode', 'filter_life'],
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', 'auto_mode'],
90
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
95
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
100
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
105
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
110
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
115
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
120
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
125
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
130
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
135
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
140
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
145
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
150
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
155
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
160
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
165
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
293
+ features: ['air_quality', 'display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
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', 'auto_mode'],
298
+ features: ['display', 'child_lock', 'night_light', 'timer', 'fan_speed', 'auto_mode', 'filter_life'],
299
299
  levels: [1, 2, 3]
300
300
  }
301
301
  };
@@ -375,7 +375,14 @@ class VeSyncFan extends vesyncBaseDevice_1.VeSyncBaseDevice {
375
375
  */
376
376
  get filterLife() {
377
377
  var _a;
378
- return (_a = this.details.filter_life) !== null && _a !== void 0 ? _a : 0;
378
+ // Handle different filter_life formats from different devices
379
+ const filterLife = this.details.filter_life;
380
+ // For Air131 devices, filter_life is an object with percent property
381
+ if (typeof filterLife === 'object' && filterLife !== null && 'percent' in filterLife) {
382
+ return (_a = filterLife.percent) !== null && _a !== void 0 ? _a : 0;
383
+ }
384
+ // For other devices, filter_life is a direct number
385
+ return typeof filterLife === 'number' ? filterLife : 0;
379
386
  }
380
387
  /**
381
388
  * Get screen status
@@ -392,12 +399,46 @@ class VeSyncFan extends vesyncBaseDevice_1.VeSyncBaseDevice {
392
399
  return (_a = this.details.child_lock) !== null && _a !== void 0 ? _a : false;
393
400
  }
394
401
  /**
395
- * Get air quality (if supported)
402
+ * Get air quality level (if supported)
396
403
  */
397
- get airQuality() {
404
+ get airQualityLevel() {
398
405
  var _a;
399
406
  return (_a = this.details.air_quality) !== null && _a !== void 0 ? _a : '';
400
407
  }
408
+ /**
409
+ * Get air quality (alias for airQualityLevel for backward compatibility)
410
+ */
411
+ get airQuality() {
412
+ return this.airQualityLevel;
413
+ }
414
+ /**
415
+ * Get air quality value - PM2.5 in μg/m³ (if supported)
416
+ */
417
+ get airQualityValue() {
418
+ var _a;
419
+ return (_a = this.details.air_quality_value) !== null && _a !== void 0 ? _a : 0;
420
+ }
421
+ /**
422
+ * Get PM1 value (if supported)
423
+ */
424
+ get pm1() {
425
+ var _a;
426
+ return (_a = this.details.pm1) !== null && _a !== void 0 ? _a : 0;
427
+ }
428
+ /**
429
+ * Get PM10 value (if supported)
430
+ */
431
+ get pm10() {
432
+ var _a;
433
+ return (_a = this.details.pm10) !== null && _a !== void 0 ? _a : 0;
434
+ }
435
+ /**
436
+ * Get air quality percentage (if supported)
437
+ */
438
+ get aqPercent() {
439
+ var _a;
440
+ return (_a = this.details.aq_percent) !== null && _a !== void 0 ? _a : 0;
441
+ }
401
442
  /**
402
443
  * Get humidity level (if supported)
403
444
  */
@@ -445,7 +486,19 @@ class VeSyncFan extends vesyncBaseDevice_1.VeSyncBaseDevice {
445
486
  info.push(['Child Lock: ', this.childLock ? 'Enabled' : 'Disabled']);
446
487
  }
447
488
  if (this.hasFeature('air_quality')) {
448
- info.push(['Air Quality: ', this.airQuality]);
489
+ info.push(['Air Quality Level: ', this.airQualityLevel]);
490
+ if (this.airQualityValue > 0) {
491
+ info.push(['Air Quality Value: ', this.airQualityValue, ' μg/m³']);
492
+ }
493
+ if (this.pm1 > 0) {
494
+ info.push(['PM1: ', this.pm1, ' μg/m³']);
495
+ }
496
+ if (this.pm10 > 0) {
497
+ info.push(['PM10: ', this.pm10, ' μg/m³']);
498
+ }
499
+ if (this.aqPercent > 0) {
500
+ info.push(['AQ Percent: ', this.aqPercent, '%']);
501
+ }
449
502
  }
450
503
  if (this.hasFeature('humidity')) {
451
504
  info.push(['Humidity: ', this.humidity, '%']);
@@ -486,7 +539,19 @@ class VeSyncFan extends vesyncBaseDevice_1.VeSyncBaseDevice {
486
539
  details['Child Lock'] = this.childLock ? 'Enabled' : 'Disabled';
487
540
  }
488
541
  if (this.hasFeature('air_quality')) {
489
- details['Air Quality'] = this.airQuality;
542
+ details['Air Quality Level'] = this.airQualityLevel.toString();
543
+ if (this.airQualityValue > 0) {
544
+ details['Air Quality Value'] = this.airQualityValue.toString();
545
+ }
546
+ if (this.pm1 > 0) {
547
+ details['PM1'] = this.pm1.toString();
548
+ }
549
+ if (this.pm10 > 0) {
550
+ details['PM10'] = this.pm10.toString();
551
+ }
552
+ if (this.aqPercent > 0) {
553
+ details['AQ Percent'] = this.aqPercent.toString();
554
+ }
490
555
  }
491
556
  if (this.hasFeature('humidity')) {
492
557
  details['Humidity'] = this.humidity.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsvesync",
3
- "version": "1.0.90",
3
+ "version": "1.0.92",
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",
@@ -67,10 +67,11 @@ export class VeSyncAir131 extends VeSyncFan {
67
67
  this.details = {
68
68
  mode: data.mode || 'manual', // Default to manual if not specified
69
69
  speed: data.level || 0,
70
- filterLife: data.filterLife || 0,
71
- screenStatus: data.screenStatus || 'off',
72
- childLock: data.childLock || false,
73
- airQuality: data.airQuality || 'unknown',
70
+ filter_life: data.filterLife || data.filter_life || 0,
71
+ screen_status: data.screenStatus || 'off',
72
+ child_lock: data.childLock || false,
73
+ air_quality: data.airQuality || 'unknown',
74
+ air_quality_value: data.air_quality_value || 0,
74
75
  active_time: data.activeTime || 0
75
76
  };
76
77
 
@@ -64,12 +64,18 @@ export class VeSyncAirBypass extends VeSyncFan {
64
64
  this.details = {
65
65
  mode: result.mode || '',
66
66
  speed: result.level || 0,
67
- filterLife: result.filter_life || 0,
68
- screenStatus: result.display ? 'on' : 'off',
69
- childLock: result.child_lock || false,
70
- airQuality: result.air_quality || 0
67
+ filter_life: result.filter_life || 0,
68
+ screen_status: result.display ? 'on' : 'off',
69
+ child_lock: result.child_lock || false,
70
+ air_quality: result.air_quality || 0,
71
+ air_quality_value: result.air_quality_value || 0
71
72
  };
72
73
 
74
+ // Capture additional air quality properties if available
75
+ if ('PM1' in result) this.details.pm1 = result.PM1;
76
+ if ('PM10' in result) this.details.pm10 = result.PM10;
77
+ if ('AQPercent' in result) this.details.aq_percent = result.AQPercent;
78
+
73
79
  // Don't overwrite config as it contains features array
74
80
  if (result.configuration) {
75
81
  this.details.configuration = result.configuration;