[Release] New TP-Link/Kasa Plug, Switch, and Bulb Integration



I previously installed TP-Link Cloud Connect, when I see this, I would like to update to the new smart app. But I could not remove the Cloud Connect app. Every time it shows An Unexpected Error Occurred. I tried to uninstall the app from IDE, same problem “There was an error uninstalling your SmartApp.”. What should I do to uninstall the old TP-Link Cloud Connect?

Solved, turned out it needs to be removed from the new Smartthings app.

(Dave Gutheinz) #84

Turn on logging and see what the app gives in explicit messages while trying to remove. PS. If cloud connect is working, there is no specific advantage to upgrading. Upgrades here are focused on new users.

(Kris Ggr) #85

First want to thank you for your release. I’m having a small issue. I got the tplink smart plug 100. Everything is set up, I’m using the Kasa method. I’ve added the devices through the tplink smart manager
it just won’t show up on Thing list in my St classic iOS app. What should I do next? I tried adding a new device. Still can’t find. Thanks in advance

(Dave Gutheinz) #86

Go to the IDE My Devices page and see if the device is there with all your other devices.

SmartThings was having an issue with slowness and device installation. That may also be the case. Did you notice any Live Logging entries while installing that indicated a failure?

(Northern) #87

Awesome - glad it turned out to be helpful!

And thanks for acting so quickly on this!

(J) #88

I forgot my password and changed it, but now I can’t update it in the smartthings app.

ERROR: [error code - 20651] token expired

I refreshed state. When I try to update the password in ST I get read message up top that it cannot be saved.

I can’t do the uninstall from ST either to ultimately readd the app. (Haven’t done it through IDE yet)

Any other ideas?

(Dave Gutheinz) #89

Problem is usually due to your phone automatically filling the password with stored data. Very hard to solve. Trick i use is not to select done in the keyborad, just reselect the main page, scroll to bottom, and save.

To remove the app, you must first remove all app-related installed devices.

(Jon) #90

Quick question. I’m in the middle of trying to get this js script running with my new Raspberry Pi. Previously I’ve been using the cloud based version, but the instructions for node.js say that I need to install device by device. Therefore do I need to delete the SmartApp and old DH’s before going ahead with this?

I’m at the point where I have TP-LinkHub-v3.js running on the Pi, but just need a little help on the following steps. Thanks :slight_smile:

(Dave Gutheinz) #91

Best approach is for a new install (i.e., out with the old and in with the new). It will clear up any other problem inherit with switching. I know that this is suboptimal if you have a lot of devices or a lot of webcore activities; however, I have not had time to write the algorithm for SmartThings yet.

Note: On hubitat, I have been working on a version that does not require either a Kasa Account link or a Node Applet to install and operating. Sadly, UDP does not work well on SmartThings. I will try to port this code over in near future and see if I can get it to work. UNLIKELY).

(Steven) #92

Thanks for this doing this it has been awesome. But I have now come up with issue last few days. Been working for a few months now and then just after Xmas I noticed that one in my plugs the timer I have on it doesn’t work. So I’ve got into the app and I’ve noticed all my plugs I have in the house say on them ‘ comms error’ and when I click each individual one the all say ‘token expired’.
So before I go in and start messing around and really mess it up. Do you know what the issue that I have and do you know what I need to do to fix it.

(Dave Gutheinz) #93

The error indicates that you need to go into the app and relogin into the Kasa Account. Should only running the smart app and logging back in - unless you changed you password on the Kasa Cloud via the Kasa App.


(Steven) #94

Thanks for the quick reply dave. I did what you said logged in to the app on SmartThings and still nothing happened. Still same error. This is what it says when I go into the app:

Then when I try and choose update token and click next nothing happened. Just wrils round a bit then stops and stays on the same screen.

Im not sure why it’s doing this.

(Steven) #95

