SmartThings Community

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



I get this exact same identical error but unlike you no amount of password resets in the app or on the webpage/tpcloud makes any difference. I have removed both smart app and device handler and reloaded them from scratch making sure everything is published and directions are followed 100%. No other lines in the logs as far as I can tell. Exact same errors. I know for a fact my many passwords were correct too.

(Dave Gutheinz) #22

The error is on the SmartThings side. You need to change your password for TP-Link using the TP-Link SmartThings App, not the Kasa App.

(The SmartApp has the ability to manually refresh the token. This is essentially resending the login which will obtain a new token. Usual use is if you change your password in the Kasa App, but occasionally, it does it for other reasons.)


(Dave Gutheinz) #23

If you hook to your electric vehicle plug, you get a lot more use. The Energy Monitor plug would ideally be done for devices that you either need to monitor or want to limit usage. Example: You may want to see how much the kids are watching TV. The plug can measure total usage and you could calculate out the standby mode usage, divide by estimate of operational usage per hours, and get hours for a period.

Other uses: One person used to measure dryer usage (refreshed every minute) and wrote a piston to notify him when it dropped below 1 W current usage - telling him when the dryer finished within two minutes.


I can’t find where to change my password anywhere withing smartthings. What am I missing? Is it within your tp link smartthings manager?

(Dave Gutheinz) #25

Yes it is. Look for Update Token.


Sorry, Ive been through and through and can’t find anything other than whether to choose installation type and after I do that and enter my username and password I get the error. I see no options for reset password or token or any other option to select.

(Dave Gutheinz) #27

I thought you had already installed. When you enter username and password, you should get a token (just tested - it still works). Some cautionary items:

Make sure you re-enter the entire password (sometime the interface shows a bunch of dots, these must be deleted).

Validate you can control the units via the Kasa Application.

Turn on live logging on the IDE. After the failure, select the application tab and copy the error log. Place in a message here.


All good, thanks for the help!

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:01:14 PM: error Error in getDeviceData: [error_code:-20651, msg:Token expired]

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:01:14 PM: error Error in getToken: [error_code:-20601, msg:Password incorrect]

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:01:13 PM: error Error in getDeviceData: [error_code:-20651, msg:Token expired]

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:01:13 PM: error Error in getToken: [error_code:-20601, msg:Password incorrect]

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:00:57 PM: trace settingRemove(userPassword)…

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:00:57 PM: trace settingRemove(userName)…

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:00:57 PM: trace settingRemove(userSelectedOptionTwo)…

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:00:57 PM: trace settingRemove(userSelectedOptionThree)…

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:00:57 PM: trace settingRemove(userSelectedDevicesToUpdate)…

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:00:57 PM: trace settingRemove(userSelectedDevicesAdd)…

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:00:57 PM: trace settingRemove(userSelectedDevicesRemove)…

a3d832d8-f87f-48de-bffd-984d7cc812d3 1:00:57 PM: trace settingUpdate(userSelectedReload, false, bool)…

1:00:56 PM: info Waiting on events…

1:00:56 PM: info For past logs for individual things go to the My Devices section, find the device and click on the Events link on the device information page.

1:00:56 PM: info This console provides live logging of your SmartThings.


Is there a way to have the LB230 lights scroll colors? I have them installed outside under porch roof and would lile to have them scroll a specific color every minute or so, for holiday purposes

Please advise

(Dave Gutheinz) #30

Are you up and running???

(Dave Gutheinz) #31

great question. The native bulb can not do this. Nor can my device handlers. However, a smart application sounds interesting. Sounds like a development exercise.

How many colors? I will use six in my design.

Colors? Using Alexa Integration, I will use explicit colors by name for the six. If you have a set, please inform me.

Color order: Semi-random if possible.

Transition: Transition time will be 20 seconds, 40 seconds on. (I can use runEvery - which will not stop if one cycle is missed during an error).


Great. Thank you Dave.
I was thinking of doing this for the holidays mainly, but I guess would be nice for other uses as well, but who knows.

I was thinking something along the lines of Green / Red. I have 4 LB230 bulbs outside and would be great to have them turn Red / Green / Red / Green and then fade out after about 20 seconds and turn Green / Red / Green / Red

I guess same would be nice for other holidays too, such as Holloween with Orange / Purple / Orange / Purple

Just a thought :slight_smile:

(Dave Gutheinz) #33

Can’t guarantee delivery date. Will try by Sunday - but work may interfere. First will be two color only (red and green). I will try to update.


No guarantee’s needed. Thank you for your consideration of even doing something like that :slight_smile:
Wish I knew how to do these types of things myself so I can assist the community on here as well.
Is it anything like webdesign? just curious lol

(Dave Gutheinz) #35

Can’t be too hard. I am 70yo retiree. Started 2 years ago with zero programming experience.

Language for this site is Apache Groovy (javascript derivative), so it is similar. However, Samsung has a desire to go elsewhere and to be better integrated with the Samsung Connect app.


No, I posted my log and still can’t get past logging in.


@Gutheinz I am having the same issue as @ntegradryvr. I changed my password as well because I thought it might be because of a special character. Still not working.

UPDATE: Removed the SmartApp and added it again and its working fine now.


I tried removing the smart app with no luck.

(Dave Gutheinz) #39

First, sorry for the problem. I just removed all of my devices and the app and reinstalled. Did not have any problems.

  1. The log you provided indicated that your login was getting to the TP-Link cloud portal and the portal was rejecting because of the password. This is not in my code, but instead is in your login. Do not know why and out of my control. Things to try:
    a. In the TP-Link SmartThings app, make sure you are using the Kasa Account login. (I have seen people use SmartThings login here - will not work).
    b. In the Kasa App, make sure at least one device is in remote control. If this is not the case, then make one remote and try again.
    c. Remove the smartapp and try again.

  2. Removing the smart app. You are in a state that was not designed into the Do not know your current state. Since you have never successfully worked, I suggest doing a ‘manual’ removal. As follows:

a. Log onto the IDE.
b. Go to MyLocation and select your location.
c. Go to MySmartAps. On the line with the TP-Link app, you will see two icons. Select the right icon.
d. On the next page, at the bottom, select Delete.

This should work if no devices have been installed.

(Stuart) #40

Probably a really stupid question… but I’ve just added this to the IDE, using the Kasa method, and it’s working a treat. But in the IDE, the Smart App and Device Handler both show in Green with no Github repository, to ensure it’s updated when any code changes are made by the owner.
I’ve tried adding the Repository, as per the Device Handler below, but it still shows Green, which I believe indicates the Handler doesn’t exist in a Github repository. See images below. Can anyone tell me what I’m doing wrong? Do I have the wrong gitbhub repository info for these???