tsvesync 1.0.79 → 1.0.81
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/air131.js +13 -3
- package/package.json +1 -1
- package/src/lib/fans/air131.ts +16 -3
package/dist/lib/fans/air131.js
CHANGED
|
@@ -21,7 +21,7 @@ class VeSyncAir131 extends vesyncFan_1.VeSyncFan {
|
|
|
21
21
|
async getDetails() {
|
|
22
22
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
23
23
|
logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
|
|
24
|
-
const [response, status] = await this.callApi('/131airPurifier/v1/device/
|
|
24
|
+
const [response, status] = await this.callApi('/131airPurifier/v1/device/deviceDetail', 'post', {
|
|
25
25
|
acceptLanguage: 'en',
|
|
26
26
|
accountID: this.manager.accountId,
|
|
27
27
|
appVersion: '2.8.6',
|
|
@@ -31,6 +31,7 @@ class VeSyncAir131 extends vesyncFan_1.VeSyncFan {
|
|
|
31
31
|
phoneOS: 'Android',
|
|
32
32
|
timeZone: this.manager.timeZone,
|
|
33
33
|
token: this.manager.token,
|
|
34
|
+
traceId: new Date().getTime().toString(),
|
|
34
35
|
uuid: this.uuid
|
|
35
36
|
}, {
|
|
36
37
|
'accept-language': 'en',
|
|
@@ -113,10 +114,19 @@ class VeSyncAir131 extends vesyncFan_1.VeSyncFan {
|
|
|
113
114
|
*/
|
|
114
115
|
async changeFanSpeed(speed) {
|
|
115
116
|
logger_1.logger.info(`Changing fan speed to ${speed} for device: ${this.deviceName}`);
|
|
117
|
+
// Get fresh device details first to ensure we have the current mode
|
|
118
|
+
await this.getDetails();
|
|
116
119
|
// Check if device is in manual mode
|
|
117
120
|
if (this.details.mode !== 'manual') {
|
|
118
|
-
logger_1.logger.debug(`${this.deviceName} not in manual mode,
|
|
119
|
-
|
|
121
|
+
logger_1.logger.debug(`${this.deviceName} not in manual mode (current mode: ${this.details.mode}), switching to manual mode first`);
|
|
122
|
+
// Switch to manual mode first
|
|
123
|
+
const modeSuccess = await this.manualMode();
|
|
124
|
+
if (!modeSuccess) {
|
|
125
|
+
logger_1.logger.error(`Failed to switch to manual mode for device: ${this.deviceName}`);
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
// Wait a bit for the mode change to take effect
|
|
129
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
120
130
|
}
|
|
121
131
|
// Validate speed for LV series (1-3)
|
|
122
132
|
if (speed < 1 || speed > 3) {
|
package/package.json
CHANGED
package/src/lib/fans/air131.ts
CHANGED
|
@@ -24,7 +24,7 @@ export class VeSyncAir131 extends VeSyncFan {
|
|
|
24
24
|
logger.debug(`Getting details for device: ${this.deviceName}`);
|
|
25
25
|
|
|
26
26
|
const [response, status] = await this.callApi(
|
|
27
|
-
'/131airPurifier/v1/device/
|
|
27
|
+
'/131airPurifier/v1/device/deviceDetail',
|
|
28
28
|
'post',
|
|
29
29
|
{
|
|
30
30
|
acceptLanguage: 'en',
|
|
@@ -36,6 +36,7 @@ export class VeSyncAir131 extends VeSyncFan {
|
|
|
36
36
|
phoneOS: 'Android',
|
|
37
37
|
timeZone: this.manager.timeZone!,
|
|
38
38
|
token: this.manager.token!,
|
|
39
|
+
traceId: new Date().getTime().toString(),
|
|
39
40
|
uuid: this.uuid
|
|
40
41
|
},
|
|
41
42
|
{
|
|
@@ -139,10 +140,22 @@ export class VeSyncAir131 extends VeSyncFan {
|
|
|
139
140
|
async changeFanSpeed(speed: number): Promise<boolean> {
|
|
140
141
|
logger.info(`Changing fan speed to ${speed} for device: ${this.deviceName}`);
|
|
141
142
|
|
|
143
|
+
// Get fresh device details first to ensure we have the current mode
|
|
144
|
+
await this.getDetails();
|
|
145
|
+
|
|
142
146
|
// Check if device is in manual mode
|
|
143
147
|
if (this.details.mode !== 'manual') {
|
|
144
|
-
logger.debug(`${this.deviceName} not in manual mode,
|
|
145
|
-
|
|
148
|
+
logger.debug(`${this.deviceName} not in manual mode (current mode: ${this.details.mode}), switching to manual mode first`);
|
|
149
|
+
|
|
150
|
+
// Switch to manual mode first
|
|
151
|
+
const modeSuccess = await this.manualMode();
|
|
152
|
+
if (!modeSuccess) {
|
|
153
|
+
logger.error(`Failed to switch to manual mode for device: ${this.deviceName}`);
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Wait a bit for the mode change to take effect
|
|
158
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
146
159
|
}
|
|
147
160
|
|
|
148
161
|
// Validate speed for LV series (1-3)
|