A TypeScript library to interact with VeSync controlled devices.
tsvesync is a TypeScript library that allows developers to interact with VeSync controlled devices through its APIs. This library aims to provide a simple and easy-to-use interface for developers to control VeSync devices.
- Interact with VeSync devices through APIs.
- Easy-to-use interface.
npm install tsvesync
import { VeSync } from 'tsvesync';
let veSync = new VeSync();
await veSync.login(this.username, this.password);
/*
* If the password is already saved as a MD5-hex Hash you can use the following
* public async login(username: string, password: string, isHashedPassword: boolean = false)
*/
await veSync.login(this.username, this.password, true);
import {VeSync} from 'tsvesync';
import VeSyncPurifier from "tsvesync/veSyncPurifier";
/*
* Will return a list of devices as VeSyncDeviceBase objects.
* Use instranceof to filter or other methods like matching its uuid
*/
let devices = await veSync.getDevices();
devices.forEach(device => {
if (device.isOn()) {
console.log(device.deviceName + " is online! :)");
}
if (device.isOn() && device instanceof VeSyncPurifier){
device.setFanSpeed(3);
}
})
The devices listed below are supported by the classes mentioned below. Untested devices are marked by a *.
Core200S, Core300S, Core400S, Core600S*
LV-PUR131S*
Classic200S, Classic300S, Dual200S, LV600S*
Contributions are welcome! If you would like to contribute, please follow the guidelines in CONTRIBUTING.md.
tsvesync is licensed under the MIT license. See LICENSE for more information.