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


(Dave Gutheinz) #41

Currently do not have it set up for the new ones. I will have to figure that out in the weeks to come.

(Stuart) #42

thanks for clearing that up, thought I was being stupid… :smile:

Great to have the TP-Link working through ST too, so thanks for your work on getting this integrated! Mucho gracias Amigo.

(Dave Gutheinz) #44

OK. Did some extensive testing. Very occasionally, my phone would automatically turn-on caps lock while entering the password. Only way to correct was to unmask the password so that I could see what was actually entered.

Fix. I changed the app to not mask the password. this will display the password when entering. Uses a special file (not for everyone):

TP-Link SmartThings Manager - TxtPWD.groovy

Try that and see if it corrects the problem.

(Srinivas) #45

I am having the issue while adding he devices. I have installed the handler and the smart apps in IDE. Downloaded Smarthings Classic for Android, went to myapps, i can see the TP-Link app there. I tried to login using the TP-Link account but i get an error saying something went wrong.

This is what i see on hte live logging
java.lang.NullPointerException: Cannot get property ‘id’ on null object @line 660 (getToken)

Any help is appreciated

(Mike) #46

Thanks for the app Dave, installed and working fine with 2 HS100 wifi plugs and cloud cloud integration

Dave is there anyway to pull in more info from the Kasa cloud? Although my plugs dont show power consumption, in the Kasa app the plugs do have run time info which is broken down over day week month and so on, plus there is the device’s tech info such as fw vers, signal strength, mac address

Is there anyway to drag the info into the devices St smart app page ?

(Guy Paddock) #47

I’m getting this error, no matter how many times I try to log-in, and no matter how many times I change my password through TP-Link:

6:13:29 PM: error Error in getToken: [error_code:-20615, msg:Password format error]
6:13:30 PM: error Error in getDeviceData: [error_code:-20651, msg:Token expired]

(Guy Paddock) #48

As an update, the older version worked for me: https://github.com/DaveGut/Depreciated---SmartThings_Cloud-Based_TP-Link-Plugs-Switches-Bulbs

(Dave Gutheinz) #49

Login uses the Kasa Account credentials.


(Dave Gutheinz) #50

SW version is relatively easy. Will consider for future as add to the smart app. The MAC is the same as the Device Network ID for all but the HS107 and HS300 (which add device number (two digits) to end). The other data is not accessible by any command that I am aware of.

(Mike) #51

Thanks Dave, anything that can be added is appreciated

(Dave Gutheinz) #52

Sounds very frustrating. I have just completed a set of updates on Hubitat. Will work those over here to try to correct problems. I still do not understand the username and password issues (I have reloaded the whole thing 10 time w/o error. I will change the interface to NOT hide the password. I think there is something in that area and if we can see the password, may not be a problem.

Note: I will also compare the code to the old app and make sure that nothing has changed in the password entry fields.


(Dave Gutheinz) #54

Smart App Update:

The smart apps have been updated (and tested) for the following issues:
a. Finalized the HS107 and HS300 (multi-plug) integration.
b. Revealed the password to assist users having problems entering their passwords.
c. Set the icon default to minimize icons. User can set preferences to enable enhanced icons (and increase chances of errors due to network problems).

Update process: Replace text of current app with the new text.

Recommendation:: Recommend the lite version of the Smart App. It uses less external links and therefore will have less of an error chance while operating.

(Dave Gutheinz) #55

Updated smart app. If you still want to try, the new one reveals the password.

Note: The fields for password and username are identical in both the old application and the new. As is the getToken method. I still can not figure why - but revealing the password may help.

(Brian) #56

Hi Dave,

Thanks for all the work you’ve put into this device handler! I’ve been using your older version (2017 - TP-Link (Unoffical) Connect) one for over a year and it has worked great. But recently I’ve had a problem getting my TP-link light switches to turn on using my Arlo Pro2 cameras as motion sensors (the switches work fine by themselves, and the cameras turn on fine with motion). The lights used to turn on great with motion.

So, I thought maybe I would try and install this newer version so I could switch over to the new SmartThings app. I got all the way up to installing the devices (8 tp-link switches) and when I try to save I get “an unexpected error”. Then I thought the I should try and remove the old device handler and I get an error that says “DeviceType still in use by devices”. Not sure what’s going on here. Any help would be appreciated!


(Dave Gutheinz) #57

If you have not uninstalled the old version - follow the below instruction:

a. Open your device handlers for editing. Get copies of the new device handlers from GitHub. Copy content and paste into the SmartThings. Save and Publish.
b. Open the Smart App for editing. Do same thing.
In each device, open and select options and save (this will change some parameters).

(You can not have both happen simultaneously)

If you have deleted the old devices and smart app, do a from scratch installation. Note the the device handlers have a different name, so that is where the first error you mentiond likely came from.

To remove a device handler, you must first delete any devices using that device handler.

To remove a smart app (in the android), you must select “remove” (in the old smart app). This will remove all devices.


(Brian) #58

Thanks! I’ll have to give your suggestions a try later on today. I’ll post an update. Well, it probably won’t be until at least tomorrow.

(Mark) #59


Just got my first Raspberry Pi and I would like to setup the hub based integration. Does anyone have a guide how to set this up on a Pi?

Any help appreciated.



Thanks for making my Kasa stuff more useful. I had issues with the bulbs, would not install correctly. Using cloud versions v2 of app. Removed and readded the device handler to the new v. 3. I then discovered that using the new (lite) version with the CFL icon works with my tunable bulbs. I tried using all the device handlers you have and none worked with the original v2 app. I tried on iPad with both installs of ST. Nothing worked. However it did work on iPhone using Classic.

Am I going to run into adding device issues using two smart apps? I’m thinking no, because these two bulbs (LB120) are the only bulbs I’m buying. I do have 4 dimmers to add (not installed) and a couple more switches. I replaced every table lamp smart outlet with a smart bulb and I’m planning to move them to my garage ceiling lights having just swapped out 10 fluorescents and x10 stuff. Seems to me as long as I avoid bulbs I should be okay. Think it’s okay to use this bulb handler since it works?

Also, and anyone who wants to answer this I’m open to suggestions. I copied by selecting the RAW code to paste and found I’d inadvertently omitted the EOF ‘}’. Copying on iPad Pro very much annoying since there’s no select all. It’s select, then drag blue dot to end, then copy. I don’t have access to a computer. Is there an easier way to copy the code other than this way?

(Dave Gutheinz) #61
  1. Recommend STRONGLY only using the new SmartApp from this link. Either the normal or lite versions work.

  2. The Device Handlers must also be from this same repository. They are named differently than legacy, therefore, the issue installing using old application.

  3. Should only have one smart app installed. Otherwise, you may have troubles installing a device if it is installed in the other application.

  4. I have added another line to all of my new device handlers and smart apps. The line is “//end-of-file”. If you get that line copied, you have everything. No more searching for the “}”.



Hi Dave, I have followed your guide and everything seems to be working fine. However, I noticed that if I make a command via Google assistant to turn off a plug or light. SmartThings would not register it being off (in both classic and connect apps), they will still be “on” status. Is this normal behaviour? Just wondering if there is a polling time from your SmartApp to the TP-Link servers?