tsvesync 1.0.48 → 1.0.49
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/vesyncFanImpl.d.ts +4 -4
- package/dist/lib/vesyncFanImpl.js +18 -12
- package/package.json +1 -1
- package/src/lib/vesyncFanImpl.ts +27 -21
|
@@ -314,6 +314,10 @@ export declare class VeSyncAirBaseV2 extends VeSyncAirBypass {
|
|
|
314
314
|
* Display JSON details
|
|
315
315
|
*/
|
|
316
316
|
displayJSON(): string;
|
|
317
|
+
/**
|
|
318
|
+
* Set oscillation state
|
|
319
|
+
*/
|
|
320
|
+
setOscillation(toggle: boolean): Promise<boolean>;
|
|
317
321
|
}
|
|
318
322
|
/**
|
|
319
323
|
* VeSync Tower Fan Implementation
|
|
@@ -421,10 +425,6 @@ export declare class VeSyncTowerFan extends VeSyncAirBaseV2 {
|
|
|
421
425
|
* Get error code
|
|
422
426
|
*/
|
|
423
427
|
get errorCode(): number;
|
|
424
|
-
/**
|
|
425
|
-
* Set oscillation state
|
|
426
|
-
*/
|
|
427
|
-
setOscillation(toggle: boolean): Promise<boolean>;
|
|
428
428
|
/**
|
|
429
429
|
* Turn oscillation on
|
|
430
430
|
*/
|
|
@@ -1449,6 +1449,24 @@ class VeSyncAirBaseV2 extends VeSyncAirBypass {
|
|
|
1449
1449
|
}
|
|
1450
1450
|
return JSON.stringify(details, null, 4);
|
|
1451
1451
|
}
|
|
1452
|
+
/**
|
|
1453
|
+
* Set oscillation state
|
|
1454
|
+
*/
|
|
1455
|
+
async setOscillation(toggle) {
|
|
1456
|
+
logger_1.logger.debug(`Setting oscillation to ${toggle ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
1457
|
+
const [head, body] = this.buildApiDict('setSwitch');
|
|
1458
|
+
body.payload.data = {
|
|
1459
|
+
oscillationSwitch: toggle ? 1 : 0,
|
|
1460
|
+
switchIdx: 0
|
|
1461
|
+
};
|
|
1462
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', body, head);
|
|
1463
|
+
const success = this.checkResponse([response, status], 'setOscillation');
|
|
1464
|
+
if (success) {
|
|
1465
|
+
this.details.oscillationState = toggle;
|
|
1466
|
+
this.details.oscillationSwitch = toggle ? 1 : 0;
|
|
1467
|
+
}
|
|
1468
|
+
return success;
|
|
1469
|
+
}
|
|
1452
1470
|
}
|
|
1453
1471
|
exports.VeSyncAirBaseV2 = VeSyncAirBaseV2;
|
|
1454
1472
|
/**
|
|
@@ -1718,18 +1736,6 @@ class VeSyncTowerFan extends VeSyncAirBaseV2 {
|
|
|
1718
1736
|
get errorCode() {
|
|
1719
1737
|
return this.details.errorCode || 0;
|
|
1720
1738
|
}
|
|
1721
|
-
/**
|
|
1722
|
-
* Set oscillation state
|
|
1723
|
-
*/
|
|
1724
|
-
async setOscillation(toggle) {
|
|
1725
|
-
logger_1.logger.debug(`Setting oscillation to ${toggle ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
1726
|
-
const [head, body] = this.buildApiDict('setSwitch');
|
|
1727
|
-
body.payload.data = {
|
|
1728
|
-
oscillationSwitch: toggle ? 1 : 0
|
|
1729
|
-
};
|
|
1730
|
-
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', body, head);
|
|
1731
|
-
return this.checkResponse([response, status], 'setOscillation');
|
|
1732
|
-
}
|
|
1733
1739
|
/**
|
|
1734
1740
|
* Turn oscillation on
|
|
1735
1741
|
*/
|
package/package.json
CHANGED
package/src/lib/vesyncFanImpl.ts
CHANGED
|
@@ -1786,6 +1786,33 @@ export class VeSyncAirBaseV2 extends VeSyncAirBypass {
|
|
|
1786
1786
|
|
|
1787
1787
|
return JSON.stringify(details, null, 4);
|
|
1788
1788
|
}
|
|
1789
|
+
|
|
1790
|
+
/**
|
|
1791
|
+
* Set oscillation state
|
|
1792
|
+
*/
|
|
1793
|
+
async setOscillation(toggle: boolean): Promise<boolean> {
|
|
1794
|
+
logger.debug(`Setting oscillation to ${toggle ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
1795
|
+
|
|
1796
|
+
const [head, body] = this.buildApiDict('setSwitch');
|
|
1797
|
+
body.payload.data = {
|
|
1798
|
+
oscillationSwitch: toggle ? 1 : 0,
|
|
1799
|
+
switchIdx: 0
|
|
1800
|
+
};
|
|
1801
|
+
|
|
1802
|
+
const [response, status] = await this.callApi(
|
|
1803
|
+
'/cloud/v2/deviceManaged/bypassV2',
|
|
1804
|
+
'post',
|
|
1805
|
+
body,
|
|
1806
|
+
head
|
|
1807
|
+
);
|
|
1808
|
+
|
|
1809
|
+
const success = this.checkResponse([response, status], 'setOscillation');
|
|
1810
|
+
if (success) {
|
|
1811
|
+
this.details.oscillationState = toggle;
|
|
1812
|
+
this.details.oscillationSwitch = toggle ? 1 : 0;
|
|
1813
|
+
}
|
|
1814
|
+
return success;
|
|
1815
|
+
}
|
|
1789
1816
|
}
|
|
1790
1817
|
|
|
1791
1818
|
/**
|
|
@@ -2112,27 +2139,6 @@ export class VeSyncTowerFan extends VeSyncAirBaseV2 {
|
|
|
2112
2139
|
return this.details.errorCode || 0;
|
|
2113
2140
|
}
|
|
2114
2141
|
|
|
2115
|
-
/**
|
|
2116
|
-
* Set oscillation state
|
|
2117
|
-
*/
|
|
2118
|
-
async setOscillation(toggle: boolean): Promise<boolean> {
|
|
2119
|
-
logger.debug(`Setting oscillation to ${toggle ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
2120
|
-
|
|
2121
|
-
const [head, body] = this.buildApiDict('setSwitch');
|
|
2122
|
-
body.payload.data = {
|
|
2123
|
-
oscillationSwitch: toggle ? 1 : 0
|
|
2124
|
-
};
|
|
2125
|
-
|
|
2126
|
-
const [response, status] = await this.callApi(
|
|
2127
|
-
'/cloud/v2/deviceManaged/bypassV2',
|
|
2128
|
-
'post',
|
|
2129
|
-
body,
|
|
2130
|
-
head
|
|
2131
|
-
);
|
|
2132
|
-
|
|
2133
|
-
return this.checkResponse([response, status], 'setOscillation');
|
|
2134
|
-
}
|
|
2135
|
-
|
|
2136
2142
|
/**
|
|
2137
2143
|
* Turn oscillation on
|
|
2138
2144
|
*/
|