TP-Link/Kasa Bulbs and Plugs Control (Old, Unofficial Integration)

I tested it. Works great so far. I have 2 HS-105, 2 HS-200, LB120 and LB130.

Thanks for the info. Do you like the Smart App interface? Also, did you look at the Energy Monitor function for the bulbs? Available, but a big yawn unless you want to brag to your brother.


Yes, I like it. The Energy Monitor Function works flawlessly. Even better than KASA app. KASA doesn’t have current power reading. The only function you don’t have is schedule. But I don’t intend to use it on Smartapp. It is good enough for me. Job nicely done.

[BETA] Cloud-Based TP-Link to SmartThings Integration.

The BETA version is now complete and released. Looking for comments and any errors encountered.

1 Like

Got it initially up and running this morning. Only had to futz with it a little bit. Haven’t yet upgraded to energy monitor features yet, but so far super pleased with it.

Glad you are happy. Anything in code or instructions to reduce futzing?

I initially had problems with it telling me my password was incorrect, even though I verified in the Kasa app that I was using the right username/password. Wound up locking out my Kasa account, so I just changed the password. My old one had an * in it, don’t know if that was tripping something up? Anyways I took the asterisk out when I reset the password so there’s no way now to confirm ;).

In this section

C. From your smart phone SmartThings application:

(Note: to be detected, the bulb must be set to ‘remote control’ in the device’s options in the Kasa App)

  1. Select “Automation” (at bottom), then the ‘SmartApps’ tab

  2. Select ‘+ Add a SmartApp’ at the bottom.

  3. Select ‘+ My Apps’ at the bottom

  4. Select the app ‘TP-Link (unofficial) Connect’

  5. Follow on-screen instructions.

Maybe I missed the onscreen instructions, but my assumption (based on other things I’d read) was that I needed to get the token first. Might need to spell this out for less advanced users? But, if you’re fooling around with things like this, I guess maybe you are an advanced user?

1 Like

Thanks. Updated instructions for clarity. Will also update on-screen instructions for more clarity.

Dave,
Followed your instructions
Installing HS-100 and HS-200. Got to last step (Follow on-screen instructions). Enter email and password for KASA, and the two devices are found and selected. But When I choose the “next” option, after a brief green banner that says “TP-Link is now installing and automating,” I get a red banner and notification that “an unexpected error occurred.” Reproduces on android and iphone devices, and I can’t get past it. What am I doing wrong?

It’s working fine for me. Thanks for your effort bringing this to the community.

Operator Error. I had the wrong device driver code for the HS200! Works great now!

glad it worked out.

Worked perfectly first time, great instructions. Thanks for your hard work @Gutheinz

following the instructions, everything is published, but i don’t get the option of “+ My Apps” in the Smartapps Section of the app. Last option I have is “More.” Thoughts?

The system may not think you have any smart apps installed for your ‘My Location’. That is the name at the top of the phone app.

To check this:
a. On the IDE, select ‘My Location’ tab.
b. Select your location.
c. Another screen appears. At the bottom of that screen is 'Installed SmartApps – List SmartApps’
d. Select ‘List SmartApps’.
e. At the bottom should be a list of 'Other".The Smart App should appear there.

If this is case, then the ‘+ My Apps’ should appear at the bottom of the phone app. If this is not the case, the likely error is you either did not select your location (step 3d in the installation instructions or 2) in the README.md file). Uninstall and reinstall is the only solution to this.

Note: If you forgot for Smart Apps, then the Device Handlers may have the same problem.

1 Like

hey Dave!

i totally see what you mean now, how the items in Other appear in the
Smartthings App as well. but i still can’t get the published app to show
under the “Installed SmartApps - List SmartApps” alongside my other items
like Google and Alexa.

after selection my “Home” location and adding the app, publishing, and
saving it, if i click on the SmartApps tab up top, it show Namespace/Name,
Status, Category, OAuth, and “Locations” which is blank. is that supposed
to say Home or what have you?

i can’t seem to edit it to say some.

either way, thanks immensely for your help to myself and the community
overall. I’m pretty computer-literate, save for actual coding!

Select the ‘My Location’, then your location. At the bottom of your location you will see ‘Installed SmartApps’. Select this line (on the left) and it will open a page with smart apps associated with the location At the bottom will be ‘Other’. This is where this Service Manager should list as a smart app. If not, delete the Smart App and start over. Something abnormal (and not associated with the Service Manager) is occurring. It may be in my instructions; however, I have personally tested the instructions several times.

I would suggest deleting the smart app and starting again. I know you probably followed the instructions, but when all else fails, we have to punt.

Also, look at this link:

Hi Dave, This is awesome you are doing this. Being able to integrate the plugs and bulbs into smartthings is something I have been waiting for for almost a year!

Unfortunately I am getting this error logged when I run the Initial Install:
5d8df261-fa9b-4f6b-ae52-b2d10285dccf 10:56:23 PM: error groovy.lang.MissingMethodException: No signature of method: script1502085382744452037278.sendEvent() is applicable for argument types: (java.util.LinkedHashMap, java.lang.String) values: [[name:TokenUpdate], tokenUpdate Successful.]
Possible solutions: sendEvent(java.util.Map), sendEvent(java.lang.String, java.util.Map), sendEvent(physicalgraph.app.DeviceWrapper, java.util.Map), sendEvent(java.lang.String, java.util.Map, java.util.Map), sendEvent(physicalgraph.app.DeviceWrapper, java.util.Map, java.util.Map), onEvent(java.lang.Object) @ line 225
5d8df261-fa9b-4f6b-ae52-b2d10285dccf 10:56:23 PM: info TpLinkToken updated to 04ffa927-bc37ef9d5b5b40c09d24741

Line 225 reads: log.info "TpLinkToken updated to ${state.TpLinkToken}"
The app just hangs up, and if I try to add a device, I get the "{error_code=-20651, msg=Token expired}

I have deleted and re-installed multiple times and ran through the troubleshooting but have yet to be able to resolve it.

Am I doing something wrong?

Again, thank you so much!

1 Like

Thanks to bdokka for finding this. Sorry for the inconvenience but thanks for the great information. Made fixing easy!

ERROR FOUND IN LATEST VERSION OF THE SERVICE MANAGER.

This error has been fixed and has been updated on GitHub. If you encountered an error during installation, please reload the Service Manager and try again. Error fixed and tested at 1100Z on 08-07 (6 AM Dallas Tx time).

Error will read something like:

‘5d8df261-fa9b-4f6b-ae52-b2d10285dccf 10:56:23 PM: error groovy.lang.MissingMethodException: No signature of method: script1502085382744452037278.sendEvent() is applicable for argument types: (java.util.LinkedHashMap, java.lang.String) values: [[name:TokenUpdate], tokenUpdate Successful.]
’

1 Like

ERROR FOUND IN LATEST VERSION OF THE SERVICE MANAGER for the CLOUD Version

This error was in the Service Manager code placed on GitHub about 4PM 08-06 (Dallas, TX time).

This error has been fixed and has been updated on GitHub. If you encountered an error during installation, please reload the Service Manager and try again. Error fixed and tested at 1100Z on 08-07 (6 AM Dallas Tx time).

Error will read something like:

‘5d8df261-fa9b-4f6b-ae52-b2d10285dccf 10:56:23 PM: error groovy.lang.MissingMethodException: No signature of method: script1502085382744452037278.sendEvent() is applicable for argument types: (java.util.LinkedHashMap, java.lang.String) values: [[name:TokenUpdate], tokenUpdate Successful.]
’