1.0.8 • Published 7 months ago
tapo-smartplug-control v1.0.8
Tapo Smartplug Connect
This is a library where you can connect to your Smartplugs, lightbulbs and control them with pure JavaScript.
Usage
Discovery
In order to get al your devices, it is advisable to login to your TP-Link account and call the listDevicesByType function. To do this:
const tapo = require('tapo-smartplug-control');
const cloudToken = await cloudLogin(email, password);
const devices = await listDevicesByType(cloudToken, 'SMART.TAPOPLUG');
Once you know what device to use, do this:
const deviceToken = await loginDeviceByIp(email, password, ip);
// or
const deviceToken = await loginWithDevice(email, password, devices[0]);
const deviceInfoResponse = await getDeviceInfo(deviceToken);
console.log(deviceInfoResponse);
Device State
To change the state of your device, e.g turn it off or on you can do this:
await tapo.on(deviceToken); // turn on
await tapo.off(deviceToken); // turn off
Load videos from tapo-care cloud
const cloudVideos = await tapoCareCloudVideos(cloudToken, deviceId); //deviceId from listDevicesByType
1.0.8
7 months ago