plasticrake / tplink-smarthome-api

TP-Link Smarthome WiFi API
MIT License
1.02k stars 142 forks source link

Problem with executing the example code #70

Closed cyoushika closed 5 years ago

cyoushika commented 5 years ago

I have trouble with executing the example code.

I tried to execute the "turn-all-plugs-on.js" by "$node turn-all-plugs-on.js".

But an error came out saying " cannot find the module '..' ".

So, I modified the code by changing the '..' to '../src' so it can find the client.js ( I don't know whether this is correct move or not)

Then I execute the code again, it still not works but tells me, "cannot find module 'tplink-smarthome-crypto'".

I can't find this module anywhere and don't know how to solve this problem.

I tried to use $npm install tplink-smarthome-crypto to install this module but I failed.

Is there anyone who can help me or give me some hints?

cyoushika commented 5 years ago

Sorry, I solved the problem.

Install this API through $npm install tplink-smarthome-api is not enough since it would be only the CLI without the modules ( maybe I did something wrong).

I can control the plug through the CLI perfectly but unable to execute the example code.

To execute the code, I have to install this API with $npm i --save tplink-smarthome-api to keep the modules.

Then change the first line in the example from '..' to the path of the module of tplink-smarthome-api.