tsvesync 1.0.63 → 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,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VeSyncHumid200300S = void 0;
4
+ const warmHumidifier_1 = require("./warmHumidifier");
5
+ const helpers_1 = require("../helpers");
6
+ const logger_1 = require("../logger");
7
+ /**
8
+ * VeSync Humidifier 200/300S Class
9
+ */
10
+ class VeSyncHumid200300S extends warmHumidifier_1.VeSyncWarmHumidifier {
11
+ constructor(details, manager) {
12
+ super(details, manager);
13
+ this.modes = ['auto', 'manual', 'sleep'];
14
+ this.features = ['humidity', 'mist', 'display', 'timer', 'auto_mode'];
15
+ this.mistLevels = [1, 2, 3, 4, 5, 6, 7, 8, 9];
16
+ this.humidityRange = { min: 30, max: 80 };
17
+ logger_1.logger.debug(`Initialized VeSyncHumid200300S device: ${this.deviceName}`);
18
+ }
19
+ /**
20
+ * Get device details
21
+ */
22
+ async getDetails() {
23
+ var _a;
24
+ logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
25
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
26
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
27
+ cid: this.cid,
28
+ configModule: this.configModule,
29
+ payload: {
30
+ data: {},
31
+ method: 'getHumidifierStatus',
32
+ source: 'APP'
33
+ }
34
+ }, helpers_1.Helpers.reqHeaderBypass());
35
+ const success = this.checkResponse([response, status], 'getDetails');
36
+ if (success && ((_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.result)) {
37
+ const result = response.result.result;
38
+ // Update device status based on enabled field
39
+ this.deviceStatus = result.enabled ? 'on' : 'off';
40
+ this.details = {
41
+ mode: result.mode || '',
42
+ humidity: result.humidity || 0, // Current humidity
43
+ target_humidity: result.target_humidity || result.humidity || 0, // Target humidity
44
+ mist_level: result.mist_level || 0,
45
+ mist_virtual_level: result.mist_virtual_level || 0,
46
+ warm_level: result.warm_level || 0,
47
+ water_lacks: result.water_lacks || false,
48
+ humidity_high: result.humidity_high || false,
49
+ water_tank_lifted: result.water_tank_lifted || false,
50
+ display: result.display || false,
51
+ automatic_stop: result.automatic_stop_reach_target || false,
52
+ configuration: result.configuration || {},
53
+ connection_status: result.connection_status || null,
54
+ night_light_brightness: result.night_light_brightness || 0
55
+ };
56
+ // Log raw response for debugging
57
+ logger_1.logger.debug(`Raw API Response: ${JSON.stringify(response)}`);
58
+ logger_1.logger.debug(`Parsed Result: ${JSON.stringify(result)}`);
59
+ logger_1.logger.debug(`Successfully got details for device: ${this.deviceName}`);
60
+ }
61
+ return success;
62
+ }
63
+ /**
64
+ * Set mist level
65
+ */
66
+ async setMistLevel(level) {
67
+ if (!this.mistLevels.includes(level)) {
68
+ const error = `Invalid mist level: ${level}. Must be one of: ${this.mistLevels.join(', ')}`;
69
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
70
+ throw new Error(error);
71
+ }
72
+ logger_1.logger.info(`Setting mist level to ${level} for device: ${this.deviceName}`);
73
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
74
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
75
+ cid: this.cid,
76
+ configModule: this.configModule,
77
+ payload: {
78
+ data: {
79
+ id: 0,
80
+ level: level,
81
+ type: 'mist'
82
+ },
83
+ method: 'setVirtualLevel', // Use setVirtualLevel per YAML spec
84
+ source: 'APP'
85
+ }
86
+ }, helpers_1.Helpers.reqHeaderBypass());
87
+ const success = this.checkResponse([response, status], 'setMistLevel');
88
+ logger_1.logger.debug(`Mist Level API Response: ${JSON.stringify(response)}`);
89
+ logger_1.logger.debug(`Mist Level API Status: ${status}`);
90
+ if (success) {
91
+ this.details.mist_level = level;
92
+ this.details.mist_virtual_level = level;
93
+ // Get latest state and log it
94
+ await this.getDetails();
95
+ logger_1.logger.debug(`Device state after mist level change: ${JSON.stringify(this.details)}`);
96
+ }
97
+ else {
98
+ logger_1.logger.error(`Failed to set mist level to ${level} for device: ${this.deviceName}`);
99
+ }
100
+ return success;
101
+ }
102
+ /**
103
+ * Set night light brightness
104
+ */
105
+ async setNightLightBrightness(brightness) {
106
+ if (brightness < 0 || brightness > 100) {
107
+ const error = `Invalid brightness: ${brightness}. Must be between 0 and 100`;
108
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
109
+ throw new Error(error);
110
+ }
111
+ logger_1.logger.debug(`Setting night light brightness to ${brightness} for device: ${this.deviceName}`);
112
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
113
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
114
+ cid: this.cid,
115
+ configModule: this.configModule,
116
+ payload: {
117
+ data: {
118
+ brightness
119
+ },
120
+ method: 'setNightLight',
121
+ source: 'APP'
122
+ }
123
+ }, helpers_1.Helpers.reqHeaderBypass());
124
+ const success = this.checkResponse([response, status], 'setNightLightBrightness');
125
+ if (success) {
126
+ this.details.night_light_brightness = brightness;
127
+ }
128
+ else {
129
+ logger_1.logger.error(`Failed to set night light brightness to ${brightness} for device: ${this.deviceName}`);
130
+ }
131
+ return success;
132
+ }
133
+ /**
134
+ * Get night light brightness
135
+ */
136
+ get nightLightBrightness() {
137
+ return this.details.night_light_brightness || 0;
138
+ }
139
+ /**
140
+ * Get configuration
141
+ */
142
+ get configuration() {
143
+ return this.details.configuration || {};
144
+ }
145
+ /**
146
+ * Get mist level
147
+ * Override base class to return virtual level
148
+ */
149
+ get mistLevel() {
150
+ return this.details.mist_virtual_level || 0;
151
+ }
152
+ /**
153
+ * Get target humidity
154
+ * Override base class to return target humidity instead of current humidity
155
+ */
156
+ get humidity() {
157
+ return this.details.target_humidity || 0;
158
+ }
159
+ /**
160
+ * Set target humidity
161
+ * Override base class to properly update target humidity
162
+ */
163
+ async setHumidity(humidity) {
164
+ if (!this.hasFeature('humidity')) {
165
+ const error = 'Humidity control not supported';
166
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
167
+ throw new Error(error);
168
+ }
169
+ if (humidity < this.humidityRange.min || humidity > this.humidityRange.max) {
170
+ const error = `Invalid humidity: ${humidity}. Must be between ${this.humidityRange.min} and ${this.humidityRange.max}`;
171
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
172
+ throw new Error(error);
173
+ }
174
+ logger_1.logger.debug(`Setting target humidity to ${humidity}% for device: ${this.deviceName}`);
175
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
176
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
177
+ cid: this.cid,
178
+ configModule: this.configModule,
179
+ payload: {
180
+ data: {
181
+ target_humidity: humidity
182
+ },
183
+ method: 'setTargetHumidity',
184
+ source: 'APP'
185
+ }
186
+ }, helpers_1.Helpers.reqHeaderBypass());
187
+ const success = this.checkResponse([response, status], 'setHumidity');
188
+ if (success) {
189
+ this.details.target_humidity = humidity;
190
+ // Get latest state and log it
191
+ await this.getDetails();
192
+ logger_1.logger.debug(`Device state after humidity change: ${JSON.stringify(this.details)}`);
193
+ }
194
+ else {
195
+ logger_1.logger.error(`Failed to set target humidity to ${humidity}% for device: ${this.deviceName}`);
196
+ }
197
+ return success;
198
+ }
199
+ }
200
+ exports.VeSyncHumid200300S = VeSyncHumid200300S;
@@ -0,0 +1,83 @@
1
+ import { VeSyncFan } from '../vesyncFan';
2
+ import { VeSync } from '../vesync';
3
+ /**
4
+ * VeSync Humidifier Base Class
5
+ */
6
+ export declare class VeSyncHumidifier extends VeSyncFan {
7
+ protected readonly modes: readonly ["auto", "manual", "sleep"];
8
+ protected readonly mistLevels: number[];
9
+ protected readonly displayModes: readonly ["on", "off"];
10
+ protected readonly humidityRange: {
11
+ min: number;
12
+ max: number;
13
+ };
14
+ constructor(details: Record<string, any>, manager: VeSync);
15
+ /**
16
+ * Get device details
17
+ */
18
+ getDetails(): Promise<Boolean>;
19
+ /**
20
+ * Turn device on
21
+ */
22
+ turnOn(): Promise<boolean>;
23
+ /**
24
+ * Turn device off
25
+ */
26
+ turnOff(): Promise<boolean>;
27
+ /**
28
+ * Toggle device power
29
+ */
30
+ toggleSwitch(enabled: boolean): Promise<boolean>;
31
+ /**
32
+ * Set mist level
33
+ */
34
+ setMistLevel(level: number): Promise<boolean>;
35
+ /**
36
+ * Change fan speed - Implemented to satisfy interface but redirects to setMistLevel
37
+ */
38
+ changeFanSpeed(speed: number): Promise<boolean>;
39
+ /**
40
+ * Set device mode
41
+ */
42
+ setMode(mode: string): Promise<boolean>;
43
+ /**
44
+ * Set target humidity
45
+ */
46
+ setHumidity(humidity: number): Promise<boolean>;
47
+ /**
48
+ * Set display status
49
+ */
50
+ setDisplay(enabled: boolean): Promise<boolean>;
51
+ /**
52
+ * Set timer
53
+ */
54
+ setTimer(hours: number): Promise<boolean>;
55
+ /**
56
+ * Clear timer
57
+ */
58
+ clearTimer(): Promise<boolean>;
59
+ /**
60
+ * Turn automatic stop on
61
+ */
62
+ automaticStopOn(): Promise<boolean>;
63
+ /**
64
+ * Turn automatic stop off
65
+ */
66
+ automaticStopOff(): Promise<boolean>;
67
+ /**
68
+ * Set auto mode
69
+ */
70
+ setAutoMode(): Promise<boolean>;
71
+ /**
72
+ * Set manual mode
73
+ */
74
+ setManualMode(): Promise<boolean>;
75
+ /**
76
+ * Turn off display
77
+ */
78
+ turnOffDisplay(): Promise<boolean>;
79
+ /**
80
+ * Turn on display
81
+ */
82
+ turnOnDisplay(): Promise<boolean>;
83
+ }
@@ -0,0 +1,388 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VeSyncHumidifier = void 0;
4
+ const vesyncFan_1 = require("../vesyncFan");
5
+ const helpers_1 = require("../helpers");
6
+ const logger_1 = require("../logger");
7
+ /**
8
+ * VeSync Humidifier Base Class
9
+ */
10
+ class VeSyncHumidifier extends vesyncFan_1.VeSyncFan {
11
+ constructor(details, manager) {
12
+ super(details, manager);
13
+ this.modes = ['auto', 'manual', 'sleep'];
14
+ this.displayModes = ['on', 'off'];
15
+ this.humidityRange = { min: 30, max: 80 };
16
+ // Set mist levels based on model
17
+ switch (this.deviceType) {
18
+ case 'Dual200S':
19
+ case 'LUH-D301S-WUSR':
20
+ case 'LUH-D301S-WJP':
21
+ case 'LUH-D301S-WEU':
22
+ this.mistLevels = [1, 2];
23
+ break;
24
+ default:
25
+ // All other models support levels 1-9
26
+ this.mistLevels = [1, 2, 3, 4, 5, 6, 7, 8, 9];
27
+ }
28
+ logger_1.logger.debug(`Initialized VeSyncHumidifier device: ${this.deviceName}`);
29
+ }
30
+ /**
31
+ * Get device details
32
+ */
33
+ async getDetails() {
34
+ var _a;
35
+ logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
36
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
37
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
38
+ cid: this.cid,
39
+ configModule: this.configModule,
40
+ payload: {
41
+ data: {},
42
+ method: 'getHumidifierStatus',
43
+ source: 'APP'
44
+ }
45
+ }, helpers_1.Helpers.reqHeaderBypass());
46
+ const success = this.checkResponse([response, status], 'getDetails');
47
+ if (success && ((_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.result)) {
48
+ const result = response.result.result;
49
+ // Handle model-specific status fields
50
+ if (this.deviceType.startsWith('Classic') || this.deviceType === 'Dual200S') {
51
+ this.deviceStatus = result.enabled ? 'on' : 'off';
52
+ }
53
+ else {
54
+ this.deviceStatus = result.powerSwitch === 1 ? 'on' : 'off';
55
+ }
56
+ this.details = {
57
+ mode: result.mode || '',
58
+ humidity: result.humidity || 0,
59
+ mist_level: result.level || 0,
60
+ mist_virtual_level: result.virtualLevel || 0,
61
+ warm_level: result.level || 0,
62
+ water_lacks: result.waterLacks || false,
63
+ humidity_high: result.humidityHigh || false,
64
+ water_tank_lifted: result.waterTankLifted || false,
65
+ display: result.display || false,
66
+ automatic_stop: result.automaticStop || false,
67
+ configuration: result.configuration || {},
68
+ connection_status: result.connectionStatus || null
69
+ };
70
+ logger_1.logger.debug(`Successfully got details for device: ${this.deviceName}`);
71
+ }
72
+ return success;
73
+ }
74
+ /**
75
+ * Turn device on
76
+ */
77
+ async turnOn() {
78
+ return this.toggleSwitch(true);
79
+ }
80
+ /**
81
+ * Turn device off
82
+ */
83
+ async turnOff() {
84
+ return this.toggleSwitch(false);
85
+ }
86
+ /**
87
+ * Toggle device power
88
+ */
89
+ async toggleSwitch(enabled) {
90
+ logger_1.logger.info(`Setting device power to ${enabled ? 'on' : 'off'}: ${this.deviceName}`);
91
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
92
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
93
+ cid: this.cid,
94
+ configModule: this.configModule,
95
+ payload: {
96
+ data: {
97
+ enabled: enabled,
98
+ id: 0
99
+ },
100
+ method: 'setSwitch',
101
+ source: 'APP'
102
+ }
103
+ }, helpers_1.Helpers.reqHeaderBypass());
104
+ const success = this.checkResponse([response, status], 'toggleSwitch');
105
+ if (success) {
106
+ this.deviceStatus = enabled ? 'on' : 'off';
107
+ }
108
+ else {
109
+ logger_1.logger.error(`Failed to set device power to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
110
+ }
111
+ return success;
112
+ }
113
+ /**
114
+ * Set mist level
115
+ */
116
+ async setMistLevel(level) {
117
+ if (!this.mistLevels.includes(level)) {
118
+ const error = `Invalid mist level: ${level}. Must be one of: ${this.mistLevels.join(', ')}`;
119
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
120
+ throw new Error(error);
121
+ }
122
+ logger_1.logger.info(`Setting mist level to ${level} for device: ${this.deviceName}`);
123
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
124
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
125
+ cid: this.cid,
126
+ configModule: this.configModule,
127
+ payload: {
128
+ data: {
129
+ id: 0,
130
+ level: level,
131
+ type: 'mist'
132
+ },
133
+ method: 'setVirtualLevel',
134
+ source: 'APP'
135
+ }
136
+ }, helpers_1.Helpers.reqHeaderBypass());
137
+ const success = this.checkResponse([response, status], 'setMistLevel');
138
+ if (!success) {
139
+ logger_1.logger.error(`Failed to set mist level to ${level} for device: ${this.deviceName}`);
140
+ }
141
+ return success;
142
+ }
143
+ /**
144
+ * Change fan speed - Implemented to satisfy interface but redirects to setMistLevel
145
+ */
146
+ async changeFanSpeed(speed) {
147
+ logger_1.logger.debug(`Redirecting fan speed change to mist level for device: ${this.deviceName}`);
148
+ return this.setMistLevel(speed);
149
+ }
150
+ /**
151
+ * Set device mode
152
+ */
153
+ async setMode(mode) {
154
+ if (!this.modes.includes(mode)) {
155
+ const error = `Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`;
156
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
157
+ throw new Error(error);
158
+ }
159
+ logger_1.logger.debug(`Setting mode to ${mode} for device: ${this.deviceName}`);
160
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
161
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
162
+ cid: this.cid,
163
+ configModule: this.configModule,
164
+ payload: {
165
+ data: {
166
+ mode
167
+ },
168
+ method: 'setHumidityMode',
169
+ source: 'APP'
170
+ }
171
+ }, helpers_1.Helpers.reqHeaderBypass());
172
+ const success = this.checkResponse([response, status], 'setMode');
173
+ if (success) {
174
+ this.details.mode = mode;
175
+ }
176
+ else {
177
+ logger_1.logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
178
+ }
179
+ return success;
180
+ }
181
+ /**
182
+ * Set target humidity
183
+ */
184
+ async setHumidity(humidity) {
185
+ if (!this.hasFeature('humidity')) {
186
+ const error = 'Humidity control not supported';
187
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
188
+ throw new Error(error);
189
+ }
190
+ if (humidity < this.humidityRange.min || humidity > this.humidityRange.max) {
191
+ const error = `Invalid humidity: ${humidity}. Must be between ${this.humidityRange.min} and ${this.humidityRange.max}`;
192
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
193
+ throw new Error(error);
194
+ }
195
+ logger_1.logger.debug(`Setting target humidity to ${humidity}% for device: ${this.deviceName}`);
196
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
197
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
198
+ cid: this.cid,
199
+ configModule: this.configModule,
200
+ payload: {
201
+ data: {
202
+ target_humidity: humidity
203
+ },
204
+ method: 'setTargetHumidity',
205
+ source: 'APP'
206
+ }
207
+ }, helpers_1.Helpers.reqHeaderBypass());
208
+ const success = this.checkResponse([response, status], 'setHumidity');
209
+ if (!success) {
210
+ logger_1.logger.error(`Failed to set target humidity to ${humidity}% for device: ${this.deviceName}`);
211
+ }
212
+ return success;
213
+ }
214
+ /**
215
+ * Set display status
216
+ */
217
+ async setDisplay(enabled) {
218
+ if (!this.hasFeature('display')) {
219
+ const error = 'Display control not supported';
220
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
221
+ throw new Error(error);
222
+ }
223
+ logger_1.logger.debug(`Setting display to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
224
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
225
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
226
+ cid: this.cid,
227
+ configModule: this.configModule,
228
+ payload: {
229
+ data: {
230
+ state: enabled
231
+ },
232
+ method: 'setDisplay',
233
+ source: 'APP'
234
+ }
235
+ }, helpers_1.Helpers.reqHeaderBypass());
236
+ const success = this.checkResponse([response, status], 'setDisplay');
237
+ if (!success) {
238
+ logger_1.logger.error(`Failed to set display to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
239
+ }
240
+ return success;
241
+ }
242
+ /**
243
+ * Set timer
244
+ */
245
+ async setTimer(hours) {
246
+ if (!this.hasFeature('timer')) {
247
+ const error = 'Timer not supported';
248
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
249
+ throw new Error(error);
250
+ }
251
+ logger_1.logger.debug(`Setting timer to ${hours} hours for device: ${this.deviceName}`);
252
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
253
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
254
+ cid: this.cid,
255
+ configModule: this.configModule,
256
+ payload: {
257
+ data: {
258
+ action: 'off',
259
+ total: hours * 3600
260
+ },
261
+ method: 'addTimer',
262
+ source: 'APP'
263
+ }
264
+ }, helpers_1.Helpers.reqHeaderBypass());
265
+ const success = this.checkResponse([response, status], 'setTimer');
266
+ if (!success) {
267
+ logger_1.logger.error(`Failed to set timer to ${hours} hours for device: ${this.deviceName}`);
268
+ }
269
+ return success;
270
+ }
271
+ /**
272
+ * Clear timer
273
+ */
274
+ async clearTimer() {
275
+ if (!this.hasFeature('timer')) {
276
+ const error = 'Timer not supported';
277
+ logger_1.logger.error(`${error} for device: ${this.deviceName}`);
278
+ throw new Error(error);
279
+ }
280
+ logger_1.logger.debug(`Clearing timer for device: ${this.deviceName}`);
281
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
282
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
283
+ cid: this.cid,
284
+ configModule: this.configModule,
285
+ payload: {
286
+ data: {},
287
+ method: 'deleteTimer',
288
+ source: 'APP'
289
+ }
290
+ }, helpers_1.Helpers.reqHeaderBypass());
291
+ const success = this.checkResponse([response, status], 'clearTimer');
292
+ if (!success) {
293
+ logger_1.logger.error(`Failed to clear timer for device: ${this.deviceName}`);
294
+ }
295
+ return success;
296
+ }
297
+ /**
298
+ * Turn automatic stop on
299
+ */
300
+ async automaticStopOn() {
301
+ logger_1.logger.debug(`Setting automatic stop on for device: ${this.deviceName}`);
302
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
303
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
304
+ cid: this.cid,
305
+ configModule: this.configModule,
306
+ payload: {
307
+ data: {
308
+ enabled: true
309
+ },
310
+ method: 'setAutomaticStop',
311
+ source: 'APP'
312
+ }
313
+ }, helpers_1.Helpers.reqHeaderBypass());
314
+ const success = this.checkResponse([response, status], 'automaticStopOn');
315
+ if (!success) {
316
+ logger_1.logger.error(`Failed to set automatic stop on for device: ${this.deviceName}`);
317
+ }
318
+ return success;
319
+ }
320
+ /**
321
+ * Turn automatic stop off
322
+ */
323
+ async automaticStopOff() {
324
+ logger_1.logger.debug(`Setting automatic stop off for device: ${this.deviceName}`);
325
+ const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
326
+ ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
327
+ cid: this.cid,
328
+ configModule: this.configModule,
329
+ payload: {
330
+ data: {
331
+ enabled: false
332
+ },
333
+ method: 'setAutomaticStop',
334
+ source: 'APP'
335
+ }
336
+ }, helpers_1.Helpers.reqHeaderBypass());
337
+ const success = this.checkResponse([response, status], 'automaticStopOff');
338
+ if (!success) {
339
+ logger_1.logger.error(`Failed to set automatic stop off for device: ${this.deviceName}`);
340
+ }
341
+ return success;
342
+ }
343
+ /**
344
+ * Set auto mode
345
+ */
346
+ async setAutoMode() {
347
+ logger_1.logger.debug(`Setting auto mode for device: ${this.deviceName}`);
348
+ const success = await this.setMode('auto');
349
+ if (!success) {
350
+ logger_1.logger.error(`Failed to set auto mode for device: ${this.deviceName}`);
351
+ }
352
+ return success;
353
+ }
354
+ /**
355
+ * Set manual mode
356
+ */
357
+ async setManualMode() {
358
+ logger_1.logger.debug(`Setting manual mode for device: ${this.deviceName}`);
359
+ const success = await this.setMode('manual');
360
+ if (!success) {
361
+ logger_1.logger.error(`Failed to set manual mode for device: ${this.deviceName}`);
362
+ }
363
+ return success;
364
+ }
365
+ /**
366
+ * Turn off display
367
+ */
368
+ async turnOffDisplay() {
369
+ logger_1.logger.debug(`Turning off display for device: ${this.deviceName}`);
370
+ const success = await this.setDisplay(false);
371
+ if (!success) {
372
+ logger_1.logger.error(`Failed to turn off display for device: ${this.deviceName}`);
373
+ }
374
+ return success;
375
+ }
376
+ /**
377
+ * Turn on display
378
+ */
379
+ async turnOnDisplay() {
380
+ logger_1.logger.debug(`Turning on display for device: ${this.deviceName}`);
381
+ const success = await this.setDisplay(true);
382
+ if (!success) {
383
+ logger_1.logger.error(`Failed to turn on display for device: ${this.deviceName}`);
384
+ }
385
+ return success;
386
+ }
387
+ }
388
+ exports.VeSyncHumidifier = VeSyncHumidifier;
@@ -0,0 +1,9 @@
1
+ import { VeSyncFan } from '../vesyncFan';
2
+ import { VeSync } from '../vesync';
3
+ export { VeSyncAirBypass } from './airBypass';
4
+ export { VeSyncAirBaseV2 } from './airBaseV2';
5
+ export { VeSyncTowerFan } from './towerFan';
6
+ export { VeSyncHumidifier } from './humidifier';
7
+ export { VeSyncWarmHumidifier } from './warmHumidifier';
8
+ export { VeSyncHumid200300S } from './humid200300S';
9
+ export declare const fanModules: Record<string, new (details: Record<string, any>, manager: VeSync) => VeSyncFan>;