adumont / tplink-cloud-api

A node.js npm module to remotely control TP-Link smartplugs (HS100, HS110) and smartbulbs (LB100, LB110, LB120, LB130) using their cloud web service (no need to be on the same wifi/lan)
https://itnerd.space
GNU General Public License v3.0
126 stars 43 forks source link

HS103 Support #35

Open PrabhanshuAttri opened 4 years ago

PrabhanshuAttri commented 4 years ago

Hi @adumont

First of all, thank you for creating this library. I noticed that it doesn't contain support for HS103. I looked through the code and found a way to do it. HS100 class can be used to toggle the device.

Here is the code for HS103 to toggle the device.

const deviceFound = await tplink.findDevice(deviceName);
const hs103Device = new HS100(tplink, deviceFound);
await hs103Device.toggle();

I think if all devices in tplink.ts are exported (hs100, hs110, hs200, etc), the package can support more devices.

Let me know if you want me to work on this.

ColinMcNeil commented 4 years ago

This repo doesn't get updated all that often

adumont commented 4 years ago

Sorry about that. If anyone pushes pull request, I'll gladly merge then and update the npm.

El mié., 25 mar. 2020 4:22, Colin McNeil notifications@github.com escribió:

This repo doesn't get updated all that often

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/adumont/tplink-cloud-api/issues/35#issuecomment-603618449, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACRLWUROAVMPTXIW4TRMPTRJF2H5ANCNFSM4LTDGPBQ .

adumont commented 4 years ago

Hi @PrabhanshuAttri , if the HS100 class works, why do you need a new class?

PrabhanshuAttri commented 4 years ago

If HS100 is exported then this repository can support more devices. Currently, importing HS100 is kinda ugly and not dev friendly.

const __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};

const hs100 = __importDefault(require('./node_modules/tplink-cloud-api/distribution/hs100.js'));