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

I came here just to say thanks and that you’ve done a great job with this! I was dreading having to setup an always on machine to control my plugs, until your code came to the rescue!

  • Github integration would be at the top of my wishlist
  • HS110 having automatically energy monitor would be pretty nice
  • Would you consider reducing the number of decimal places in the “Current Power” section (or removing them altogether)? Mine is now at 20.898280 W now. I just think it’d look cleaner.

let me just say thank you again!

Automatic energy monitoring for the 110 plug be great. Git hub integration will be a great feature by itself.

Again well done on the integration.

Thanks. Will put the decimal places under consideration.

Had time to work on it today. Then next version (Mid-Jan hopefully) will incorporate the easy fix.

If you want it now, you can edit the device handler. Open it. You will find near the top a section :that includes
capability "Switch"
capability "Switch Level"
capability "Sensor"
capability “Actuator”

Add a line: capability "Light"
Save and publish the DH. Remove the device from Alexa then re-discover. Magic. You should have a bulb icon along with color selection (for the 130, color temp or color selections).

Thanks for you patience.

Dave

Confirmed! Such a simple change. Thanks for taking a look, Dave!

1 Like

Just getting into all this and it looks like I found to the right place. I got the SmartThings hub, echo dot, 2 tp link mini plugs, and one standard for Christmas this year and have already got everything setup between both the SmartThings and Kasa to the Echo. Now just looking to get Kasa and SmartThings to communicate.

Dave, First I wanted to thank you in advance. It looks like you’ve spent hours diving down the scripting and programming rabbit hole to make everything available for users to run this. I’m trying to save some time digging through the pages upon pages of this blog for every piece I need. Do you have a detailed “How-To” or “Quick Start” guide posted on what needs to be done, installed, or signed up for to get everything at least up and running before the trial by error begins?

Thanks in advance,

Steve

NVM. Did some more digging. Found the site with the easy to follow PDF instructions. Great work. Worked like a charm.
Dave,

If you spent so much time on this would you recommend the TP-Link Wi-Fi hardware or is there better options that work under the ZigBee or Z-Wave options? Thoughts or preferences?

1 Like

Steve, Thanks for the kind words. I really enjoyed developing the system. It was my first project and the first time I have worked software since college (1968). Being 69 and retired, I could devote the time in the rabbit hole and actually enjoy the technical challenge.

As far as the recommendations with thoughts. TP-Link makes a good product. Their switches, plugs, and bulbs perform as well as any WiFi devices, and I will continue to use them and buy more if needed. There is the low risk that TP-LInk will lock-down the cloud (due to hacker attacks), but I have a work-around that I have already implemented. But that is not for everyone.

That being said, here are my thoughts. If I were starting today, my order of preference would be:

a. Zigbee or Z-Wave with official SmartThings integration.
b. WiFi with official SmartThings integration.
c. Zigbee or Z-Wave devices with community integrations.
d. WiFi with community integrations (i.e., from this site).

In the future, I think that WiFi will get more and more press because of the easy and hub-less integration with Amazon and Google and the low prices. However, integration with SmartThings may be lacking and having a solution that automatically controls everything based on events in your house will be limited.

Have a great holiday and great tunes in the future.

First off…BIG THANK YOU. Awesome work!

On black Friday, I got a ST hub, some multipurpose sensors, 3 Nest Protects, a ST Switch, a wemo switch, 3 echo dots and 3 TP Link HS105 Switches. Knowing what I know now, I would not set out to buy the TP Link switches at full price (only because they are not naturally integrated to the ST APP…otherwise nice little devices that work great with Alexa) but I got them for $5/each with the purchase of each Echo dot so heck yea I’d buy them again for that price and especially after getting this integration working.

First attempt at installing an unofficial integration…followed your directions and it worked like a charm. Now to put some mileage on it. I was very hesitant to try this but it was a breeze and makes the $5 purchase price for these fantastic.

I got lost a little in step 6. (Talking about all the error codes…I am assuming all is well for me since the devices all seem to be working through the Smartphone ST App.)

IN the live logging setion for ALL this is a portion of what I got.

8:57:26 AM: info HS105(US) Master Light 1: Power: on
8:57:23 AM: info HS105(US) Master Light 1: Power: off
8:57:15 AM: info HS105(US) Master Light 1: Power: on
8:57:06 AM: debug Parse returned {{ linkText }} has arrived
8:57:03 AM: trace getPhrases(), state.welcomeIssue = null
8:55:07 AM: info TP-Link Connect did not have any set errors.
8:53:01 AM: info HS105(US) Master Light 1: Power: off
8:52:59 AM: error org.springframework.security.access.AccessDeniedException: Access is denied
8:52:59 AM: info Refresh Scheduled for every 30 minutes
8:52:59 AM: info HS105(US) Family Room Light 3: Power: off
8:52:58 AM: info HS105(US) Family Room Light 2: Power: off
8:52:57 AM: error org.springframework.security.access.AccessDeniedException: Access is denied
8:52:57 AM: info Refresh Scheduled for every 30 minutes
8:52:57 AM: error org.springframework.security.access.AccessDeniedException: Access is denied
8:52:56 AM: info Refresh Scheduled for every 30 minutes
8:52:20 AM: info Device Master Light 1 added to devices array
8:52:20 AM: info Device Family Room Light 3 added to devices array
8:52:20 AM: info Device Family Room Light 2 added to devices array
8:52:20 AM: info TpLinkToken updated to fd8dd9a1-138c8f204dc4453088cb983

