tsvesync 1.0.83 → 1.0.85
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 +14 -9
- package/package.json +1 -1
- package/src/lib/fans/air131.ts +17 -8
package/dist/lib/fans/air131.js
CHANGED
|
@@ -19,7 +19,6 @@ class VeSyncAir131 extends vesyncFan_1.VeSyncFan {
|
|
|
19
19
|
* Get device details
|
|
20
20
|
*/
|
|
21
21
|
async getDetails() {
|
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
23
22
|
logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
|
|
24
23
|
const [response, status] = await this.callApi('/131airPurifier/v1/device/deviceDetail', 'post', {
|
|
25
24
|
acceptLanguage: 'en',
|
|
@@ -43,16 +42,19 @@ class VeSyncAir131 extends vesyncFan_1.VeSyncFan {
|
|
|
43
42
|
});
|
|
44
43
|
const success = this.checkResponse([response, status], 'getDetails');
|
|
45
44
|
if (success && response) {
|
|
46
|
-
|
|
45
|
+
// Check if data is in response.result or directly in response
|
|
46
|
+
const data = response.result || response;
|
|
47
|
+
this.deviceStatus = data.deviceStatus === 'on' ? 'on' : 'off';
|
|
47
48
|
this.details = {
|
|
48
|
-
mode:
|
|
49
|
-
speed:
|
|
50
|
-
filterLife:
|
|
51
|
-
screenStatus:
|
|
52
|
-
childLock:
|
|
53
|
-
airQuality:
|
|
54
|
-
active_time:
|
|
49
|
+
mode: data.mode || 'manual', // Default to manual if not specified
|
|
50
|
+
speed: data.level || 0,
|
|
51
|
+
filterLife: data.filterLife || 0,
|
|
52
|
+
screenStatus: data.screenStatus || 'off',
|
|
53
|
+
childLock: data.childLock || false,
|
|
54
|
+
airQuality: data.airQuality || 'unknown',
|
|
55
|
+
active_time: data.activeTime || 0
|
|
55
56
|
};
|
|
57
|
+
logger_1.logger.debug(`${this.deviceName}: Updated details - mode: ${this.details.mode}, speed: ${this.details.speed}, status: ${this.deviceStatus}`);
|
|
56
58
|
return true;
|
|
57
59
|
}
|
|
58
60
|
// Log additional details on failure
|
|
@@ -93,6 +95,9 @@ class VeSyncAir131 extends vesyncFan_1.VeSyncFan {
|
|
|
93
95
|
if (success) {
|
|
94
96
|
// Update device status immediately
|
|
95
97
|
this.deviceStatus = 'on';
|
|
98
|
+
// Fetch device details to get current speed and other settings
|
|
99
|
+
logger_1.logger.debug(`${this.deviceName}: Fetching device details after turning on`);
|
|
100
|
+
await this.getDetails();
|
|
96
101
|
}
|
|
97
102
|
else {
|
|
98
103
|
logger_1.logger.error(`Failed to turn on device: ${this.deviceName}`);
|
package/package.json
CHANGED
package/src/lib/fans/air131.ts
CHANGED
|
@@ -51,16 +51,21 @@ export class VeSyncAir131 extends VeSyncFan {
|
|
|
51
51
|
|
|
52
52
|
const success = this.checkResponse([response, status], 'getDetails');
|
|
53
53
|
if (success && response) {
|
|
54
|
-
|
|
54
|
+
// Check if data is in response.result or directly in response
|
|
55
|
+
const data = response.result || response;
|
|
56
|
+
|
|
57
|
+
this.deviceStatus = data.deviceStatus === 'on' ? 'on' : 'off';
|
|
55
58
|
this.details = {
|
|
56
|
-
mode:
|
|
57
|
-
speed:
|
|
58
|
-
filterLife:
|
|
59
|
-
screenStatus:
|
|
60
|
-
childLock:
|
|
61
|
-
airQuality:
|
|
62
|
-
active_time:
|
|
59
|
+
mode: data.mode || 'manual', // Default to manual if not specified
|
|
60
|
+
speed: data.level || 0,
|
|
61
|
+
filterLife: data.filterLife || 0,
|
|
62
|
+
screenStatus: data.screenStatus || 'off',
|
|
63
|
+
childLock: data.childLock || false,
|
|
64
|
+
airQuality: data.airQuality || 'unknown',
|
|
65
|
+
active_time: data.activeTime || 0
|
|
63
66
|
};
|
|
67
|
+
|
|
68
|
+
logger.debug(`${this.deviceName}: Updated details - mode: ${this.details.mode}, speed: ${this.details.speed}, status: ${this.deviceStatus}`);
|
|
64
69
|
return true;
|
|
65
70
|
}
|
|
66
71
|
|
|
@@ -111,6 +116,10 @@ export class VeSyncAir131 extends VeSyncFan {
|
|
|
111
116
|
if (success) {
|
|
112
117
|
// Update device status immediately
|
|
113
118
|
this.deviceStatus = 'on';
|
|
119
|
+
|
|
120
|
+
// Fetch device details to get current speed and other settings
|
|
121
|
+
logger.debug(`${this.deviceName}: Fetching device details after turning on`);
|
|
122
|
+
await this.getDetails();
|
|
114
123
|
} else {
|
|
115
124
|
logger.error(`Failed to turn on device: ${this.deviceName}`);
|
|
116
125
|
}
|