tsvesync 1.4.9 → 1.4.11
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 +1 -0
- package/dist/lib/fans/airBaseV2.js +3 -0
- package/dist/lib/vesync.js +8 -4
- package/dist/lib/vesyncBaseDevice.d.ts +6 -0
- package/dist/lib/vesyncBaseDevice.js +8 -0
- package/package.json +1 -1
- package/src/lib/fans/airBaseV2.ts +4 -0
- package/src/lib/vesync.ts +10 -3
- package/src/lib/vesyncBaseDevice.ts +10 -1
|
@@ -45,6 +45,7 @@ export declare class VeSyncAirBaseV2 extends VeSyncAirBypass {
|
|
|
45
45
|
* Determine whether this purifier requires the powerSwitch payload and nested response handling.
|
|
46
46
|
*/
|
|
47
47
|
private requiresPowerSwitchPayload;
|
|
48
|
+
shouldPollDetailsWhenOffline(): boolean;
|
|
48
49
|
/**
|
|
49
50
|
* Override turn on to use the powerSwitch payload required by bypassV2 purifiers.
|
|
50
51
|
*/
|
|
@@ -197,6 +197,9 @@ class VeSyncAirBaseV2 extends airBypass_1.VeSyncAirBypass {
|
|
|
197
197
|
const type = (this.deviceType || '').toUpperCase();
|
|
198
198
|
return type.startsWith('LAP-V') || type.startsWith('LAP-EL');
|
|
199
199
|
}
|
|
200
|
+
shouldPollDetailsWhenOffline() {
|
|
201
|
+
return this.requiresPowerSwitchPayload();
|
|
202
|
+
}
|
|
200
203
|
/**
|
|
201
204
|
* Override turn on to use the powerSwitch payload required by bypassV2 purifiers.
|
|
202
205
|
*/
|
package/dist/lib/vesync.js
CHANGED
|
@@ -859,12 +859,16 @@ class VeSync {
|
|
|
859
859
|
for (const deviceList of Object.values(this._devList)) {
|
|
860
860
|
for (const device of deviceList) {
|
|
861
861
|
try {
|
|
862
|
-
if (
|
|
863
|
-
await device.getDetails();
|
|
864
|
-
}
|
|
865
|
-
else {
|
|
862
|
+
if (this.shouldExcludeDevice(device)) {
|
|
866
863
|
logger_1.logger.debug(`Skipping details update for excluded device: ${device.deviceName}`);
|
|
864
|
+
continue;
|
|
865
|
+
}
|
|
866
|
+
if (String(device.connectionStatus || '').toLowerCase() === 'offline' &&
|
|
867
|
+
!device.shouldPollDetailsWhenOffline()) {
|
|
868
|
+
logger_1.logger.debug(`Skipping details update for offline device: ${device.deviceName}`);
|
|
869
|
+
continue;
|
|
867
870
|
}
|
|
871
|
+
await device.getDetails();
|
|
868
872
|
}
|
|
869
873
|
catch (error) {
|
|
870
874
|
logger_1.logger.error(`Error updating ${device.deviceName}:`, error);
|
|
@@ -36,6 +36,12 @@ export declare abstract class VeSyncBaseDevice {
|
|
|
36
36
|
* Get device details
|
|
37
37
|
*/
|
|
38
38
|
abstract getDetails(): Promise<Boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Some device families have a detail endpoint that is more reliable than
|
|
41
|
+
* the device-list connection status. Those devices can opt into detail
|
|
42
|
+
* polling even when the list reports them offline.
|
|
43
|
+
*/
|
|
44
|
+
shouldPollDetailsWhenOffline(): boolean;
|
|
39
45
|
/**
|
|
40
46
|
* Update device details
|
|
41
47
|
*/
|
|
@@ -80,6 +80,14 @@ class VeSyncBaseDevice {
|
|
|
80
80
|
logger_1.logger.error(`Response: ${msg}`);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Some device families have a detail endpoint that is more reliable than
|
|
85
|
+
* the device-list connection status. Those devices can opt into detail
|
|
86
|
+
* polling even when the list reports them offline.
|
|
87
|
+
*/
|
|
88
|
+
shouldPollDetailsWhenOffline() {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
83
91
|
/**
|
|
84
92
|
* Update device details
|
|
85
93
|
*/
|
package/package.json
CHANGED
|
@@ -223,6 +223,10 @@ export class VeSyncAirBaseV2 extends VeSyncAirBypass {
|
|
|
223
223
|
return type.startsWith('LAP-V') || type.startsWith('LAP-EL');
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
override shouldPollDetailsWhenOffline(): boolean {
|
|
227
|
+
return this.requiresPowerSwitchPayload();
|
|
228
|
+
}
|
|
229
|
+
|
|
226
230
|
/**
|
|
227
231
|
* Override turn on to use the powerSwitch payload required by bypassV2 purifiers.
|
|
228
232
|
*/
|
package/src/lib/vesync.ts
CHANGED
|
@@ -1028,11 +1028,18 @@ export class VeSync {
|
|
|
1028
1028
|
for (const deviceList of Object.values(this._devList)) {
|
|
1029
1029
|
for (const device of deviceList) {
|
|
1030
1030
|
try {
|
|
1031
|
-
if (
|
|
1032
|
-
await device.getDetails();
|
|
1033
|
-
} else {
|
|
1031
|
+
if (this.shouldExcludeDevice(device)) {
|
|
1034
1032
|
logger.debug(`Skipping details update for excluded device: ${device.deviceName}`);
|
|
1033
|
+
continue;
|
|
1035
1034
|
}
|
|
1035
|
+
if (
|
|
1036
|
+
String(device.connectionStatus || '').toLowerCase() === 'offline' &&
|
|
1037
|
+
!device.shouldPollDetailsWhenOffline()
|
|
1038
|
+
) {
|
|
1039
|
+
logger.debug(`Skipping details update for offline device: ${device.deviceName}`);
|
|
1040
|
+
continue;
|
|
1041
|
+
}
|
|
1042
|
+
await device.getDetails();
|
|
1036
1043
|
} catch (error) {
|
|
1037
1044
|
logger.error(`Error updating ${device.deviceName}:`, error);
|
|
1038
1045
|
}
|
|
@@ -107,6 +107,15 @@ export abstract class VeSyncBaseDevice {
|
|
|
107
107
|
*/
|
|
108
108
|
abstract getDetails(): Promise<Boolean>;
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Some device families have a detail endpoint that is more reliable than
|
|
112
|
+
* the device-list connection status. Those devices can opt into detail
|
|
113
|
+
* polling even when the list reports them offline.
|
|
114
|
+
*/
|
|
115
|
+
shouldPollDetailsWhenOffline(): boolean {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
|
|
110
119
|
/**
|
|
111
120
|
* Update device details
|
|
112
121
|
*/
|
|
@@ -125,4 +134,4 @@ export abstract class VeSyncBaseDevice {
|
|
|
125
134
|
): Promise<[any, number]> {
|
|
126
135
|
return await Helpers.callApi(endpoint, method, data, headers, this.manager);
|
|
127
136
|
}
|
|
128
|
-
}
|
|
137
|
+
}
|