tsvesync 1.0.42 → 1.0.44

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.
@@ -5,7 +5,7 @@ import { VeSyncBaseDevice } from './vesyncBaseDevice';
5
5
  import { VeSync } from './vesync';
6
6
  interface FanConfig {
7
7
  [key: string]: {
8
- module: 'VeSyncAirBypass' | 'VeSyncHumidifier' | 'VeSyncWarmHumidifier' | 'VeSyncTowerFan';
8
+ module: 'VeSyncAirBypass' | 'VeSyncHumidifier' | 'VeSyncWarmHumidifier' | 'VeSyncTowerFan' | 'VeSyncAirBaseV2';
9
9
  features: string[];
10
10
  };
11
11
  }
@@ -18,6 +18,10 @@ export declare abstract class VeSyncFan extends VeSyncBaseDevice {
18
18
  protected mode_dict: Record<string, any>;
19
19
  protected speed_dict: Record<string, any>;
20
20
  protected features: string[];
21
+ protected _timer: number | {
22
+ duration: number;
23
+ action: string;
24
+ } | null;
21
25
  constructor(details: Record<string, any>, manager: VeSync);
22
26
  /**
23
27
  * Check if feature is supported
@@ -62,7 +66,14 @@ export declare abstract class VeSyncFan extends VeSyncBaseDevice {
62
66
  /**
63
67
  * Get timer status
64
68
  */
65
- get timer(): number;
69
+ get timer(): number | {
70
+ duration: number;
71
+ action: string;
72
+ } | null;
73
+ set timer(value: number | {
74
+ duration: number;
75
+ action: string;
76
+ } | null);
66
77
  /**
67
78
  * Return formatted device info to stdout
68
79
  */
@@ -71,68 +71,68 @@ exports.fanConfig = {
71
71
  features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
72
72
  },
73
73
  'LAP-V102S-AASR': {
74
- module: 'VeSyncAirBypass',
74
+ module: 'VeSyncAirBaseV2',
75
75
  features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
76
76
  },
77
77
  'LAP-V102S-WUS': {
78
- module: 'VeSyncAirBypass',
78
+ module: 'VeSyncAirBaseV2',
79
79
  features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
80
80
  },
81
81
  'LAP-V102S-WEU': {
82
- module: 'VeSyncAirBypass',
82
+ module: 'VeSyncAirBaseV2',
83
83
  features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
84
84
  },
85
85
  'LAP-V102S-AUSR': {
86
- module: 'VeSyncAirBypass',
86
+ module: 'VeSyncAirBaseV2',
87
87
  features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
88
88
  },
89
89
  'LAP-V102S-WJP': {
90
- module: 'VeSyncAirBypass',
90
+ module: 'VeSyncAirBaseV2',
91
91
  features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
92
92
  },
93
93
  'LAP-V201S-AASR': {
94
- module: 'VeSyncAirBypass',
95
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
94
+ module: 'VeSyncAirBaseV2',
95
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection']
96
96
  },
97
97
  'LAP-V201S-WJP': {
98
- module: 'VeSyncAirBypass',
99
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
98
+ module: 'VeSyncAirBaseV2',
99
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection']
100
100
  },
101
101
  'LAP-V201S-WEU': {
102
- module: 'VeSyncAirBypass',
103
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
102
+ module: 'VeSyncAirBaseV2',
103
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection']
104
104
  },
105
105
  'LAP-V201S-WUS': {
106
- module: 'VeSyncAirBypass',
107
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
106
+ module: 'VeSyncAirBaseV2',
107
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection']
108
108
  },
109
109
  'LAP-V201-AUSR': {
110
- module: 'VeSyncAirBypass',
111
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
110
+ module: 'VeSyncAirBaseV2',
111
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection']
112
112
  },
113
113
  'LAP-V201S-AUSR': {
114
- module: 'VeSyncAirBypass',
115
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
114
+ module: 'VeSyncAirBaseV2',
115
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection']
116
116
  },
117
117
  'LAP-V201S-AEUR': {
118
- module: 'VeSyncAirBypass',
119
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
118
+ module: 'VeSyncAirBaseV2',
119
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'light_detection']
120
120
  },
121
121
  'LAP-EL551S-AUS': {
122
- module: 'VeSyncAirBypass',
123
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
122
+ module: 'VeSyncAirBaseV2',
123
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate']
124
124
  },
125
125
  'LAP-EL551S-AEUR': {
126
- module: 'VeSyncAirBypass',
127
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
126
+ module: 'VeSyncAirBaseV2',
127
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate']
128
128
  },
129
129
  'LAP-EL551S-WEU': {
130
- module: 'VeSyncAirBypass',
131
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
130
+ module: 'VeSyncAirBaseV2',
131
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate']
132
132
  },
133
133
  'LAP-EL551S-WUS': {
134
- module: 'VeSyncAirBypass',
135
- features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer']
134
+ module: 'VeSyncAirBaseV2',
135
+ features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_rotate']
136
136
  },
137
137
  // LTF Series
138
138
  'LTF-F422S-KEU': {
@@ -268,6 +268,7 @@ class VeSyncFan extends vesyncBaseDevice_1.VeSyncBaseDevice {
268
268
  this.mode_dict = {};
269
269
  this.speed_dict = {};
270
270
  this.features = [];
271
+ this._timer = null;
271
272
  this.details = details;
272
273
  this.features = ((_a = exports.fanConfig[this.deviceType]) === null || _a === void 0 ? void 0 : _a.features) || [];
273
274
  }
@@ -344,8 +345,10 @@ class VeSyncFan extends vesyncBaseDevice_1.VeSyncBaseDevice {
344
345
  * Get timer status
345
346
  */
346
347
  get timer() {
347
- var _a;
348
- return (_a = this.details.timer) !== null && _a !== void 0 ? _a : 0;
348
+ return this._timer;
349
+ }
350
+ set timer(value) {
351
+ this._timer = value;
349
352
  }
350
353
  /**
351
354
  * Return formatted device info to stdout
@@ -375,8 +378,14 @@ class VeSyncFan extends vesyncBaseDevice_1.VeSyncBaseDevice {
375
378
  if (this.hasFeature('warm')) {
376
379
  info.push(['Warm Level: ', this.warmLevel]);
377
380
  }
378
- if (this.hasFeature('timer')) {
379
- info.push(['Timer: ', this.timer, 'hours']);
381
+ if (this.hasFeature('timer') && this.timer) {
382
+ if (typeof this.timer === 'number') {
383
+ info.push(['Timer: ', this.timer, 'hours']);
384
+ }
385
+ else {
386
+ info.push(['Timer: ', this.timer.duration, 'seconds']);
387
+ info.push(['Timer Action: ', this.timer.action]);
388
+ }
380
389
  }
381
390
  for (const [key, value, unit = ''] of info) {
382
391
  logger_1.logger.info(`${key.toString().padEnd(30, '.')} ${value}${unit}`);
@@ -410,8 +419,14 @@ class VeSyncFan extends vesyncBaseDevice_1.VeSyncBaseDevice {
410
419
  if (this.hasFeature('warm')) {
411
420
  details['Warm Level'] = this.warmLevel.toString();
412
421
  }
413
- if (this.hasFeature('timer')) {
414
- details['Timer'] = this.timer.toString();
422
+ if (this.hasFeature('timer') && this.timer) {
423
+ if (typeof this.timer === 'number') {
424
+ details['Timer'] = this.timer.toString();
425
+ }
426
+ else {
427
+ details['Timer'] = this.timer.duration.toString();
428
+ details['Timer Action'] = this.timer.action;
429
+ }
415
430
  }
416
431
  return JSON.stringify({
417
432
  ...baseInfo,
@@ -61,21 +61,17 @@ export declare class VeSyncAirBypass extends VeSyncFan {
61
61
  */
62
62
  automaticStopOff(): Promise<boolean>;
63
63
  /**
64
- * Set mode
64
+ * Set auto mode
65
65
  */
66
- mode_toggle(mode: string): Promise<boolean>;
66
+ autoMode(): Promise<boolean>;
67
67
  /**
68
68
  * Set manual mode
69
69
  */
70
- manual_mode(): Promise<boolean>;
70
+ manualMode(): Promise<boolean>;
71
71
  /**
72
72
  * Set sleep mode
73
73
  */
74
- sleep_mode(): Promise<boolean>;
75
- /**
76
- * Set auto mode
77
- */
78
- auto_mode(): Promise<boolean>;
74
+ sleepMode(): Promise<boolean>;
79
75
  /**
80
76
  * Turn off display
81
77
  */
@@ -84,10 +80,6 @@ export declare class VeSyncAirBypass extends VeSyncFan {
84
80
  * Turn on display
85
81
  */
86
82
  turnOnDisplay(): Promise<boolean>;
87
- /**
88
- * Display device info
89
- */
90
- display(): void;
91
83
  }
92
84
  /**
93
85
  * VeSync Humidifier Base Class
@@ -165,10 +157,6 @@ export declare class VeSyncHumidifier extends VeSyncFan {
165
157
  * Set manual mode
166
158
  */
167
159
  setManualMode(): Promise<boolean>;
168
- /**
169
- * Set sleep mode
170
- */
171
- sleepMode(): Promise<boolean>;
172
160
  /**
173
161
  * Turn off display
174
162
  */
@@ -231,43 +219,101 @@ export declare class VeSyncWarmHumidifier extends VeSyncHumidifier {
231
219
  export declare class VeSyncAirBaseV2 extends VeSyncAirBypass {
232
220
  protected _lightDetection: boolean;
233
221
  protected _lightDetectionState: boolean;
222
+ protected setSpeedLevel: number | null;
223
+ protected autoPreferences: string[];
224
+ protected enabled: boolean;
225
+ protected _mode: string;
226
+ protected _speed: number;
227
+ protected _timer: {
228
+ duration: number;
229
+ action: string;
230
+ } | null;
234
231
  constructor(details: Record<string, any>, manager: VeSync);
232
+ protected buildConfigDict(configDict: Record<string, any>): void;
233
+ get mode(): string;
234
+ set mode(value: string);
235
+ get speed(): number;
236
+ set speed(value: number);
237
+ get timer(): {
238
+ duration: number;
239
+ action: string;
240
+ } | null;
241
+ set timer(value: {
242
+ duration: number;
243
+ action: string;
244
+ } | null);
235
245
  /**
236
246
  * Build API dictionary
237
247
  */
238
248
  protected buildApiDict(method: string): [Record<string, any>, Record<string, any>];
239
- get lightDetection(): boolean;
240
- set lightDetection(toggle: boolean);
241
- get lightDetectionState(): boolean;
242
- setLightDetection(toggle: boolean): Promise<boolean>;
243
- setLightDetectionOn(): Promise<boolean>;
244
- setLightDetectionOff(): Promise<boolean>;
245
- turboMode(): Promise<boolean>;
246
- petMode(): Promise<boolean>;
247
249
  /**
248
- * Build configuration dictionary
250
+ * Get device details
249
251
  */
250
- protected buildConfigDict(configDict: Record<string, any>): void;
252
+ getDetails(): Promise<Boolean>;
253
+ /**
254
+ * Build purifier dictionary
255
+ */
256
+ protected buildPurifierDict(devDict: Record<string, any>): void;
257
+ /**
258
+ * Toggle device power
259
+ */
260
+ toggleSwitch(toggle: boolean): Promise<boolean>;
261
+ /**
262
+ * Turn device on - compatibility method that proxies to toggleSwitch
263
+ */
264
+ turnOn(): Promise<boolean>;
265
+ /**
266
+ * Turn device off - compatibility method that proxies to toggleSwitch
267
+ */
268
+ turnOff(): Promise<boolean>;
269
+ /**
270
+ * Change fan speed
271
+ */
272
+ changeFanSpeed(speed: number): Promise<boolean>;
251
273
  /**
252
274
  * Set mode
253
275
  */
254
- mode_toggle(mode: string): Promise<boolean>;
276
+ setMode(mode: string): Promise<boolean>;
255
277
  /**
256
- * Set manual mode
278
+ * Set display status
257
279
  */
258
- manual_mode(): Promise<boolean>;
280
+ setDisplay(enabled: boolean): Promise<boolean>;
259
281
  /**
260
- * Set sleep mode
282
+ * Set child lock
261
283
  */
262
- sleep_mode(): Promise<boolean>;
284
+ setChildLock(enabled: boolean): Promise<boolean>;
263
285
  /**
264
- * Set auto mode
286
+ * Set timer
265
287
  */
266
- auto_mode(): Promise<boolean>;
288
+ setTimer(timerDuration: number, action?: 'on' | 'off', method?: string): Promise<boolean>;
289
+ /**
290
+ * Clear timer
291
+ */
292
+ clearTimer(): Promise<boolean>;
267
293
  /**
268
- * Set turbo mode
294
+ * Set auto preference
269
295
  */
270
- turbo_mode(): Promise<boolean>;
296
+ setAutoPreference(preference?: string, roomSize?: number): Promise<boolean>;
297
+ /**
298
+ * Set light detection
299
+ */
300
+ setLightDetection(enabled: boolean): Promise<boolean>;
301
+ /**
302
+ * Get light detection status
303
+ */
304
+ get lightDetection(): boolean;
305
+ /**
306
+ * Get light detection state
307
+ */
308
+ get lightDetectionState(): boolean;
309
+ /**
310
+ * Get auto preference type
311
+ */
312
+ get autoPreferenceType(): string | null;
313
+ /**
314
+ * Display JSON details
315
+ */
316
+ displayJSON(): string;
271
317
  }
272
318
  /**
273
319
  * VeSync Tower Fan Implementation
@@ -276,6 +322,17 @@ export declare class VeSyncTowerFan extends VeSyncAirBaseV2 {
276
322
  protected readonly towerModes: readonly ["normal", "advancedSleep", "off"];
277
323
  protected readonly speeds: number[];
278
324
  constructor(details: Record<string, any>, manager: VeSync);
325
+ /**
326
+ * Get timer status (in seconds)
327
+ */
328
+ get timer(): {
329
+ duration: number;
330
+ action: string;
331
+ } | null;
332
+ set timer(value: {
333
+ duration: number;
334
+ action: string;
335
+ } | null);
279
336
  /**
280
337
  * Build API dictionary
281
338
  */
@@ -340,10 +397,6 @@ export declare class VeSyncTowerFan extends VeSyncAirBaseV2 {
340
397
  * Get mute status
341
398
  */
342
399
  get muteState(): boolean;
343
- /**
344
- * Get timer status (in seconds)
345
- */
346
- get timer(): number;
347
400
  /**
348
401
  * Get temperature (in tenths of a degree)
349
402
  */