The other stuff seemed inconsequential as they were just info, trace and debug entries. (Is that a correct assumption?)

Only concern was the 3 error org.springframework.security.access.AccessDeniedException: Access is denied entries. Anything to be concerned about…absolutely no idea what these mean or refer to.

ON the live logging for the TP Link unofficial connect tab…no errors as seen below.

9:20:07 AM: info TP-Link Connect did not have any set errors.
9:15:07 AM: info TP-Link Connect did not have any set errors.
9:10:07 AM: info TP-Link Connect did not have any set errors.
9:05:07 AM: info TP-Link Connect did not have any set errors.
9:00:07 AM: info TP-Link Connect did not have any set errors.
8:55:07 AM: info TP-Link Connect did not have any set errors.
8:52:20 AM: info Device Master Light 1 added to devices array
8:52:20 AM: info Device Family Room Light 3 added to devices array
8:52:20 AM: info Device Family Room Light 2 added to devices array
8:52:20 AM: info TpLinkToken updated to fd8dd9a1-138c8f204dc4453088cb983

Does the energy monitor function apply to the HS105…assuming those devices don’t have that capability???

Now that I have a little experience, perhaps it is time to try to integrate the nest protects. :slight_smile:

Thanks again!!!

First. The HS105 does not provide energy monitoring functions.

Logging page. It looks like you had other (non-TP-Link) devices logging at the same time, so I can not be sure that the logs are due to the plugs. the three “error org…” logs are generated by the SmartThings infrastructure and indicate a problem; however, again, not sure. The following log entries are not for the plugs (not in the code):

8:57:06 AM: debug Parse returned {{ linkText }} has arrived
8:57:03 AM: trace getPhrases(), state.welcomeIssue = null

I really need to know if the errors are caused by the HS105 devices or the others logging above. I am checking now and will modify this message if I confirm either way.

Dave

Just tested changing the refresh on all my devices (12). no errors. Alexa is possible.
Dave

It looks like those error codes came from Alexa. I noticed after I added the wemo switch to ST App that within the Alexa app that switch showed up twice. Also seeing the TP Link switches showing up twice in Alexa also. Perhaps I need to remove all the dups from Alexa and see if those debug errors go away. Just playing a little bit…the log info on the HS105 switches is not showing anything but info entries so I’ll bet it’s something to do with Alexa having dup entries or something. Will play with later and see what happens.

Just getting the hang of the IDE page :slight_smile:

I am new to this so might have done something wrong, but I was trying to implement the cloud based solution and ran into the following error when trying to paste the service manager code in:

startup failed: script_app_metadata_87edcb27_1bba_497d_a2de_b4cf3ca20968: 35: unexpected token: name @ line 35, column 5. 34 name: “TP-Link (unofficial) Connect”, ^ 1 error

I would appreciate any help.

Most common error is not pasting the entire file into the window. To check,

the first line should be /* and nothing else.

the last line should be } and nothing else.

If not, you missed some characters. If these are the cases, sometimes (rarely) people accidentally non-ascii characters. Try copy and paste again.

I’m having the same issue. Tried copy/paste few times, made sure there’s only /* & } in first & last line as suggested. No luck. I did copy the “RAW” code from github…

Hi, i am getting bellow error message and not able to add my LB130,

error physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘TP-LinkLB130’ in namespace ‘beta’ not found.

service manager is able to find my device but when i try to save it i am getting erro saving page!!!

anyone any idea?!

Yes. Assuming this is during the installation, you likely did not follow the published instructions. You need to have the basic LB130 device handler copied and published. That files is:

“(Cloud)TPLinkLB130.groovy”

You probably copied: (Cloud)TPLinkLB130EM.groovy - which is incorrect.

I do not recommend copying the RAW file. Copy the text from the GitHub window

“Cloud-Based_TP-Link-to-SmartThings-Integration/Service Manager/(Cloud)TPLink Connect (unoffficial).groovy”

which you get to when selecting the file in GitHub.

I just tested the Service Manager text and I had no errors.

my bad, as gutheiz suggested, it was the wrong groovy… thanks for the fast reply :wink:

Great. Glad you corrected.

Anyone who has made a mistake today, please raise your hand. :raising_hand_man:

ok, no dice, did copy the text as you suggested, no luck! :(:confused: