SmartThings Community

TP-Link/Kasa Bulbs and Plugs Control

That worked! My existing switches/outlets are working and I now see the bulbs in SmartThings. Thank you!!

My pleasure.

@Gutheinz, @prayerfuldrop Based on the earlier discussion between yourselves and with all the active changes @Gutheinz you have implemented (I think you found yourself a new full time job :slight_smile: ) , I’m just wondering if you managed to re-work the solution as noted previously as I haven’t seen any information on the GIT Hub integration or is it still a copy and paste job to update our code base.

I noticed a post by @danielccm yesterday whereby he was attempting the same thing who from past experience will very helpful in assisting, if this is something you have not achieved and are still interested in. His post is here

Still a copy and paste. I am working on other items at this time. Thanks for the nudge. had an issue with installation. On selection of initial install from the phone app, the system transition to a blank screen.

  1. Never reported before.
  2. Possible cause: Something in the SmartThings Infrastructure.
  3. What SmartThings application are you running (SmartThings Classic or the new SmartThings (aka Samsung Connect)? Although the Smart App should work with the new SmartThings App (Samsung Connect), it is not tested and Samsung Connect is not yet finished - So no help at this time.
  4. If you are running the SmartThing Classic, then, please

a. Log into the SmartThings IDE and select your location.
b. Go to the live logging tab.
c. Run the phone app again while the logging runs.
d. On the logging page, select TP-Link (unofficial) Connect log.
e. Copy and paste the log here so I have some clue on what to do.


NEW SmartThings Application and this Integration

This integration has not been tested with the new Samsung SmartThings Application (formerly Samsung Connect). It was designed, integrated, and tested using what is now called the “SmartThings Classic” application.

Although available, the new SmartThings App is not necessarily compatible with custom device handlers and smart applications.

Although available, this new SmartThings App is not necessarily for use in custom device handlers and smart applications. See the threads:

If you succeed in installation and running on the new app, Please add comments on this blog.

Recommendation for existing users: Do not upgrade to the new SmartThings App until the SmartThings staff says that transition tools are ready. (At that time, I will also test and fix any deltas I can so that this integration works.

any seen this error before, using smarthtinhgs clasic v2 hub cloud excicution
from the DH
1:08:39 PM: error java.lang.reflect.UndeclaredThrowableException @line 172 (sendCmdtoCloud)

Did the device recover and is working, or are the errors continuing?

If so, what was being done? What device?

GitHub Integration

I believe I have GitHub integration correct (finally).

Owner: “DaveGut”
Name: “SmartThingsPublic”
Branch: “master”

If this indeed works, please tell me. I will add to lead-in text.

Update. Legacy users. If you want to install the Feb 18 version, you will have to delete the existing devices / handlers. This was part of the GitHub compatibility update.

Seamed to recover. I was just monitoring another system and saw it

Hi Dave.
Well done in setting it up. It mostly worked fine for me (I don’t think its a git hub thing)

Note the following:

  • I had not updated any of the original code.

  • I left all the original Device Handlers and Smart App still set up.

Set up the GitHub - worked perfectly.

From reviewing the comments and code it looked like you renamed everything, so I left everything in situ (that may be the issue).

I added successfully the

  • new Device Handlers for the Non Monitoring Plug and the Monitoring Plug.

  • new smart app

I started the smart app and followed the steps in the PDF in the documents folder. I entered my TP Kasa Username, Password. I choose Initial Install. It found my devices, I picked 1, clicked on Save and it says “An Unexpected error occurred”

Any suggestions?

Two possible reasons:

You did not download the non-emon device handler or the correct (new) device handler.
You did not delete the previous device handler (DNI is the MAC address. Must be unique and you can not install second device.

Thanks for checking the GitHub integration. I know uninstalling everything and reinstalling is hard - but to be GitHub compliant, I had to change some things.

Recommendation for legacy users: Do not upgrade. If it ain’t broke, do not fix it.

@Gutheinz Thanks for coming back to me. Oh I don;t mind the changes, change is good :-), I just wanted to make sure I was connecting to the right bits and bobs.

Before I uninstall the original versions as it may be related to the MAC address. what is the non emon device handler?

I have both the TP 100 & 110 plugs. These are the parts I installed.
davegut : (Hub) TP-Link EnergyMonitor Plug
davegut : (Hub) TP-Link Plug-Switch

Smart App
davegut : TP-Link Cloud Connect

Have I missed out on something?


You have the incorrect device handlers installed in SmartThings. There are two versions of the integration: Using the TP-Link Cloud versus connecting to a at-home hub. You are mixing and matching the two. You are also mixing old and new versions.

Cloud version Smart App (Service Manager):
‘(Cloud)TPLink Connect (unoffficial).groovy’

Cloud version Device Handlers:

Short Form Installation:
a. Install the Service Manager under My SmartApps in the IDE. Save and publish.
b. Install the non-Emon device handlers under My Device Handlers in the IDE. Save and publish.
c. Run the Service Manager and install the devices.
d. If you want the Energy Monitor functions:
1. install that device handler, save and publish.
2. Open the My Devices page and select your device.
3. On the next page, select EDIT at the bottom.
4. Under the Type*, select the pull-down and then select the proper Device Handler
5. Select Update.

Hope this helps.


Excellent explanation

When I connect into your GitHub Repo this is what I see for, the two screenshot below outline your available code. I have highlighted in yellow the 3 I installed.

As noted you have 2 methods of achieving the integration. I’m using the cloud integrated version. I may be wrong, but from your outline above, to me it looks like I have the right DH’s but incorrect Smart App. And the smart app (the unofficial) one, is not available/showing up as an option.

Or have i just got myself all tripped up :frowning: lol

Device Handlers

Smart Apps

The Smart App should be " samsung-wifi-speaker-sm-unofficial-v2.groovy". That is what is on my side of the Public. I do not know why it is otherwise for you. You may have to go to manual link and install.

@Gutheinz Eventually got sometime to run some tests.

I removed all my TP Devices from the TP-Link (unoffical) connect app. Re-attempted to install via the new Git Hub App. I did the intial setup and it got my token. It could find my devices. When I attempt to Save the chosen device it fails. I looked at the IDE logs and this is what showed up

Using the original App, I was able to re-add the Device no problems.

I think the error is that the installation for the HS110 (energy Monitor Plug) did not find the device handler. Look on your Device Handlers page. You shoudl have

davegut : (Cloud) TP-Link EnergyMonitor Plug SmartThingsPublic (master) Published

If not, install the device handler.

Hi Dave

You were spot on, I had the hub version NOT the cloud version of the Device Handlers installed.

Device Handlers

Smart App

Once I got the right ones up and running it worked perfectly. Well done on the GIT Hub integration.

1 Like

I am getting Dashlines and no data when updated the device handler to the Energy Monitoring