TP-Link/Kasa Bulbs and Plugs Control


(Dave Gutheinz) #488

I am still trying to fix the March 1, 2 hole (where the system will have to look two months back for data vice one month. Currently, it will cause a very incomplete summary (only using Jan and March data). Now that the basic algorithm is smooth, I can change to accommodate the special case. Stay tuned.

Monthly Summary Stats. The bulbs (and plugs?) with energy monitor can provide monthly consumption summaries for the previous year by month. Is anyone interested in a SmartApp that will gather this data on the 1st of each month and SMS to your phone? It would send two messages - current year summary and previous year summary.

(Stephane) #489

Just install cloud base and everything works fine! Great Job Thanks!


Hi everyone! Be gentle… I’m brand new to SmartThings as of today! :slight_smile:

I have successfully added three Z-Wave devices. The only other device I have that hasn’t been added is a TP-Link HS105 Smart Plug. I’m trying to get it up and running but not having any luck. Here’s what I’ve done so far.

  1. Copied the code for (Cloud) TP-Link Plug-Switch.groovy and Created/Published to My Device Handlers.
  2. Status shows “Published”.
  3. I go to my phone and nothing shows up under “My Apps”

What am I missing? Thanks so much!

(Dave Gutheinz) #491

You also have to install the smart app. Please read the instructions at the GitHub link.


Thanks Dave! I’ve got it working now. Really appreciate the help. :+1:t2:

(Dave Gutheinz) #493

One final update. The latest (today) version corrects Energy Monitor statistics for March 1 and 2. On those two days, the program must look back two months (current plus two) vice one to obtain the energy monitor statistics. This required some special logic plus additional parsing code.

(AaronW) #494


Any update on making a GitHub integration for simple one click updates on this?

(Sandy) #495

Its resolved now not sure what worked the password or reinstallation.

(Peter Hayward) #496

Continuing the discussion from TP-Link Bulbs and Plugs Control:

Hello All,

I’m quite new to SmartThings this so please be kind.

I’ve installed the Cloud Device Handlers and the Smart App (referred to as Service Manager in the .pdf - I assume they are the same thing) in SmartThings. I even registered with TP-Link as per item 3 which I think was a mistake ?!?

Installed TP-Link Cloud Connect in SmartThings on the iPhone via Add a SmartApp - MyApps…

Entered my Kasa username and password and clicked Initial Install.

The phone doesn’t give much away - just a blank screen. Followed eventually by the same enter details screen. I can enter the wrong password with the same results.

The Live Logging screen gives the error:
java.lang.NullPointerException: Cannot get property ‘id’ on null object @line 227 (getToken)

I’m missing something just can’t figure what. I can enter the wrong password with the same results.

I have the latest version of everything installed.

Please help !

Thanks, Peter.

(Dave Gutheinz) #497

The error indicates that a call for your hub data returned a null. My best guess of the cause is you missed a step in the installation. Specifically, prior to installing the Service Manager (or Device Handler), you needed to select your location right after login and before going to the SmartAps page. If you failed to do this, then the Service Manager (Device Handler) will not be associated with a hub.

Please review the installation instructions in the documentation folder at the GIT HUB site and assure you completed all steps.

Final comment:

I even registered with TP-Link as per item 3 which I think was a mistake ?!?

Item three in the current instructions does not refer registering with Kasa. Assure you are using the correct documentation located at the link below. (The Kasa account is required since this integration goes through the Kasa cloud - using your username/password.)

Shout back if you have further issues.


(Dave Gutheinz) #498

I thought I did that on the latest release. Could you check and see if you can access the files via the integration? (Note, I had to change the namespace, so the previous version (before Jan 30, 2018) may not be accessible. I would like to know if it worked (It does for me, but maybe I forgot a step).

(AaronW) #499

I must be blind but I do not see the original post stating the GitHub name/repository/branch and also do not see any posts stating this anywhere either. Can you edit your original post and place GitHub information so others can find. Of course I could be blind and don’t see it.

(Dave Gutheinz) #500

Novice here. Only been doing any coding for 11 months and at 69, maybe I have lost a few brain cells. I am able to access the code in the SmartThings My Device Handler window, using update from Repo function. If you can not do this, then I missed a step and will investigate further.

(AaronW) #501

Yeah I troubleshooted and added your repository to the STE IDE based on your above links to the actual GitHub. The issue is when I click Update from Repo nothing shows up in either the DTH or the SA sections. So something isn’t correct.

I have for your GitGub Repository as:

Owner: DaveGut
Name: Cloud-Based_TP-Link-to-SmartThings-Integration
Branch: Master

(Dave Gutheinz) #502

Will work on it.

(Dave Gutheinz) #503

In case it helps, below is the path to my SmartThings integration. This is where I place finished and tested code via the update on the IDE.

Device Types


(Darren) #504

@Gutheinz I don’t think you have lost any brain cells :grin: I think you have and are doing a sterling job in designing this interface, answering, querying, assisting in troubleshooting and continually enhancing your code as we ask questions from around the globe - its no mean feat.

Well done and once again thank you.

(Peter Hayward) #505

Hello Dave,

Thanks for getting back to me. I think what has confused me (and others)
is the Cloud-Based solution requires that one has a physical Samsung hub
in the local network. As you have a Hub-Based solution the name
Cloud-Based suggests that your magic will happen without the need of the
Samsung SmartThings hub.

As I don’t have a hub, I guess your solutions wont work for me (I hope I
am wrong) ?

I was hoping not to have to go the Home Assistant route. I already have
a good half-dozen physical hubs/routers/switches with various software

All she wants is to do is say to “Alexa Going to Work” and have a
TP-Link switch turn off, a Hive bulb turn on, a two minute delay and the
Hive bulb turn off.

All these things simple on their own, stringing them together is proving
more complex than rocket science…

Regards, Peter.

(Dave Gutheinz) #506

TP Link has an integration with Amazon Alexa. It can be merged with Alexa scenes to do what you want.

(Peter Hayward) #507

Indeed it does, as does Hive. Both work fine on their own. Combining
them both with a delay with one command is the challenge… Unless you
know otherwise ?!?

IFTTT would be an option if it were IFTTandTandT…