Actually scrap that Dave. It’s worked but the ones that it shows comms errors is the ones I’ve used for Xmas that I have taken down now. So they will say error as not plugged in. Sorry bit of a blonde moment there.
Anyhow is there away I can change it to something else instead of comms error or not.

(Dave Gutheinz) #96

No problem. Glad you found out. (for me, I would call it a Senior Moment or a Brain Fart. We can’t pick on blondes anymore - protected class.)


Dave, I am using this with five tp-link smart plugs, HS105. It is working great, I have one question. When i had my Kasa account linked directly to my google home, when i added another plug in the Kasa app, i just told google to “sync my devices”. Now when i add another plug to my Kasa app, will smartthings just find it? Or do i need to do something to make it happen?

(Dave Gutheinz) #98

You will have to add the device using the smartapp.


ok, thank you. I just looked and found that section. I thought id ask now to save me a headache later, now i know where to look.

(Jon) #100

Thanks! That works perfectly. One question then, what exactly is the benefit of me running it in this way (ie through the Pi with the js service?) Is it simply that the command is run locally? I guess I was expecting it to poll quicker than once a minute because it’s local. Is that something that I can amend? Basically if I ask Alexa to turn a plug off, I have to wait up to a minute for that to be reflected in ST. Thanks again :slight_smile:

(Dave Gutheinz) #101

I have several responses:
a. running faster using the pi. not necessarily. But difference is not noticeable (usually). SmartThings does not run non-zigbee/z-wave devices locally. For the TP–Link devices, Paths:
Cloud: Phone -> ST Cloud -> Kasa Cloud -> device -> Kasa Cloud -> ST Cloud -> Phone
Node App: Phone -> ST Cloud -> ST Hub -> Node.js -> device -> Node.js -> ST Hub -> ST Cloud -> Phone

b. polling interval can be set in the preferences down to once per minute. That is the lowest periodic command available. There is another way by chaining ‘runIn’ commands but it is NOT recommended. If it ever fails, the command will fail and not run further. Another item is that each poll is a load on the ST Cloud with all the current users. Some more at bottom.

c. Advantage of the pi integration: With the pi integration, you can be off the TP-LInk cloud by switching the devices to remote control (local control) in the Kasa App. Some like that since TP-Link is a Chinese company with associated security perceptions (not saying there are any issues, just a perception).

TP-Link Integration Control and Status design

  1. If a command is sent from the phone (i.e., on, off, or bulb states), the design will
    a. Send the command
    b. On receipt of a response, send a Refresh Command
    c. Update the state based on the Refresh Command.

  2. If someone controls the device via the Kasa App, the device will
    a. NOT immediately know what has occurred.
    b. Catch the change on the next refresh cycle (default time is every 10 minutes. The user can modify to 1, 5, 10, or 15 minutes in preferences

  3. Amazon integration. If you have implemented SmartThings to Amazon integration, the update of the status is almost immediate. Essentially, it is the equivalent of the user controlling the device via their phone. EXCEPTION: If you have the Kasa Skill enabled in Amazon as well as the Amazon integration, some confusion can be caused and the Kasa Skill used to change the device state. Recommend that you disable the Kasa Skill if there all of your Kasa devices are controlled via SmartThings and you have the ST to Amazon interface implemented.

  4. External Refresh. The refresh command is externally available to any SmartApp that has linked to the device. You could author a smartApp or other method to link to the device and then poll as frequently as you desire. Might be useful for the HS-100 for the external “getPower” command to look for a rise or drop in power level to cue notifications or other events.

Finally, the major cause of slow-down in the interface is (in my experieice) the final SmartThings to phone communications. I believe that ST cloud prioritizes device commands over status updates to the phones. Makes sense and explains what I occasionally see on the interface. (Note: I am transition off of SmartThings to Hubitat; however, I will still provide support here.)

(Matthew Davis) #102

I’m not finding ‘TP-Link SmartThings Manager’ in my SmartApps page on the ST classic app. Any ideas?