tsvesync 1.0.71 → 1.0.72
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/humid1000S.d.ts +70 -0
- package/dist/lib/fans/humid1000S.js +222 -0
- package/dist/lib/fans/humid200S.d.ts +52 -0
- package/dist/lib/fans/humid200S.js +169 -0
- package/dist/lib/fans/index.d.ts +3 -0
- package/dist/lib/fans/index.js +16 -7
- package/dist/lib/fans/superior6000S.d.ts +150 -0
- package/dist/lib/fans/superior6000S.js +360 -0
- package/dist/lib/vesyncFan.d.ts +2 -2
- package/dist/lib/vesyncFan.js +16 -11
- package/package.json +1 -1
- package/src/lib/fans/humid1000S.ts +276 -0
- package/src/lib/fans/humid200S.ts +199 -0
- package/src/lib/fans/index.ts +12 -6
- package/src/lib/fans/superior6000S.ts +466 -0
- package/src/lib/vesyncFan.ts +18 -13
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { VeSyncHumid200300S } from './humid200300S';
|
|
2
|
+
import { VeSync } from '../vesync';
|
|
3
|
+
/**
|
|
4
|
+
* VeSync Humid1000S Humidifier Class
|
|
5
|
+
* Implementation based on PyVeSync's VeSyncHumid1000S class
|
|
6
|
+
* For OASISMIST1000S models (LUH-M101S-WUS and LUH-M101S-WEUR)
|
|
7
|
+
*/
|
|
8
|
+
export declare class VeSyncHumid1000S extends VeSyncHumid200300S {
|
|
9
|
+
protected readonly _apiModes: string[];
|
|
10
|
+
constructor(details: Record<string, any>, manager: VeSync);
|
|
11
|
+
/**
|
|
12
|
+
* Build API dictionary for humidifier
|
|
13
|
+
*/
|
|
14
|
+
protected buildApiDict(method: string): [Record<string, any>, Record<string, any>];
|
|
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 night light
|
|
33
|
+
*/
|
|
34
|
+
setNightLight(enabled: boolean, brightness?: number): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Get night light status
|
|
37
|
+
* Returns the night light status (on/off)
|
|
38
|
+
*/
|
|
39
|
+
get nightLightStatus(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Get night light brightness
|
|
42
|
+
* Returns the night light brightness (0-100)
|
|
43
|
+
*/
|
|
44
|
+
get nightLightBrightness(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Set automatic stop
|
|
47
|
+
* Enable or disable automatic stop when target humidity is reached
|
|
48
|
+
*/
|
|
49
|
+
setAutomaticStop(enabled: boolean): Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Turn automatic stop on
|
|
52
|
+
* Enable automatic stop when target humidity is reached
|
|
53
|
+
*/
|
|
54
|
+
automaticStopOn(): Promise<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Turn automatic stop off
|
|
57
|
+
* Disable automatic stop when target humidity is reached
|
|
58
|
+
*/
|
|
59
|
+
automaticStopOff(): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Get target humidity
|
|
62
|
+
* Returns the target humidity setting
|
|
63
|
+
*/
|
|
64
|
+
get targetHumidity(): number;
|
|
65
|
+
/**
|
|
66
|
+
* Get automatic stop setting
|
|
67
|
+
* Returns whether automatic stop is enabled
|
|
68
|
+
*/
|
|
69
|
+
get automaticStop(): boolean;
|
|
70
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VeSyncHumid1000S = void 0;
|
|
4
|
+
const humid200300S_1 = require("./humid200300S");
|
|
5
|
+
const helpers_1 = require("../helpers");
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
/**
|
|
8
|
+
* VeSync Humid1000S Humidifier Class
|
|
9
|
+
* Implementation based on PyVeSync's VeSyncHumid1000S class
|
|
10
|
+
* For OASISMIST1000S models (LUH-M101S-WUS and LUH-M101S-WEUR)
|
|
11
|
+
*/
|
|
12
|
+
class VeSyncHumid1000S extends humid200300S_1.VeSyncHumid200300S {
|
|
13
|
+
constructor(details, manager) {
|
|
14
|
+
super(details, manager);
|
|
15
|
+
this._apiModes = [
|
|
16
|
+
'getHumidifierStatus',
|
|
17
|
+
'setSwitch',
|
|
18
|
+
'setVirtualLevel',
|
|
19
|
+
'setTargetHumidity',
|
|
20
|
+
'setHumidityMode',
|
|
21
|
+
'setDisplay',
|
|
22
|
+
'setNightLight',
|
|
23
|
+
'setAutoStopSwitch',
|
|
24
|
+
];
|
|
25
|
+
// Update config for Humid1000S
|
|
26
|
+
this.config = {
|
|
27
|
+
module: 'VeSyncHumid1000S',
|
|
28
|
+
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode', 'night_light'],
|
|
29
|
+
levels: [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
30
|
+
};
|
|
31
|
+
logger_1.logger.debug(`Initialized VeSyncHumid1000S device: ${this.deviceName}`);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Build API dictionary for humidifier
|
|
35
|
+
*/
|
|
36
|
+
buildApiDict(method) {
|
|
37
|
+
if (!this._apiModes.includes(method)) {
|
|
38
|
+
logger_1.logger.debug(`Invalid mode - ${method}`);
|
|
39
|
+
throw new Error(`Invalid mode - ${method}`);
|
|
40
|
+
}
|
|
41
|
+
const head = helpers_1.Helpers.reqHeaderBypass();
|
|
42
|
+
const body = {
|
|
43
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
44
|
+
cid: this.cid,
|
|
45
|
+
configModule: this.configModule,
|
|
46
|
+
payload: {
|
|
47
|
+
method: method,
|
|
48
|
+
source: 'APP',
|
|
49
|
+
data: {}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return [head, body];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get device details
|
|
56
|
+
*/
|
|
57
|
+
async getDetails() {
|
|
58
|
+
var _a;
|
|
59
|
+
logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
|
|
60
|
+
const [head, body] = this.buildApiDict('getHumidifierStatus');
|
|
61
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', body, head);
|
|
62
|
+
const success = this.checkResponse([response, status], 'getDetails');
|
|
63
|
+
if (success && ((_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.result)) {
|
|
64
|
+
const result = response.result.result;
|
|
65
|
+
// Update device status based on powerSwitch field
|
|
66
|
+
this.deviceStatus = result.powerSwitch === 1 ? 'on' : 'off';
|
|
67
|
+
// Build details object with Humid1000S specific fields
|
|
68
|
+
this.details = {
|
|
69
|
+
mode: result.workMode || '',
|
|
70
|
+
humidity: result.humidity || 0,
|
|
71
|
+
target_humidity: result.targetHumidity || 0,
|
|
72
|
+
mist_level: result.mistLevel || 0,
|
|
73
|
+
mist_virtual_level: result.virtualLevel || 0,
|
|
74
|
+
water_lacks: result.waterLacksState || false,
|
|
75
|
+
water_tank_lifted: result.waterTankLifted || false,
|
|
76
|
+
display: result.screenSwitch === 1,
|
|
77
|
+
night_light_status: result.nightLightStatus || 'off',
|
|
78
|
+
night_light_brightness: result.nightLightBrightness || 0,
|
|
79
|
+
connection_status: result.connectionStatus || null,
|
|
80
|
+
configuration: result.configuration || {}
|
|
81
|
+
};
|
|
82
|
+
logger_1.logger.debug(`Successfully got details for device: ${this.deviceName}`);
|
|
83
|
+
}
|
|
84
|
+
return success;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Turn device on
|
|
88
|
+
*/
|
|
89
|
+
async turnOn() {
|
|
90
|
+
return this.toggleSwitch(true);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Turn device off
|
|
94
|
+
*/
|
|
95
|
+
async turnOff() {
|
|
96
|
+
return this.toggleSwitch(false);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Toggle device power
|
|
100
|
+
*/
|
|
101
|
+
async toggleSwitch(enabled) {
|
|
102
|
+
logger_1.logger.info(`Setting device power to ${enabled ? 'on' : 'off'}: ${this.deviceName}`);
|
|
103
|
+
const [head, body] = this.buildApiDict('setSwitch');
|
|
104
|
+
body.payload.data = {
|
|
105
|
+
powerSwitch: enabled ? 1 : 0,
|
|
106
|
+
switchIdx: 0
|
|
107
|
+
};
|
|
108
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', body, head);
|
|
109
|
+
const success = this.checkResponse([response, status], 'toggleSwitch');
|
|
110
|
+
if (success) {
|
|
111
|
+
this.deviceStatus = enabled ? 'on' : 'off';
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
logger_1.logger.error(`Failed to set device power to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Set night light
|
|
119
|
+
*/
|
|
120
|
+
async setNightLight(enabled, brightness) {
|
|
121
|
+
if (!this.hasFeature('night_light')) {
|
|
122
|
+
logger_1.logger.error(`Night light feature not supported for device: ${this.deviceName}`);
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
logger_1.logger.debug(`Setting night light to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
126
|
+
const [head, body] = this.buildApiDict('setNightLight');
|
|
127
|
+
body.payload.data = {
|
|
128
|
+
nightLightSwitch: enabled ? 1 : 0
|
|
129
|
+
};
|
|
130
|
+
// Add brightness if provided
|
|
131
|
+
if (enabled && brightness !== undefined) {
|
|
132
|
+
if (brightness < 1 || brightness > 100) {
|
|
133
|
+
logger_1.logger.error(`Invalid night light brightness: ${brightness}. Must be between 1 and 100.`);
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
body.payload.data.nightLightBrightness = brightness;
|
|
137
|
+
}
|
|
138
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', body, head);
|
|
139
|
+
const success = this.checkResponse([response, status], 'setNightLight');
|
|
140
|
+
if (success) {
|
|
141
|
+
this.details.night_light_status = enabled ? 'on' : 'off';
|
|
142
|
+
if (enabled && brightness !== undefined) {
|
|
143
|
+
this.details.night_light_brightness = brightness;
|
|
144
|
+
}
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
// Check for API error code 11000000 (feature not supported)
|
|
148
|
+
if ((response === null || response === void 0 ? void 0 : response.code) === 11000000) {
|
|
149
|
+
logger_1.logger.warn(`Night light control not supported via API for device: ${this.deviceName}`);
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
logger_1.logger.error(`Failed to set night light for device: ${this.deviceName}`);
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
// Connection status is available in details.connection_status
|
|
156
|
+
/**
|
|
157
|
+
* Get night light status
|
|
158
|
+
* Returns the night light status (on/off)
|
|
159
|
+
*/
|
|
160
|
+
get nightLightStatus() {
|
|
161
|
+
return this.details.night_light_status || 'off';
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get night light brightness
|
|
165
|
+
* Returns the night light brightness (0-100)
|
|
166
|
+
*/
|
|
167
|
+
get nightLightBrightness() {
|
|
168
|
+
return this.details.night_light_brightness || 0;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Set automatic stop
|
|
172
|
+
* Enable or disable automatic stop when target humidity is reached
|
|
173
|
+
*/
|
|
174
|
+
async setAutomaticStop(enabled) {
|
|
175
|
+
logger_1.logger.debug(`Setting automatic stop to ${enabled ? 'enabled' : 'disabled'} for device: ${this.deviceName}`);
|
|
176
|
+
const [head, body] = this.buildApiDict('setAutoStopSwitch');
|
|
177
|
+
body.payload.data = {
|
|
178
|
+
autoStopSwitch: enabled ? 1 : 0
|
|
179
|
+
};
|
|
180
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', body, head);
|
|
181
|
+
const success = this.checkResponse([response, status], 'setAutomaticStop');
|
|
182
|
+
if (success) {
|
|
183
|
+
if (!this.details.configuration) {
|
|
184
|
+
this.details.configuration = {};
|
|
185
|
+
}
|
|
186
|
+
this.details.configuration.automatic_stop = enabled;
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
logger_1.logger.error(`Failed to set automatic stop for device: ${this.deviceName}`);
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Turn automatic stop on
|
|
194
|
+
* Enable automatic stop when target humidity is reached
|
|
195
|
+
*/
|
|
196
|
+
async automaticStopOn() {
|
|
197
|
+
return this.setAutomaticStop(true);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Turn automatic stop off
|
|
201
|
+
* Disable automatic stop when target humidity is reached
|
|
202
|
+
*/
|
|
203
|
+
async automaticStopOff() {
|
|
204
|
+
return this.setAutomaticStop(false);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Get target humidity
|
|
208
|
+
* Returns the target humidity setting
|
|
209
|
+
*/
|
|
210
|
+
get targetHumidity() {
|
|
211
|
+
return this.details.target_humidity || 0;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Get automatic stop setting
|
|
215
|
+
* Returns whether automatic stop is enabled
|
|
216
|
+
*/
|
|
217
|
+
get automaticStop() {
|
|
218
|
+
var _a;
|
|
219
|
+
return ((_a = this.details.configuration) === null || _a === void 0 ? void 0 : _a.automatic_stop) || false;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
exports.VeSyncHumid1000S = VeSyncHumid1000S;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { VeSyncHumidifier } from './humidifier';
|
|
2
|
+
import { VeSync } from '../vesync';
|
|
3
|
+
/**
|
|
4
|
+
* VeSync Humid200S Humidifier Class
|
|
5
|
+
* Implementation based on PyVeSync's VeSyncHumid200S class
|
|
6
|
+
* For Classic200S models
|
|
7
|
+
*/
|
|
8
|
+
export declare class VeSyncHumid200S extends VeSyncHumidifier {
|
|
9
|
+
protected readonly modes: readonly ["auto", "manual", "sleep"];
|
|
10
|
+
protected readonly features: string[];
|
|
11
|
+
protected readonly mistLevels: number[];
|
|
12
|
+
protected readonly humidityRange: {
|
|
13
|
+
min: number;
|
|
14
|
+
max: number;
|
|
15
|
+
};
|
|
16
|
+
constructor(details: Record<string, any>, manager: VeSync);
|
|
17
|
+
/**
|
|
18
|
+
* Get device details
|
|
19
|
+
*/
|
|
20
|
+
getDetails(): Promise<Boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Set display
|
|
23
|
+
* Override to use setIndicatorLightSwitch method
|
|
24
|
+
*/
|
|
25
|
+
setDisplay(enabled: boolean): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Set mist level
|
|
28
|
+
*/
|
|
29
|
+
setMistLevel(level: number): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Get current humidity
|
|
32
|
+
* Provides access to the current humidity reading
|
|
33
|
+
*/
|
|
34
|
+
get currentHumidity(): number;
|
|
35
|
+
/**
|
|
36
|
+
* Get target humidity
|
|
37
|
+
*/
|
|
38
|
+
get targetHumidity(): number;
|
|
39
|
+
/**
|
|
40
|
+
* Get water lacks status
|
|
41
|
+
*/
|
|
42
|
+
get waterLacks(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Get water tank lifted status
|
|
45
|
+
*/
|
|
46
|
+
get waterTankLifted(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Return JSON details for humidifier
|
|
49
|
+
* Override to include current humidity and target humidity
|
|
50
|
+
*/
|
|
51
|
+
displayJSON(): string;
|
|
52
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VeSyncHumid200S = void 0;
|
|
4
|
+
const humidifier_1 = require("./humidifier");
|
|
5
|
+
const helpers_1 = require("../helpers");
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
/**
|
|
8
|
+
* VeSync Humid200S Humidifier Class
|
|
9
|
+
* Implementation based on PyVeSync's VeSyncHumid200S class
|
|
10
|
+
* For Classic200S models
|
|
11
|
+
*/
|
|
12
|
+
class VeSyncHumid200S extends humidifier_1.VeSyncHumidifier {
|
|
13
|
+
constructor(details, manager) {
|
|
14
|
+
super(details, manager);
|
|
15
|
+
this.modes = ['auto', 'manual', 'sleep'];
|
|
16
|
+
this.features = ['humidity', 'mist', 'display', 'timer', 'auto_mode'];
|
|
17
|
+
this.mistLevels = [1, 2, 3];
|
|
18
|
+
this.humidityRange = { min: 30, max: 80 };
|
|
19
|
+
// Update config for Humid200S
|
|
20
|
+
this.config = {
|
|
21
|
+
module: 'VeSyncHumid200S',
|
|
22
|
+
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode'],
|
|
23
|
+
levels: [1, 2, 3]
|
|
24
|
+
};
|
|
25
|
+
logger_1.logger.debug(`Initialized VeSyncHumid200S device: ${this.deviceName}`);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get device details
|
|
29
|
+
*/
|
|
30
|
+
async getDetails() {
|
|
31
|
+
var _a, _b, _c, _d;
|
|
32
|
+
logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
|
|
33
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
34
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
35
|
+
cid: this.cid,
|
|
36
|
+
configModule: this.configModule,
|
|
37
|
+
payload: {
|
|
38
|
+
data: {},
|
|
39
|
+
method: 'getHumidifierStatus',
|
|
40
|
+
source: 'APP'
|
|
41
|
+
}
|
|
42
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
43
|
+
const success = this.checkResponse([response, status], 'getDetails');
|
|
44
|
+
if (success && ((_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.result)) {
|
|
45
|
+
const result = response.result.result;
|
|
46
|
+
// Update device status based on enabled field
|
|
47
|
+
this.deviceStatus = result.enabled ? 'on' : 'off';
|
|
48
|
+
this.details = {
|
|
49
|
+
mode: result.mode || '',
|
|
50
|
+
humidity: result.humidity || 0,
|
|
51
|
+
target_humidity: ((_b = result.configuration) === null || _b === void 0 ? void 0 : _b.auto_target_humidity) || result.target_humidity || 0,
|
|
52
|
+
mist_level: result.mist_level || 0,
|
|
53
|
+
water_lacks: result.water_lacks || false,
|
|
54
|
+
humidity_high: result.humidity_high || false,
|
|
55
|
+
water_tank_lifted: result.water_tank_lifted || false,
|
|
56
|
+
display: result.display || false,
|
|
57
|
+
automatic_stop: result.automatic_stop_reach_target || false,
|
|
58
|
+
automatic_stop_configured: ((_c = result.configuration) === null || _c === void 0 ? void 0 : _c.automatic_stop) || false,
|
|
59
|
+
auto_target_humidity: ((_d = result.configuration) === null || _d === void 0 ? void 0 : _d.auto_target_humidity) || 0,
|
|
60
|
+
configuration: result.configuration || {}
|
|
61
|
+
};
|
|
62
|
+
logger_1.logger.debug(`Successfully got details for device: ${this.deviceName}`);
|
|
63
|
+
}
|
|
64
|
+
return success;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Set display
|
|
68
|
+
* Override to use setIndicatorLightSwitch method
|
|
69
|
+
*/
|
|
70
|
+
async setDisplay(enabled) {
|
|
71
|
+
logger_1.logger.info(`Setting display to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
72
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
73
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
74
|
+
cid: this.cid,
|
|
75
|
+
configModule: this.configModule,
|
|
76
|
+
payload: {
|
|
77
|
+
data: {
|
|
78
|
+
enabled: enabled
|
|
79
|
+
},
|
|
80
|
+
method: 'setIndicatorLightSwitch',
|
|
81
|
+
source: 'APP'
|
|
82
|
+
}
|
|
83
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
84
|
+
const success = this.checkResponse([response, status], 'setDisplay');
|
|
85
|
+
if (success) {
|
|
86
|
+
this.details.display = enabled;
|
|
87
|
+
// Get latest state and log it
|
|
88
|
+
await this.getDetails();
|
|
89
|
+
logger_1.logger.debug(`Device state after display change: ${JSON.stringify(this.details)}`);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
logger_1.logger.error(`Failed to set display to ${enabled ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
93
|
+
}
|
|
94
|
+
return success;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Set mist level
|
|
98
|
+
*/
|
|
99
|
+
async setMistLevel(level) {
|
|
100
|
+
if (!this.mistLevels.includes(level)) {
|
|
101
|
+
const error = `Invalid mist level: ${level}. Must be one of: ${this.mistLevels.join(', ')}`;
|
|
102
|
+
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
103
|
+
throw new Error(error);
|
|
104
|
+
}
|
|
105
|
+
logger_1.logger.info(`Setting mist level to ${level} for device: ${this.deviceName}`);
|
|
106
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
107
|
+
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
108
|
+
cid: this.cid,
|
|
109
|
+
configModule: this.configModule,
|
|
110
|
+
payload: {
|
|
111
|
+
data: {
|
|
112
|
+
level: level
|
|
113
|
+
},
|
|
114
|
+
method: 'setMistLevel', // Use setMistLevel for Classic200S
|
|
115
|
+
source: 'APP'
|
|
116
|
+
}
|
|
117
|
+
}, helpers_1.Helpers.reqHeaderBypass());
|
|
118
|
+
const success = this.checkResponse([response, status], 'setMistLevel');
|
|
119
|
+
if (success) {
|
|
120
|
+
this.details.mist_level = level;
|
|
121
|
+
// Get latest state and log it
|
|
122
|
+
await this.getDetails();
|
|
123
|
+
logger_1.logger.debug(`Device state after mist level change: ${JSON.stringify(this.details)}`);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
logger_1.logger.error(`Failed to set mist level to ${level} for device: ${this.deviceName}`);
|
|
127
|
+
}
|
|
128
|
+
return success;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get current humidity
|
|
132
|
+
* Provides access to the current humidity reading
|
|
133
|
+
*/
|
|
134
|
+
get currentHumidity() {
|
|
135
|
+
return this.details.humidity || 0;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get target humidity
|
|
139
|
+
*/
|
|
140
|
+
get targetHumidity() {
|
|
141
|
+
return this.details.target_humidity || 0;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get water lacks status
|
|
145
|
+
*/
|
|
146
|
+
get waterLacks() {
|
|
147
|
+
return this.details.water_lacks || false;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get water tank lifted status
|
|
151
|
+
*/
|
|
152
|
+
get waterTankLifted() {
|
|
153
|
+
return this.details.water_tank_lifted || false;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Return JSON details for humidifier
|
|
157
|
+
* Override to include current humidity and target humidity
|
|
158
|
+
*/
|
|
159
|
+
displayJSON() {
|
|
160
|
+
var _a, _b;
|
|
161
|
+
const baseInfo = JSON.parse(super.displayJSON());
|
|
162
|
+
// Add current humidity from details
|
|
163
|
+
baseInfo['Humidity'] = ((_a = this.details.humidity) === null || _a === void 0 ? void 0 : _a.toString()) || '0';
|
|
164
|
+
// Add target humidity from configuration
|
|
165
|
+
baseInfo['Target Humidity'] = ((_b = this.details.target_humidity) === null || _b === void 0 ? void 0 : _b.toString()) || '0';
|
|
166
|
+
return JSON.stringify(baseInfo, null, 4);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.VeSyncHumid200S = VeSyncHumid200S;
|
package/dist/lib/fans/index.d.ts
CHANGED
|
@@ -6,4 +6,7 @@ export { VeSyncTowerFan } from './towerFan';
|
|
|
6
6
|
export { VeSyncHumidifier } from './humidifier';
|
|
7
7
|
export { VeSyncWarmHumidifier } from './warmHumidifier';
|
|
8
8
|
export { VeSyncHumid200300S } from './humid200300S';
|
|
9
|
+
export { VeSyncSuperior6000S } from './superior6000S';
|
|
10
|
+
export { VeSyncHumid1000S } from './humid1000S';
|
|
11
|
+
export { VeSyncHumid200S } from './humid200S';
|
|
9
12
|
export declare const fanModules: Record<string, new (details: Record<string, any>, manager: VeSync) => VeSyncFan>;
|
package/dist/lib/fans/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fanModules = exports.VeSyncHumid200300S = exports.VeSyncWarmHumidifier = exports.VeSyncHumidifier = exports.VeSyncTowerFan = exports.VeSyncAirBaseV2 = exports.VeSyncAirBypass = void 0;
|
|
3
|
+
exports.fanModules = exports.VeSyncHumid200S = exports.VeSyncHumid1000S = exports.VeSyncSuperior6000S = exports.VeSyncHumid200300S = exports.VeSyncWarmHumidifier = exports.VeSyncHumidifier = exports.VeSyncTowerFan = exports.VeSyncAirBaseV2 = exports.VeSyncAirBypass = void 0;
|
|
4
4
|
const airBypass_1 = require("./airBypass");
|
|
5
5
|
const airBaseV2_1 = require("./airBaseV2");
|
|
6
6
|
const towerFan_1 = require("./towerFan");
|
|
7
7
|
const humidifier_1 = require("./humidifier");
|
|
8
8
|
const humid200300S_1 = require("./humid200300S");
|
|
9
|
+
const superior6000S_1 = require("./superior6000S");
|
|
10
|
+
const humid1000S_1 = require("./humid1000S");
|
|
11
|
+
const humid200S_1 = require("./humid200S");
|
|
9
12
|
// Re-export all classes
|
|
10
13
|
var airBypass_2 = require("./airBypass");
|
|
11
14
|
Object.defineProperty(exports, "VeSyncAirBypass", { enumerable: true, get: function () { return airBypass_2.VeSyncAirBypass; } });
|
|
@@ -19,6 +22,12 @@ var warmHumidifier_1 = require("./warmHumidifier");
|
|
|
19
22
|
Object.defineProperty(exports, "VeSyncWarmHumidifier", { enumerable: true, get: function () { return warmHumidifier_1.VeSyncWarmHumidifier; } });
|
|
20
23
|
var humid200300S_2 = require("./humid200300S");
|
|
21
24
|
Object.defineProperty(exports, "VeSyncHumid200300S", { enumerable: true, get: function () { return humid200300S_2.VeSyncHumid200300S; } });
|
|
25
|
+
var superior6000S_2 = require("./superior6000S");
|
|
26
|
+
Object.defineProperty(exports, "VeSyncSuperior6000S", { enumerable: true, get: function () { return superior6000S_2.VeSyncSuperior6000S; } });
|
|
27
|
+
var humid1000S_2 = require("./humid1000S");
|
|
28
|
+
Object.defineProperty(exports, "VeSyncHumid1000S", { enumerable: true, get: function () { return humid1000S_2.VeSyncHumid1000S; } });
|
|
29
|
+
var humid200S_2 = require("./humid200S");
|
|
30
|
+
Object.defineProperty(exports, "VeSyncHumid200S", { enumerable: true, get: function () { return humid200S_2.VeSyncHumid200S; } });
|
|
22
31
|
// Export fan modules dictionary
|
|
23
32
|
exports.fanModules = {
|
|
24
33
|
// Core Series
|
|
@@ -64,7 +73,7 @@ exports.fanModules = {
|
|
|
64
73
|
'LTF-F422S-WUS': towerFan_1.VeSyncTowerFan,
|
|
65
74
|
// Classic Series
|
|
66
75
|
'Classic300S': humidifier_1.VeSyncHumidifier,
|
|
67
|
-
'Classic200S':
|
|
76
|
+
'Classic200S': humid200S_1.VeSyncHumid200S,
|
|
68
77
|
// Dual Series
|
|
69
78
|
'Dual200S': humidifier_1.VeSyncHumidifier,
|
|
70
79
|
// LUH Series
|
|
@@ -84,11 +93,11 @@ exports.fanModules = {
|
|
|
84
93
|
'LUH-O451S-WUSR': humid200300S_1.VeSyncHumid200300S,
|
|
85
94
|
'LUH-O601S-WUS': humid200300S_1.VeSyncHumid200300S,
|
|
86
95
|
'LUH-O601S-KUS': humid200300S_1.VeSyncHumid200300S,
|
|
87
|
-
'LUH-M101S-WUS':
|
|
88
|
-
'LUH-M101S-WEUR':
|
|
89
|
-
// LEH Series
|
|
90
|
-
'LEH-S601S-WUS':
|
|
91
|
-
'LEH-S601S-WUSR':
|
|
96
|
+
'LUH-M101S-WUS': humid1000S_1.VeSyncHumid1000S,
|
|
97
|
+
'LUH-M101S-WEUR': humid1000S_1.VeSyncHumid1000S,
|
|
98
|
+
// LEH Series - Superior 6000S
|
|
99
|
+
'LEH-S601S-WUS': superior6000S_1.VeSyncSuperior6000S,
|
|
100
|
+
'LEH-S601S-WUSR': superior6000S_1.VeSyncSuperior6000S,
|
|
92
101
|
// LV Series
|
|
93
102
|
'LV-PUR131S': airBypass_1.VeSyncAirBypass,
|
|
94
103
|
'LV-RH131S': airBypass_1.VeSyncAirBypass
|