tsvesync 1.0.65 → 1.0.67
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VeSyncHumidifier } from './humidifier';
|
|
2
2
|
import { VeSync } from '../vesync';
|
|
3
3
|
/**
|
|
4
4
|
* VeSync Humidifier 200/300S Class
|
|
5
5
|
*/
|
|
6
|
-
export declare class VeSyncHumid200300S extends
|
|
6
|
+
export declare class VeSyncHumid200300S extends VeSyncHumidifier {
|
|
7
7
|
protected readonly modes: readonly ["auto", "manual", "sleep"];
|
|
8
8
|
protected readonly features: string[];
|
|
9
9
|
protected readonly mistLevels: number[];
|
|
@@ -20,14 +20,6 @@ export declare class VeSyncHumid200300S extends VeSyncWarmHumidifier {
|
|
|
20
20
|
* Set mist level
|
|
21
21
|
*/
|
|
22
22
|
setMistLevel(level: number): Promise<boolean>;
|
|
23
|
-
/**
|
|
24
|
-
* Set night light brightness
|
|
25
|
-
*/
|
|
26
|
-
setNightLightBrightness(brightness: number): Promise<boolean>;
|
|
27
|
-
/**
|
|
28
|
-
* Get night light brightness
|
|
29
|
-
*/
|
|
30
|
-
get nightLightBrightness(): number;
|
|
31
23
|
/**
|
|
32
24
|
* Get configuration
|
|
33
25
|
*/
|
|
@@ -39,12 +31,19 @@ export declare class VeSyncHumid200300S extends VeSyncWarmHumidifier {
|
|
|
39
31
|
get mistLevel(): number;
|
|
40
32
|
/**
|
|
41
33
|
* Get target humidity
|
|
42
|
-
* Override base class to return target humidity
|
|
34
|
+
* Override base class to return target humidity from configuration
|
|
43
35
|
*/
|
|
44
36
|
get humidity(): number;
|
|
45
37
|
/**
|
|
46
|
-
*
|
|
47
|
-
* Override base class to properly update target humidity
|
|
38
|
+
* Get automatic stop configuration
|
|
48
39
|
*/
|
|
49
|
-
|
|
40
|
+
get automaticStopConfigured(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Get night light brightness
|
|
43
|
+
*/
|
|
44
|
+
get nightLightBrightness(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Set night light brightness
|
|
47
|
+
*/
|
|
48
|
+
setNightLightBrightness(brightness: number): Promise<boolean>;
|
|
50
49
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VeSyncHumid200300S = void 0;
|
|
4
|
-
const
|
|
4
|
+
const humidifier_1 = require("./humidifier");
|
|
5
5
|
const helpers_1 = require("../helpers");
|
|
6
6
|
const logger_1 = require("../logger");
|
|
7
7
|
/**
|
|
8
8
|
* VeSync Humidifier 200/300S Class
|
|
9
9
|
*/
|
|
10
|
-
class VeSyncHumid200300S extends
|
|
10
|
+
class VeSyncHumid200300S extends humidifier_1.VeSyncHumidifier {
|
|
11
11
|
constructor(details, manager) {
|
|
12
12
|
super(details, manager);
|
|
13
13
|
this.modes = ['auto', 'manual', 'sleep'];
|
|
14
|
-
this.features = ['humidity', 'mist', 'display', 'timer', 'auto_mode'];
|
|
14
|
+
this.features = ['humidity', 'mist', 'display', 'timer', 'auto_mode', 'night_light'];
|
|
15
15
|
this.mistLevels = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
16
16
|
this.humidityRange = { min: 30, max: 80 };
|
|
17
17
|
logger_1.logger.debug(`Initialized VeSyncHumid200300S device: ${this.deviceName}`);
|
|
@@ -20,7 +20,7 @@ class VeSyncHumid200300S extends warmHumidifier_1.VeSyncWarmHumidifier {
|
|
|
20
20
|
* Get device details
|
|
21
21
|
*/
|
|
22
22
|
async getDetails() {
|
|
23
|
-
var _a;
|
|
23
|
+
var _a, _b, _c;
|
|
24
24
|
logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
|
|
25
25
|
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
26
26
|
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
@@ -43,12 +43,13 @@ class VeSyncHumid200300S extends warmHumidifier_1.VeSyncWarmHumidifier {
|
|
|
43
43
|
target_humidity: result.target_humidity || result.humidity || 0, // Target humidity
|
|
44
44
|
mist_level: result.mist_level || 0,
|
|
45
45
|
mist_virtual_level: result.mist_virtual_level || 0,
|
|
46
|
-
warm_level: result.warm_level || 0,
|
|
47
46
|
water_lacks: result.water_lacks || false,
|
|
48
47
|
humidity_high: result.humidity_high || false,
|
|
49
48
|
water_tank_lifted: result.water_tank_lifted || false,
|
|
50
49
|
display: result.display || false,
|
|
51
50
|
automatic_stop: result.automatic_stop_reach_target || false,
|
|
51
|
+
automatic_stop_configured: ((_b = result.configuration) === null || _b === void 0 ? void 0 : _b.automatic_stop) || false,
|
|
52
|
+
auto_target_humidity: ((_c = result.configuration) === null || _c === void 0 ? void 0 : _c.auto_target_humidity) || 0,
|
|
52
53
|
configuration: result.configuration || {},
|
|
53
54
|
connection_status: result.connection_status || null,
|
|
54
55
|
night_light_brightness: result.night_light_brightness || 0
|
|
@@ -99,43 +100,6 @@ class VeSyncHumid200300S extends warmHumidifier_1.VeSyncWarmHumidifier {
|
|
|
99
100
|
}
|
|
100
101
|
return success;
|
|
101
102
|
}
|
|
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
103
|
/**
|
|
140
104
|
* Get configuration
|
|
141
105
|
*/
|
|
@@ -151,48 +115,60 @@ class VeSyncHumid200300S extends warmHumidifier_1.VeSyncWarmHumidifier {
|
|
|
151
115
|
}
|
|
152
116
|
/**
|
|
153
117
|
* Get target humidity
|
|
154
|
-
* Override base class to return target humidity
|
|
118
|
+
* Override base class to return target humidity from configuration
|
|
155
119
|
*/
|
|
156
120
|
get humidity() {
|
|
157
|
-
return this.details.
|
|
121
|
+
return this.details.auto_target_humidity || 0;
|
|
158
122
|
}
|
|
159
123
|
/**
|
|
160
|
-
*
|
|
161
|
-
* Override base class to properly update target humidity
|
|
124
|
+
* Get automatic stop configuration
|
|
162
125
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
126
|
+
get automaticStopConfigured() {
|
|
127
|
+
return this.details.automatic_stop_configured || false;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get night light brightness
|
|
131
|
+
*/
|
|
132
|
+
get nightLightBrightness() {
|
|
133
|
+
return this.details.night_light_brightness || 0;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Set night light brightness
|
|
137
|
+
*/
|
|
138
|
+
async setNightLightBrightness(brightness) {
|
|
139
|
+
var _a;
|
|
140
|
+
if (brightness < 0 || brightness > 100) {
|
|
141
|
+
const error = `Invalid brightness: ${brightness}. Must be between 0 and 100`;
|
|
171
142
|
logger_1.logger.error(`${error} for device: ${this.deviceName}`);
|
|
172
143
|
throw new Error(error);
|
|
173
144
|
}
|
|
174
|
-
logger_1.logger.debug(`Setting
|
|
145
|
+
logger_1.logger.debug(`Setting night light brightness to ${brightness} for device: ${this.deviceName}`);
|
|
175
146
|
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
|
|
176
147
|
...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
|
|
177
148
|
cid: this.cid,
|
|
178
149
|
configModule: this.configModule,
|
|
179
150
|
payload: {
|
|
180
151
|
data: {
|
|
181
|
-
|
|
152
|
+
brightness
|
|
182
153
|
},
|
|
183
|
-
method: '
|
|
154
|
+
method: 'setNightLight',
|
|
184
155
|
source: 'APP'
|
|
185
156
|
}
|
|
186
157
|
}, helpers_1.Helpers.reqHeaderBypass());
|
|
187
|
-
|
|
158
|
+
// Check for error code 11000000 which indicates feature not supported
|
|
159
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.code) === 11000000) {
|
|
160
|
+
logger_1.logger.warn(`Night light control not supported by device: ${this.deviceName} (${this.deviceType})`);
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
const success = this.checkResponse([response, status], 'setNightLightBrightness');
|
|
188
164
|
if (success) {
|
|
189
|
-
this.details.
|
|
165
|
+
this.details.night_light_brightness = brightness;
|
|
190
166
|
// Get latest state and log it
|
|
191
167
|
await this.getDetails();
|
|
192
|
-
logger_1.logger.debug(`Device state after
|
|
168
|
+
logger_1.logger.debug(`Device state after night light brightness change: ${JSON.stringify(this.details)}`);
|
|
193
169
|
}
|
|
194
170
|
else {
|
|
195
|
-
logger_1.logger.error(`Failed to set
|
|
171
|
+
logger_1.logger.error(`Failed to set night light brightness to ${brightness} for device: ${this.deviceName}`);
|
|
196
172
|
}
|
|
197
173
|
return success;
|
|
198
174
|
}
|
package/dist/lib/vesyncFan.js
CHANGED
|
@@ -203,7 +203,7 @@ exports.fanConfig = {
|
|
|
203
203
|
// LUH Series
|
|
204
204
|
'LUH-A601S-WUSB': {
|
|
205
205
|
module: 'VeSyncWarmHumidifier',
|
|
206
|
-
features: ['display', 'humidity', 'mist', '
|
|
206
|
+
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode', 'night_light']
|
|
207
207
|
},
|
|
208
208
|
'LUH-A601S-AUSW': {
|
|
209
209
|
module: 'VeSyncWarmHumidifier',
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VeSyncHumidifier } from './humidifier';
|
|
2
2
|
import { VeSync } from '../vesync';
|
|
3
3
|
import { Helpers } from '../helpers';
|
|
4
4
|
import { logger } from '../logger';
|
|
@@ -6,9 +6,9 @@ import { logger } from '../logger';
|
|
|
6
6
|
/**
|
|
7
7
|
* VeSync Humidifier 200/300S Class
|
|
8
8
|
*/
|
|
9
|
-
export class VeSyncHumid200300S extends
|
|
9
|
+
export class VeSyncHumid200300S extends VeSyncHumidifier {
|
|
10
10
|
protected readonly modes = ['auto', 'manual', 'sleep'] as const;
|
|
11
|
-
protected readonly features = ['humidity', 'mist', 'display', 'timer', 'auto_mode'];
|
|
11
|
+
protected readonly features = ['humidity', 'mist', 'display', 'timer', 'auto_mode', 'night_light'];
|
|
12
12
|
protected readonly mistLevels = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
13
13
|
protected readonly humidityRange = { min: 30, max: 80 };
|
|
14
14
|
|
|
@@ -51,12 +51,13 @@ export class VeSyncHumid200300S extends VeSyncWarmHumidifier {
|
|
|
51
51
|
target_humidity: result.target_humidity || result.humidity || 0, // Target humidity
|
|
52
52
|
mist_level: result.mist_level || 0,
|
|
53
53
|
mist_virtual_level: result.mist_virtual_level || 0,
|
|
54
|
-
warm_level: result.warm_level || 0,
|
|
55
54
|
water_lacks: result.water_lacks || false,
|
|
56
55
|
humidity_high: result.humidity_high || false,
|
|
57
56
|
water_tank_lifted: result.water_tank_lifted || false,
|
|
58
57
|
display: result.display || false,
|
|
59
58
|
automatic_stop: result.automatic_stop_reach_target || false,
|
|
59
|
+
automatic_stop_configured: result.configuration?.automatic_stop || false,
|
|
60
|
+
auto_target_humidity: result.configuration?.auto_target_humidity || 0,
|
|
60
61
|
configuration: result.configuration || {},
|
|
61
62
|
connection_status: result.connection_status || null,
|
|
62
63
|
night_light_brightness: result.night_light_brightness || 0
|
|
@@ -116,51 +117,6 @@ export class VeSyncHumid200300S extends VeSyncWarmHumidifier {
|
|
|
116
117
|
return success;
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
/**
|
|
120
|
-
* Set night light brightness
|
|
121
|
-
*/
|
|
122
|
-
async setNightLightBrightness(brightness: number): Promise<boolean> {
|
|
123
|
-
if (brightness < 0 || brightness > 100) {
|
|
124
|
-
const error = `Invalid brightness: ${brightness}. Must be between 0 and 100`;
|
|
125
|
-
logger.error(`${error} for device: ${this.deviceName}`);
|
|
126
|
-
throw new Error(error);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
logger.debug(`Setting night light brightness to ${brightness} for device: ${this.deviceName}`);
|
|
130
|
-
const [response, status] = await this.callApi(
|
|
131
|
-
'/cloud/v2/deviceManaged/bypassV2',
|
|
132
|
-
'post',
|
|
133
|
-
{
|
|
134
|
-
...Helpers.reqBody(this.manager, 'bypassV2'),
|
|
135
|
-
cid: this.cid,
|
|
136
|
-
configModule: this.configModule,
|
|
137
|
-
payload: {
|
|
138
|
-
data: {
|
|
139
|
-
brightness
|
|
140
|
-
},
|
|
141
|
-
method: 'setNightLight',
|
|
142
|
-
source: 'APP'
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
Helpers.reqHeaderBypass()
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
const success = this.checkResponse([response, status], 'setNightLightBrightness');
|
|
149
|
-
if (success) {
|
|
150
|
-
this.details.night_light_brightness = brightness;
|
|
151
|
-
} else {
|
|
152
|
-
logger.error(`Failed to set night light brightness to ${brightness} for device: ${this.deviceName}`);
|
|
153
|
-
}
|
|
154
|
-
return success;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Get night light brightness
|
|
159
|
-
*/
|
|
160
|
-
get nightLightBrightness(): number {
|
|
161
|
-
return this.details.night_light_brightness || 0;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
120
|
/**
|
|
165
121
|
* Get configuration
|
|
166
122
|
*/
|
|
@@ -178,30 +134,37 @@ export class VeSyncHumid200300S extends VeSyncWarmHumidifier {
|
|
|
178
134
|
|
|
179
135
|
/**
|
|
180
136
|
* Get target humidity
|
|
181
|
-
* Override base class to return target humidity
|
|
137
|
+
* Override base class to return target humidity from configuration
|
|
182
138
|
*/
|
|
183
139
|
get humidity(): number {
|
|
184
|
-
return this.details.
|
|
140
|
+
return this.details.auto_target_humidity || 0;
|
|
185
141
|
}
|
|
186
142
|
|
|
187
143
|
/**
|
|
188
|
-
*
|
|
189
|
-
* Override base class to properly update target humidity
|
|
144
|
+
* Get automatic stop configuration
|
|
190
145
|
*/
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
logger.error(`${error} for device: ${this.deviceName}`);
|
|
195
|
-
throw new Error(error);
|
|
196
|
-
}
|
|
146
|
+
get automaticStopConfigured(): boolean {
|
|
147
|
+
return this.details.automatic_stop_configured || false;
|
|
148
|
+
}
|
|
197
149
|
|
|
198
|
-
|
|
199
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Get night light brightness
|
|
152
|
+
*/
|
|
153
|
+
get nightLightBrightness(): number {
|
|
154
|
+
return this.details.night_light_brightness || 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Set night light brightness
|
|
159
|
+
*/
|
|
160
|
+
async setNightLightBrightness(brightness: number): Promise<boolean> {
|
|
161
|
+
if (brightness < 0 || brightness > 100) {
|
|
162
|
+
const error = `Invalid brightness: ${brightness}. Must be between 0 and 100`;
|
|
200
163
|
logger.error(`${error} for device: ${this.deviceName}`);
|
|
201
164
|
throw new Error(error);
|
|
202
165
|
}
|
|
203
166
|
|
|
204
|
-
logger.debug(`Setting
|
|
167
|
+
logger.debug(`Setting night light brightness to ${brightness} for device: ${this.deviceName}`);
|
|
205
168
|
const [response, status] = await this.callApi(
|
|
206
169
|
'/cloud/v2/deviceManaged/bypassV2',
|
|
207
170
|
'post',
|
|
@@ -211,23 +174,29 @@ export class VeSyncHumid200300S extends VeSyncWarmHumidifier {
|
|
|
211
174
|
configModule: this.configModule,
|
|
212
175
|
payload: {
|
|
213
176
|
data: {
|
|
214
|
-
|
|
177
|
+
brightness
|
|
215
178
|
},
|
|
216
|
-
method: '
|
|
179
|
+
method: 'setNightLight',
|
|
217
180
|
source: 'APP'
|
|
218
181
|
}
|
|
219
182
|
},
|
|
220
183
|
Helpers.reqHeaderBypass()
|
|
221
184
|
);
|
|
222
185
|
|
|
223
|
-
|
|
186
|
+
// Check for error code 11000000 which indicates feature not supported
|
|
187
|
+
if (response?.result?.code === 11000000) {
|
|
188
|
+
logger.warn(`Night light control not supported by device: ${this.deviceName} (${this.deviceType})`);
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const success = this.checkResponse([response, status], 'setNightLightBrightness');
|
|
224
193
|
if (success) {
|
|
225
|
-
this.details.
|
|
194
|
+
this.details.night_light_brightness = brightness;
|
|
226
195
|
// Get latest state and log it
|
|
227
196
|
await this.getDetails();
|
|
228
|
-
logger.debug(`Device state after
|
|
197
|
+
logger.debug(`Device state after night light brightness change: ${JSON.stringify(this.details)}`);
|
|
229
198
|
} else {
|
|
230
|
-
logger.error(`Failed to set
|
|
199
|
+
logger.error(`Failed to set night light brightness to ${brightness} for device: ${this.deviceName}`);
|
|
231
200
|
}
|
|
232
201
|
return success;
|
|
233
202
|
}
|
package/src/lib/vesyncFan.ts
CHANGED
|
@@ -216,7 +216,7 @@ export const fanConfig: FanConfig = {
|
|
|
216
216
|
// LUH Series
|
|
217
217
|
'LUH-A601S-WUSB': {
|
|
218
218
|
module: 'VeSyncWarmHumidifier',
|
|
219
|
-
features: ['display', 'humidity', 'mist', '
|
|
219
|
+
features: ['display', 'humidity', 'mist', 'timer', 'auto_mode', 'night_light']
|
|
220
220
|
},
|
|
221
221
|
'LUH-A601S-AUSW': {
|
|
222
222
|
module: 'VeSyncWarmHumidifier',
|