tsvesync 1.0.64 → 1.0.66
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.
- package/dist/lib/fans/airBaseV2.d.ts +68 -0
- package/dist/lib/fans/airBaseV2.js +226 -0
- package/dist/lib/fans/airBypass.d.ts +79 -0
- package/dist/lib/fans/airBypass.js +484 -0
- package/dist/lib/fans/humid200300S.d.ts +41 -0
- package/dist/lib/fans/humid200300S.js +129 -0
- package/dist/lib/fans/humidifier.d.ts +83 -0
- package/dist/lib/fans/humidifier.js +388 -0
- package/dist/lib/fans/index.d.ts +9 -0
- package/dist/lib/fans/index.js +95 -0
- package/dist/lib/fans/towerFan.d.ts +105 -0
- package/dist/lib/fans/towerFan.js +279 -0
- package/dist/lib/fans/warmHumidifier.d.ts +49 -0
- package/dist/lib/fans/warmHumidifier.js +174 -0
- package/dist/lib/vesyncFan.d.ts +2 -2
- package/dist/lib/vesyncFan.js +2 -2
- package/dist/lib/vesyncFanImpl.d.ts +1 -436
- package/dist/lib/vesyncFanImpl.js +16 -1848
- package/package.json +1 -1
- package/src/lib/fans/airBaseV2.ts +276 -0
- package/src/lib/fans/airBypass.ts +594 -0
- package/src/lib/fans/humid200300S.ts +148 -0
- package/src/lib/fans/humidifier.ts +470 -0
- package/src/lib/fans/index.ts +101 -0
- package/src/lib/fans/towerFan.ts +335 -0
- package/src/lib/fans/warmHumidifier.ts +202 -0
- package/src/lib/vesyncFan.ts +5 -5
- package/src/lib/vesyncFanImpl.ts +2 -2262
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VeSyncWarmHumidifier = void 0;
|
|
4
|
+
const humidifier_1 = require("./humidifier");
|
|
5
|
+
const helpers_1 = require("../helpers");
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
/**
|
|
8
|
+
* VeSync Warm Humidifier Class
|
|
9
|
+
*/
|
|
10
|
+
class VeSyncWarmHumidifier extends humidifier_1.VeSyncHumidifier {
|
|
11
|
+
constructor(details, manager) {
|
|
12
|
+
super(details, manager);
|
|
13
|
+
this.warmLevels = [1, 2, 3];
|
|
14
|
+
logger_1.logger.debug(`Initialized VeSyncWarmHumidifier device: ${this.deviceName}`);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get device details
|
|
18
|
+
*/
|
|
19
|
+
async getDetails() {
|
|
20
|
+
const success = await super.getDetails();
|
|
21
|
+
if (success && this.details) {
|
|
22
|
+
// Add warm humidifier specific fields
|
|
23
|
+
this.details = {
|
|
24
|
+
...this.details,
|
|
25
|
+
warm_enabled: Boolean(this.details.warm_level && this.details.warm_level > 0),
|
|
26
|
+
drying_mode_enabled: this.details.autoDryingSwitch === 1,
|
|
27
|
+
drying_mode_state: this.details.dryingMode || '',
|
|
28
|
+
drying_mode_level: this.details.dryingLevel || 0,
|
|
29
|
+
drying_mode_seconds_remaining: this.details.dryingRemainTime || 0
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return success;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Change fan speed - Implemented to satisfy interface but redirects to setMistLevel
|
|
36
|
+
*/
|
|
37
|
+
async changeFanSpeed(speed) {
|
|
38
|
+
logger_1.logger.debug(`Redirecting fan speed change to mist level for device: ${this.deviceName}`);
|
|
39
|
+
return this.setMistLevel(speed);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Set device mode
|
|
43
|
+
*/
|
|
44
|
+
async setMode(mode) {
|
|
45
|
+
if (!this.modes.includes(mode)) {
|
|
46
|
+
const error = `Invalid mode: ${mode}. Must be one of: ${this.modes.join(', ')}`;
|
|
47
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
48
|
+
throw new Error(error);
|
|
49
|
+
}
|
|
50
|
+
logger_1.logger.debug(`Setting mode to ${mode} for device: ${this.deviceName}`);
|
|
51
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
52
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
53
|
+
cid: this.cid,
|
|
54
|
+
configModule: this.configModule,
|
|
55
|
+
payload: {
|
|
56
|
+
data: {
|
|
57
|
+
mode
|
|
58
|
+
},
|
|
59
|
+
method: 'setHumidityMode',
|
|
60
|
+
source: 'APP'
|
|
61
|
+
}
|
|
62
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
63
|
+
const success = this.checkResponse([response, status], 'setMode');
|
|
64
|
+
if (success) {
|
|
65
|
+
this.details.mode = mode;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
logger_1.logger.error(`Failed to set mode to ${mode} for device: ${this.deviceName}`);
|
|
69
|
+
}
|
|
70
|
+
return success;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Set warm mist level
|
|
74
|
+
*/
|
|
75
|
+
async setWarmLevel(level) {
|
|
76
|
+
if (!this.hasFeature('warm')) {
|
|
77
|
+
const error = 'Warm mist control not supported';
|
|
78
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
79
|
+
throw new Error(error);
|
|
80
|
+
}
|
|
81
|
+
if (!this.warmLevels.includes(level)) {
|
|
82
|
+
const error = `Invalid warm level: ${level}. Must be one of: ${this.warmLevels.join(', ')}`;
|
|
83
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
84
|
+
throw new Error(error);
|
|
85
|
+
}
|
|
86
|
+
logger_1.logger.debug(`Setting warm level to ${level} for device: ${this.deviceName}`);
|
|
87
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
88
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
89
|
+
cid: this.cid,
|
|
90
|
+
configModule: this.configModule,
|
|
91
|
+
payload: {
|
|
92
|
+
data: {
|
|
93
|
+
id: 0,
|
|
94
|
+
level: level,
|
|
95
|
+
type: 'warm'
|
|
96
|
+
},
|
|
97
|
+
method: 'setLevel',
|
|
98
|
+
source: 'APP'
|
|
99
|
+
}
|
|
100
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
101
|
+
const success = this.checkResponse([response, status], 'setWarmLevel');
|
|
102
|
+
if (success) {
|
|
103
|
+
this.details.warm_level = level;
|
|
104
|
+
this.details.warm_enabled = level > 0;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
logger_1.logger.error(`Failed to set warm level to ${level} for device: ${this.deviceName}`);
|
|
108
|
+
}
|
|
109
|
+
return success;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Set drying mode enabled
|
|
113
|
+
*/
|
|
114
|
+
async setDryingModeEnabled(enabled) {
|
|
115
|
+
if (!this.hasFeature('drying')) {
|
|
116
|
+
const error = 'Drying mode not supported';
|
|
117
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
118
|
+
throw new Error(error);
|
|
119
|
+
}
|
|
120
|
+
logger_1.logger.debug(`Setting drying mode to ${enabled} for device: ${this.deviceName}`);
|
|
121
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
122
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
123
|
+
cid: this.cid,
|
|
124
|
+
configModule: this.configModule,
|
|
125
|
+
payload: {
|
|
126
|
+
data: {
|
|
127
|
+
autoDryingSwitch: enabled ? 1 : 0
|
|
128
|
+
},
|
|
129
|
+
method: 'setDryingMode',
|
|
130
|
+
source: 'APP'
|
|
131
|
+
}
|
|
132
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
133
|
+
const success = this.checkResponse([response, status], 'setDryingModeEnabled');
|
|
134
|
+
if (success) {
|
|
135
|
+
this.details.drying_mode_enabled = enabled;
|
|
136
|
+
this.details.autoDryingSwitch = enabled ? 1 : 0;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
logger_1.logger.error(`Failed to set drying mode to ${enabled} for device: ${this.deviceName}`);
|
|
140
|
+
}
|
|
141
|
+
return success;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get warm mist enabled status
|
|
145
|
+
*/
|
|
146
|
+
get warmMistEnabled() {
|
|
147
|
+
return this.details.warm_enabled || false;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get drying mode enabled status
|
|
151
|
+
*/
|
|
152
|
+
get dryingModeEnabled() {
|
|
153
|
+
return this.details.drying_mode_enabled || false;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get drying mode state
|
|
157
|
+
*/
|
|
158
|
+
get dryingModeState() {
|
|
159
|
+
return this.details.drying_mode_state || '';
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get drying mode level
|
|
163
|
+
*/
|
|
164
|
+
get dryingModeLevel() {
|
|
165
|
+
return this.details.drying_mode_level || 0;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get drying mode seconds remaining
|
|
169
|
+
*/
|
|
170
|
+
get dryingModeSecondsRemaining() {
|
|
171
|
+
return this.details.drying_mode_seconds_remaining || 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.VeSyncWarmHumidifier = VeSyncWarmHumidifier;
|
package/dist/lib/vesyncFan.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare abstract class VeSyncFan extends VeSyncBaseDevice {
|
|
|
19
19
|
mode?: string;
|
|
20
20
|
speed?: number;
|
|
21
21
|
filter_life?: number;
|
|
22
|
-
screen_status?:
|
|
22
|
+
screen_status?: 'on' | 'off';
|
|
23
23
|
child_lock?: boolean;
|
|
24
24
|
air_quality?: string;
|
|
25
25
|
humidity?: number;
|
|
@@ -59,7 +59,7 @@ export declare abstract class VeSyncFan extends VeSyncBaseDevice {
|
|
|
59
59
|
/**
|
|
60
60
|
* Get screen status
|
|
61
61
|
*/
|
|
62
|
-
get screenStatus():
|
|
62
|
+
get screenStatus(): 'on' | 'off';
|
|
63
63
|
/**
|
|
64
64
|
* Get child lock status
|
|
65
65
|
*/
|
package/dist/lib/vesyncFan.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.fanConfig = {
|
|
|
11
11
|
// Core Series
|
|
12
12
|
'Core200S': {
|
|
13
13
|
module: 'VeSyncAirBypass',
|
|
14
|
-
features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer'],
|
|
14
|
+
features: ['display', 'child_lock', 'night_light', 'air_quality', 'timer', 'fan_speed', 'auto_mode'],
|
|
15
15
|
levels: [1, 2, 3]
|
|
16
16
|
},
|
|
17
17
|
'Core300S': {
|
|
@@ -343,7 +343,7 @@ class VeSyncFan extends vesyncBaseDevice_1.VeSyncBaseDevice {
|
|
|
343
343
|
*/
|
|
344
344
|
get screenStatus() {
|
|
345
345
|
var _a;
|
|
346
|
-
return (_a = this.details.screen_status) !== null && _a !== void 0 ? _a : '';
|
|
346
|
+
return (_a = this.details.screen_status) !== null && _a !== void 0 ? _a : 'off';
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
349
|
* Get child lock status
|