tsvesync 1.0.39 → 1.0.40
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 +12 -0
- package/dist/lib/vesyncFanImpl.js +24 -0
- package/package.json +1 -1
- package/src/lib/vesyncFanImpl.ts +35 -0
|
@@ -336,6 +336,18 @@ export declare class VeSyncTowerFan extends VeSyncAirBaseV2 {
|
|
|
336
336
|
* Get error code
|
|
337
337
|
*/
|
|
338
338
|
get errorCode(): number;
|
|
339
|
+
/**
|
|
340
|
+
* Set oscillation state
|
|
341
|
+
*/
|
|
342
|
+
setOscillation(toggle: boolean): Promise<boolean>;
|
|
343
|
+
/**
|
|
344
|
+
* Turn oscillation on
|
|
345
|
+
*/
|
|
346
|
+
setOscillationOn(): Promise<boolean>;
|
|
347
|
+
/**
|
|
348
|
+
* Turn oscillation off
|
|
349
|
+
*/
|
|
350
|
+
setOscillationOff(): Promise<boolean>;
|
|
339
351
|
/**
|
|
340
352
|
* Display device info
|
|
341
353
|
*/
|
|
@@ -1382,6 +1382,30 @@ class VeSyncTowerFan extends VeSyncAirBaseV2 {
|
|
|
1382
1382
|
get errorCode() {
|
|
1383
1383
|
return this.details.errorCode || 0;
|
|
1384
1384
|
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Set oscillation state
|
|
1387
|
+
*/
|
|
1388
|
+
async setOscillation(toggle) {
|
|
1389
|
+
logger_1.logger.debug(`Setting oscillation to ${toggle ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
1390
|
+
const [head, body] = this.buildApiDict('setSwitch');
|
|
1391
|
+
body.payload.data = {
|
|
1392
|
+
oscillationSwitch: toggle ? 1 : 0
|
|
1393
|
+
};
|
|
1394
|
+
const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', body, head);
|
|
1395
|
+
return this.checkResponse([response, status], 'setOscillation');
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Turn oscillation on
|
|
1399
|
+
*/
|
|
1400
|
+
async setOscillationOn() {
|
|
1401
|
+
return this.setOscillation(true);
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Turn oscillation off
|
|
1405
|
+
*/
|
|
1406
|
+
async setOscillationOff() {
|
|
1407
|
+
return this.setOscillation(false);
|
|
1408
|
+
}
|
|
1385
1409
|
/**
|
|
1386
1410
|
* Display device info
|
|
1387
1411
|
*/
|
package/package.json
CHANGED
package/src/lib/vesyncFanImpl.ts
CHANGED
|
@@ -1694,6 +1694,41 @@ export class VeSyncTowerFan extends VeSyncAirBaseV2 {
|
|
|
1694
1694
|
return this.details.errorCode || 0;
|
|
1695
1695
|
}
|
|
1696
1696
|
|
|
1697
|
+
/**
|
|
1698
|
+
* Set oscillation state
|
|
1699
|
+
*/
|
|
1700
|
+
async setOscillation(toggle: boolean): Promise<boolean> {
|
|
1701
|
+
logger.debug(`Setting oscillation to ${toggle ? 'on' : 'off'} for device: ${this.deviceName}`);
|
|
1702
|
+
|
|
1703
|
+
const [head, body] = this.buildApiDict('setSwitch');
|
|
1704
|
+
body.payload.data = {
|
|
1705
|
+
oscillationSwitch: toggle ? 1 : 0
|
|
1706
|
+
};
|
|
1707
|
+
|
|
1708
|
+
const [response, status] = await this.callApi(
|
|
1709
|
+
'/cloud/v2/deviceManaged/bypassV2',
|
|
1710
|
+
'post',
|
|
1711
|
+
body,
|
|
1712
|
+
head
|
|
1713
|
+
);
|
|
1714
|
+
|
|
1715
|
+
return this.checkResponse([response, status], 'setOscillation');
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
/**
|
|
1719
|
+
* Turn oscillation on
|
|
1720
|
+
*/
|
|
1721
|
+
async setOscillationOn(): Promise<boolean> {
|
|
1722
|
+
return this.setOscillation(true);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* Turn oscillation off
|
|
1727
|
+
*/
|
|
1728
|
+
async setOscillationOff(): Promise<boolean> {
|
|
1729
|
+
return this.setOscillation(false);
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1697
1732
|
/**
|
|
1698
1733
|
* Display device info
|
|
1699
1734
|
*/
|