tsvesync 1.0.64 → 1.0.65

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.
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fanModules = exports.VeSyncHumid200300S = exports.VeSyncWarmHumidifier = exports.VeSyncHumidifier = exports.VeSyncTowerFan = exports.VeSyncAirBaseV2 = exports.VeSyncAirBypass = void 0;
4
+ const airBypass_1 = require("./airBypass");
5
+ const airBaseV2_1 = require("./airBaseV2");
6
+ const towerFan_1 = require("./towerFan");
7
+ const humidifier_1 = require("./humidifier");
8
+ const humid200300S_1 = require("./humid200300S");
9
+ // Re-export all classes
10
+ var airBypass_2 = require("./airBypass");
11
+ Object.defineProperty(exports, "VeSyncAirBypass", { enumerable: true, get: function () { return airBypass_2.VeSyncAirBypass; } });
12
+ var airBaseV2_2 = require("./airBaseV2");
13
+ Object.defineProperty(exports, "VeSyncAirBaseV2", { enumerable: true, get: function () { return airBaseV2_2.VeSyncAirBaseV2; } });
14
+ var towerFan_2 = require("./towerFan");
15
+ Object.defineProperty(exports, "VeSyncTowerFan", { enumerable: true, get: function () { return towerFan_2.VeSyncTowerFan; } });
16
+ var humidifier_2 = require("./humidifier");
17
+ Object.defineProperty(exports, "VeSyncHumidifier", { enumerable: true, get: function () { return humidifier_2.VeSyncHumidifier; } });
18
+ var warmHumidifier_1 = require("./warmHumidifier");
19
+ Object.defineProperty(exports, "VeSyncWarmHumidifier", { enumerable: true, get: function () { return warmHumidifier_1.VeSyncWarmHumidifier; } });
20
+ var humid200300S_2 = require("./humid200300S");
21
+ Object.defineProperty(exports, "VeSyncHumid200300S", { enumerable: true, get: function () { return humid200300S_2.VeSyncHumid200300S; } });
22
+ // Export fan modules dictionary
23
+ exports.fanModules = {
24
+ // Core Series
25
+ 'Core200S': airBypass_1.VeSyncAirBypass,
26
+ 'Core300S': airBypass_1.VeSyncAirBypass,
27
+ 'Core400S': airBypass_1.VeSyncAirBypass,
28
+ 'Core600S': airBypass_1.VeSyncAirBypass,
29
+ // LAP Series
30
+ 'LAP-C201S-AUSR': airBypass_1.VeSyncAirBypass,
31
+ 'LAP-C202S-WUSR': airBypass_1.VeSyncAirBypass,
32
+ 'LAP-C301S-WJP': airBypass_1.VeSyncAirBypass,
33
+ 'LAP-C302S-WUSB': airBypass_1.VeSyncAirBypass,
34
+ 'LAP-C301S-WAAA': airBypass_1.VeSyncAirBypass,
35
+ 'LAP-C401S-WJP': airBypass_1.VeSyncAirBypass,
36
+ 'LAP-C401S-WUSR': airBypass_1.VeSyncAirBypass,
37
+ 'LAP-C401S-WAAA': airBypass_1.VeSyncAirBypass,
38
+ 'LAP-C601S-WUS': airBypass_1.VeSyncAirBypass,
39
+ 'LAP-C601S-WUSR': airBypass_1.VeSyncAirBypass,
40
+ 'LAP-C601S-WEU': airBypass_1.VeSyncAirBypass,
41
+ // Vital100S Series - Using VeSyncAirBaseV2
42
+ 'LAP-V102S-AASR': airBaseV2_1.VeSyncAirBaseV2,
43
+ 'LAP-V102S-WUS': airBaseV2_1.VeSyncAirBaseV2,
44
+ 'LAP-V102S-WEU': airBaseV2_1.VeSyncAirBaseV2,
45
+ 'LAP-V102S-AUSR': airBaseV2_1.VeSyncAirBaseV2,
46
+ 'LAP-V102S-WJP': airBaseV2_1.VeSyncAirBaseV2,
47
+ // Vital200S Series - Using VeSyncAirBaseV2
48
+ 'LAP-V201S-AASR': airBaseV2_1.VeSyncAirBaseV2,
49
+ 'LAP-V201S-WJP': airBaseV2_1.VeSyncAirBaseV2,
50
+ 'LAP-V201S-WEU': airBaseV2_1.VeSyncAirBaseV2,
51
+ 'LAP-V201S-WUS': airBaseV2_1.VeSyncAirBaseV2,
52
+ 'LAP-V201-AUSR': airBaseV2_1.VeSyncAirBaseV2,
53
+ 'LAP-V201S-AUSR': airBaseV2_1.VeSyncAirBaseV2,
54
+ 'LAP-V201S-AEUR': airBaseV2_1.VeSyncAirBaseV2,
55
+ // EverestAir Series - Using VeSyncAirBaseV2
56
+ 'LAP-EL551S-AUS': airBaseV2_1.VeSyncAirBaseV2,
57
+ 'LAP-EL551S-AEUR': airBaseV2_1.VeSyncAirBaseV2,
58
+ 'LAP-EL551S-WEU': airBaseV2_1.VeSyncAirBaseV2,
59
+ 'LAP-EL551S-WUS': airBaseV2_1.VeSyncAirBaseV2,
60
+ // LTF Series
61
+ 'LTF-F422S-KEU': towerFan_1.VeSyncTowerFan,
62
+ 'LTF-F422S-WUSR': towerFan_1.VeSyncTowerFan,
63
+ 'LTF-F422_WJP': towerFan_1.VeSyncTowerFan,
64
+ 'LTF-F422S-WUS': towerFan_1.VeSyncTowerFan,
65
+ // Classic Series
66
+ 'Classic300S': humidifier_1.VeSyncHumidifier,
67
+ 'Classic200S': humidifier_1.VeSyncHumidifier,
68
+ // Dual Series
69
+ 'Dual200S': humidifier_1.VeSyncHumidifier,
70
+ // LUH Series
71
+ 'LUH-A601S-WUSB': humid200300S_1.VeSyncHumid200300S,
72
+ 'LUH-A601S-AUSW': humid200300S_1.VeSyncHumid200300S,
73
+ 'LUH-D301S-WUSR': humid200300S_1.VeSyncHumid200300S,
74
+ 'LUH-D301S-WJP': humid200300S_1.VeSyncHumid200300S,
75
+ 'LUH-D301S-WEU': humid200300S_1.VeSyncHumid200300S,
76
+ 'LUH-A602S-WUSR': humid200300S_1.VeSyncHumid200300S,
77
+ 'LUH-A602S-WUS': humid200300S_1.VeSyncHumid200300S,
78
+ 'LUH-A602S-WEUR': humid200300S_1.VeSyncHumid200300S,
79
+ 'LUH-A602S-WEU': humid200300S_1.VeSyncHumid200300S,
80
+ 'LUH-A602S-WJP': humid200300S_1.VeSyncHumid200300S,
81
+ 'LUH-A602S-WUSC': humid200300S_1.VeSyncHumid200300S,
82
+ 'LUH-O451S-WEU': humid200300S_1.VeSyncHumid200300S,
83
+ 'LUH-O451S-WUS': humid200300S_1.VeSyncHumid200300S,
84
+ 'LUH-O451S-WUSR': humid200300S_1.VeSyncHumid200300S,
85
+ 'LUH-O601S-WUS': humid200300S_1.VeSyncHumid200300S,
86
+ 'LUH-O601S-KUS': humid200300S_1.VeSyncHumid200300S,
87
+ 'LUH-M101S-WUS': humid200300S_1.VeSyncHumid200300S,
88
+ 'LUH-M101S-WEUR': humid200300S_1.VeSyncHumid200300S,
89
+ // LEH Series
90
+ 'LEH-S601S-WUS': humid200300S_1.VeSyncHumid200300S,
91
+ 'LEH-S601S-WUSR': humid200300S_1.VeSyncHumid200300S,
92
+ // LV Series
93
+ 'LV-PUR131S': airBypass_1.VeSyncAirBypass,
94
+ 'LV-RH131S': airBypass_1.VeSyncAirBypass
95
+ };
@@ -0,0 +1,105 @@
1
+ import { VeSyncAirBaseV2 } from './airBaseV2';
2
+ import { VeSync } from '../vesync';
3
+ /**
4
+ * VeSync Tower Fan Implementation
5
+ */
6
+ export declare class VeSyncTowerFan extends VeSyncAirBaseV2 {
7
+ protected readonly towerModes: readonly ["normal", "advancedSleep", "off"];
8
+ constructor(details: Record<string, any>, manager: VeSync);
9
+ /**
10
+ * Get device details
11
+ */
12
+ getDetails(): Promise<Boolean>;
13
+ /**
14
+ * Toggle device power
15
+ */
16
+ toggleSwitch(toggle: boolean): Promise<boolean>;
17
+ /**
18
+ * Turn device on
19
+ */
20
+ turnOn(): Promise<boolean>;
21
+ /**
22
+ * Turn device off
23
+ */
24
+ turnOff(): Promise<boolean>;
25
+ /**
26
+ * Set tower fan mode
27
+ */
28
+ mode_toggle(mode: string): Promise<boolean>;
29
+ /**
30
+ * Change fan speed
31
+ */
32
+ changeFanSpeed(speed: number): Promise<boolean>;
33
+ /**
34
+ * Set normal mode
35
+ */
36
+ normal_mode(): Promise<boolean>;
37
+ /**
38
+ * Set manual mode - adapter to set mode to normal
39
+ */
40
+ manual_mode(): Promise<boolean>;
41
+ /**
42
+ * Set advanced sleep mode
43
+ */
44
+ advanced_sleep_mode(): Promise<boolean>;
45
+ /**
46
+ * Set sleep mode - adapter for advanced sleep mode
47
+ */
48
+ sleep_mode(): Promise<boolean>;
49
+ /**
50
+ * Override setMode to handle tower fan specific modes
51
+ */
52
+ setMode(mode: string): Promise<boolean>;
53
+ /**
54
+ * Get current speed
55
+ */
56
+ get speed(): number;
57
+ /**
58
+ * Get display status
59
+ */
60
+ get displayState(): boolean;
61
+ /**
62
+ * Get oscillation status
63
+ */
64
+ get oscillationState(): boolean;
65
+ /**
66
+ * Get mute status
67
+ */
68
+ get muteState(): boolean;
69
+ /**
70
+ * Get temperature (in tenths of a degree)
71
+ */
72
+ get temperature(): number;
73
+ /**
74
+ * Get humidity percentage
75
+ */
76
+ get humidity(): number;
77
+ /**
78
+ * Get thermal comfort level
79
+ */
80
+ get thermalComfort(): number;
81
+ /**
82
+ * Get sleep preferences
83
+ */
84
+ get sleepPreference(): Record<string, any>;
85
+ /**
86
+ * Get schedule count
87
+ */
88
+ get scheduleCount(): number;
89
+ /**
90
+ * Get error code
91
+ */
92
+ get errorCode(): number;
93
+ /**
94
+ * Turn oscillation on
95
+ */
96
+ setOscillationOn(): Promise<boolean>;
97
+ /**
98
+ * Turn oscillation off
99
+ */
100
+ setOscillationOff(): Promise<boolean>;
101
+ /**
102
+ * Display device info
103
+ */
104
+ display(): void;
105
+ }
@@ -0,0 +1,279 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VeSyncTowerFan = void 0;
4
+ const airBaseV2_1 = require("./airBaseV2");
5
+ const logger_1 = require("../logger");
6
+ /**
7
+ * VeSync Tower Fan Implementation
8
+ */
9
+ class VeSyncTowerFan extends airBaseV2_1.VeSyncAirBaseV2 {
10
+ constructor(details, manager) {
11
+ super(details, manager);
12
+ this.towerModes = ['normal', 'advancedSleep', 'off'];
13
+ logger_1.logger.debug(`Initialized VeSyncTowerFan device: ${this.deviceName}`);
14
+ }
15
+ /**
16
+ * Get device details
17
+ */
18
+ async getDetails() {
19
+ logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
20
+ const [head, body] = this.buildApiDict('getTowerFanStatus');
21
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', body, head);
22
+ if (!this.checkResponse([response, status], 'getDetails') || !(response === null || response === void 0 ? void 0 : response.result)) {
23
+ logger_1.logger.debug('Error getting tower fan details');
24
+ this.connectionStatus = 'offline';
25
+ return false;
26
+ }
27
+ const innerResponse = response.result;
28
+ if (innerResponse.code !== 0 || !innerResponse.result) {
29
+ logger_1.logger.debug('Error in inner response from tower fan');
30
+ this.connectionStatus = 'offline';
31
+ return false;
32
+ }
33
+ const deviceData = innerResponse.result;
34
+ this.deviceStatus = deviceData.powerSwitch === 1 ? 'on' : 'off';
35
+ this.details = {
36
+ powerSwitch: deviceData.powerSwitch,
37
+ workMode: deviceData.workMode,
38
+ manualSpeedLevel: deviceData.manualSpeedLevel,
39
+ fanSpeedLevel: deviceData.fanSpeedLevel,
40
+ screenState: deviceData.screenState,
41
+ screenSwitch: deviceData.screenSwitch,
42
+ oscillationState: deviceData.oscillationState,
43
+ oscillationSwitch: deviceData.oscillationSwitch,
44
+ timerRemain: deviceData.timerRemain,
45
+ temperature: deviceData.temperature || 0,
46
+ humidity: deviceData.humidity || 0,
47
+ thermalComfort: deviceData.thermalComfort,
48
+ sleepPreference: deviceData.sleepPreference || {},
49
+ scheduleCount: deviceData.scheduleCount,
50
+ displayingType: deviceData.displayingType,
51
+ errorCode: deviceData.errorCode
52
+ };
53
+ logger_1.logger.debug(`Successfully got details for device: ${this.deviceName}`);
54
+ return true;
55
+ }
56
+ /**
57
+ * Toggle device power
58
+ */
59
+ async toggleSwitch(toggle) {
60
+ if (typeof toggle !== 'boolean') {
61
+ logger_1.logger.debug('Invalid toggle value for tower fan switch');
62
+ return false;
63
+ }
64
+ const [head, body] = this.buildApiDict('setSwitch');
65
+ body.payload.data = {
66
+ powerSwitch: toggle ? 1 : 0,
67
+ switchIdx: 0
68
+ };
69
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', body, head);
70
+ const success = this.checkResponse([response, status], 'toggleSwitch');
71
+ if (success) {
72
+ this.deviceStatus = toggle ? 'on' : 'off';
73
+ }
74
+ else {
75
+ logger_1.logger.debug('Error toggling tower fan power');
76
+ }
77
+ return success;
78
+ }
79
+ /**
80
+ * Turn device on
81
+ */
82
+ async turnOn() {
83
+ logger_1.logger.debug(`Turning on device: ${this.deviceName}`);
84
+ return this.toggleSwitch(true);
85
+ }
86
+ /**
87
+ * Turn device off
88
+ */
89
+ async turnOff() {
90
+ logger_1.logger.debug(`Turning off device: ${this.deviceName}`);
91
+ return this.toggleSwitch(false);
92
+ }
93
+ /**
94
+ * Set tower fan mode
95
+ */
96
+ async mode_toggle(mode) {
97
+ if (!this.towerModes.includes(mode)) {
98
+ logger_1.logger.debug(`Invalid mode: ${mode}. Must be one of: ${this.towerModes.join(', ')}`);
99
+ return false;
100
+ }
101
+ if (mode === 'off') {
102
+ return this.turnOff();
103
+ }
104
+ const [head, body] = this.buildApiDict('setTowerFanMode');
105
+ body.deviceId = this.cid;
106
+ body.payload.data = {
107
+ workMode: mode
108
+ };
109
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', body, head);
110
+ const success = this.checkResponse([response, status], 'mode_toggle');
111
+ if (success) {
112
+ this.details.workMode = mode;
113
+ }
114
+ else {
115
+ logger_1.logger.error(`Failed to set ${mode} mode for device: ${this.deviceName}`);
116
+ }
117
+ return success;
118
+ }
119
+ /**
120
+ * Change fan speed
121
+ */
122
+ async changeFanSpeed(speed) {
123
+ // const speeds = this.config.levels ?? [];
124
+ // if (!speeds.includes(speed)) {
125
+ // logger.debug(`Invalid speed: ${speed}. Must be one of: ${speeds.join(', ')}`);
126
+ // return false;
127
+ // }
128
+ const [head, body] = this.buildApiDict('setLevel');
129
+ body.payload.data = {
130
+ levelIdx: 0,
131
+ levelType: 'wind',
132
+ manualSpeedLevel: speed
133
+ };
134
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', body, head);
135
+ const success = this.checkResponse([response, status], 'changeFanSpeed');
136
+ if (success) {
137
+ this.details.manualSpeedLevel = speed;
138
+ }
139
+ else {
140
+ logger_1.logger.debug('Error setting fan speed');
141
+ }
142
+ return success;
143
+ }
144
+ /**
145
+ * Set normal mode
146
+ */
147
+ async normal_mode() {
148
+ logger_1.logger.debug(`Setting normal mode for device: ${this.deviceName}`);
149
+ return this.mode_toggle('normal');
150
+ }
151
+ /**
152
+ * Set manual mode - adapter to set mode to normal
153
+ */
154
+ async manual_mode() {
155
+ logger_1.logger.debug(`Setting manual mode for device: ${this.deviceName}`);
156
+ return this.normal_mode();
157
+ }
158
+ /**
159
+ * Set advanced sleep mode
160
+ */
161
+ async advanced_sleep_mode() {
162
+ logger_1.logger.debug(`Setting advanced sleep mode for device: ${this.deviceName}`);
163
+ return this.mode_toggle('advancedSleep');
164
+ }
165
+ /**
166
+ * Set sleep mode - adapter for advanced sleep mode
167
+ */
168
+ async sleep_mode() {
169
+ logger_1.logger.debug(`Setting sleep mode for device: ${this.deviceName}`);
170
+ return this.advanced_sleep_mode();
171
+ }
172
+ /**
173
+ * Override setMode to handle tower fan specific modes
174
+ */
175
+ async setMode(mode) {
176
+ return this.mode_toggle(mode);
177
+ }
178
+ /**
179
+ * Get current speed
180
+ */
181
+ get speed() {
182
+ return this.details.manualSpeedLevel || 0;
183
+ }
184
+ /**
185
+ * Get display status
186
+ */
187
+ get displayState() {
188
+ return Boolean(this.details.screenState);
189
+ }
190
+ /**
191
+ * Get oscillation status
192
+ */
193
+ get oscillationState() {
194
+ return Boolean(this.details.oscillationState);
195
+ }
196
+ /**
197
+ * Get mute status
198
+ */
199
+ get muteState() {
200
+ return Boolean(this.details.muteState);
201
+ }
202
+ /**
203
+ * Get temperature (in tenths of a degree)
204
+ */
205
+ get temperature() {
206
+ return this.details.temperature || 0;
207
+ }
208
+ /**
209
+ * Get humidity percentage
210
+ */
211
+ get humidity() {
212
+ return this.details.humidity || 0;
213
+ }
214
+ /**
215
+ * Get thermal comfort level
216
+ */
217
+ get thermalComfort() {
218
+ return this.details.thermalComfort || 0;
219
+ }
220
+ /**
221
+ * Get sleep preferences
222
+ */
223
+ get sleepPreference() {
224
+ return this.details.sleepPreference || {};
225
+ }
226
+ /**
227
+ * Get schedule count
228
+ */
229
+ get scheduleCount() {
230
+ return this.details.scheduleCount || 0;
231
+ }
232
+ /**
233
+ * Get error code
234
+ */
235
+ get errorCode() {
236
+ return this.details.errorCode || 0;
237
+ }
238
+ /**
239
+ * Turn oscillation on
240
+ */
241
+ async setOscillationOn() {
242
+ return this.setOscillation(true);
243
+ }
244
+ /**
245
+ * Turn oscillation off
246
+ */
247
+ async setOscillationOff() {
248
+ return this.setOscillation(false);
249
+ }
250
+ /**
251
+ * Display device info
252
+ */
253
+ display() {
254
+ super.display();
255
+ const info = [
256
+ ['Mode: ', this.details.workMode || ''],
257
+ ['Speed: ', this.speed],
258
+ ['Fan Speed Level: ', this.details.fanSpeedLevel || 0],
259
+ ['Display: ', this.displayState],
260
+ ['Display Switch: ', this.details.screenSwitch],
261
+ ['Oscillation: ', this.oscillationState],
262
+ ['Oscillation Switch: ', this.details.oscillationSwitch],
263
+ ['Mute: ', this.muteState],
264
+ ['Mute Switch: ', this.details.muteSwitch],
265
+ ['Timer: ', this.timer],
266
+ ['Temperature: ', this.temperature / 10, '°C'],
267
+ ['Humidity: ', this.humidity, '%'],
268
+ ['Thermal Comfort: ', this.thermalComfort],
269
+ ['Sleep Preference: ', JSON.stringify(this.sleepPreference)],
270
+ ['Schedule Count: ', this.scheduleCount],
271
+ ['Displaying Type: ', this.details.displayingType],
272
+ ['Error Code: ', this.errorCode]
273
+ ];
274
+ for (const [key, value, unit = ''] of info) {
275
+ logger_1.logger.info(`${key.toString().padEnd(30, '.')} ${value}${unit}`);
276
+ }
277
+ }
278
+ }
279
+ exports.VeSyncTowerFan = VeSyncTowerFan;
@@ -0,0 +1,49 @@
1
+ import { VeSyncHumidifier } from './humidifier';
2
+ import { VeSync } from '../vesync';
3
+ /**
4
+ * VeSync Warm Humidifier Class
5
+ */
6
+ export declare class VeSyncWarmHumidifier extends VeSyncHumidifier {
7
+ protected readonly warmLevels: number[];
8
+ constructor(details: Record<string, any>, manager: VeSync);
9
+ /**
10
+ * Get device details
11
+ */
12
+ getDetails(): Promise<Boolean>;
13
+ /**
14
+ * Change fan speed - Implemented to satisfy interface but redirects to setMistLevel
15
+ */
16
+ changeFanSpeed(speed: number): Promise<boolean>;
17
+ /**
18
+ * Set device mode
19
+ */
20
+ setMode(mode: string): Promise<boolean>;
21
+ /**
22
+ * Set warm mist level
23
+ */
24
+ setWarmLevel(level: number): Promise<boolean>;
25
+ /**
26
+ * Set drying mode enabled
27
+ */
28
+ setDryingModeEnabled(enabled: boolean): Promise<boolean>;
29
+ /**
30
+ * Get warm mist enabled status
31
+ */
32
+ get warmMistEnabled(): boolean;
33
+ /**
34
+ * Get drying mode enabled status
35
+ */
36
+ get dryingModeEnabled(): boolean;
37
+ /**
38
+ * Get drying mode state
39
+ */
40
+ get dryingModeState(): string;
41
+ /**
42
+ * Get drying mode level
43
+ */
44
+ get dryingModeLevel(): number;
45
+ /**
46
+ * Get drying mode seconds remaining
47
+ */
48
+ get dryingModeSecondsRemaining(): number;
49
+ }