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

Works perfectly now, Thanks Dave!!!
This is a game changer!

1 Like

geez, i can only friggin wonder what all my issues are. resetting the hub and waiting a day, everything finally shows up under My Apps. Now, i get the token, select my bulb, and get an Error Saving Page upon clicking Done.

one click from completion!

Still having problems. I am dismayed that this is occurring. Remember, it is probably NOT you!

First, what bulb do you have? Your latest error is probably due to the Device Handler either not being loaded, not being loaded at all or (hopefully not) an error in the Smart App code. Below are two steps.

A. Check for proper device handler installation:

1.  Log onto the IDE.
2.  Go to "My Locations" and select your hub/location.
3.  Go to "My Device Handlers".  You should see one of the following three
    a)  LB100 or LB110 - "beta : TP-LinkLB100-110"
    b)  LB120 - "beta : TP-LinkLB120"
    c)  LB130 - "beta : TP-LinkLB130"

If you do not have the exact match to your bulb Published, then you will get the error you are encountering. Fix and try again.

Otherwise, we may have a Service Manager error. I need to know this. I have personally tested all but the LB100 and LB110 (do not own).
a. Open the service manager and scroll down to the section starting with 'def addDevices(). The first part should look exactly like the below:

def addDevices() {
	def tpLinkModel = [:]
	tpLinkModel << ["HS100" : "TP-LinkHS-Series"]
	tpLinkModel << ["HS105" : "TP-LinkHS-Series"]
	tpLinkModel << ["HS110" : "TP-LinkHS-Series"]
	tpLinkModel << ["HS200" : "TP-LinkHS-Series"]
	tpLinkModel << ["LB100" : "TP-LinkLB100-110"]
	tpLinkModel << ["LB110" : "TP-LinkLB110-110"]
	tpLinkModel << ["LB120" : "TP-LinkLB120"]
	tpLinkModel << ["LB130" : "TP-LinkLB130"]

It should match exactly! (I go this from the 7/30 version of the Service Manager). If it is different, correct, save and publish, and try again. TELL ME!!!

PS- It would be helpful if you did 'Live Logging" while installing and copy the logs for ā€œTP-Link (unofficial) Connectā€ - especially the errors!

If you have to, you can replace the Service Manager with the current version (has enhanced logging). Just copy and paste into existing IDE file, save, then publish. You DO NOT have to re-run Initial Install as long as a Token appears on the cloudLogin Page. [PLEASE OPEN UP ā€˜LIVE LOGGINGā€™ AND IF AN ERROR OCCURS, PROVIDE THIS DATA along with the Device Type you are installing.]

Dave

Wow. This is awesome. Thanks @Gutheinz for all your work.

Iā€™m assuming that if I were to change the addDevices() section quoted above, I could set any new HS110s to use the energy meter DTH by default?

(Iā€™m learning more about coding for Smartthings from following the development of this app than the documentation!)

J

James,

I assume you installed a HS110. True? Are the Energy Meter functions working correctly (I know they are for the bulbs, but plug calcs were different in the old version).

Yes, that is the case. I had to decide if Energy Meter was an option or a baseline. Decided as option then you could post-assign to only plugs you were interested in. Also, the Energy Meter functions triple the processing requirements on SmartThings for the device.

Yep. I have the HS110 DTH installed. Iā€™m getting data that could well be accurate, although there seem to be some discrepancies between what Kasa is showing and SmartThings is showing.

Iā€™ll keep an eye on it for a week and let you know.

1 Like

live logging didnā€™t work on Sunday when i had it up and was waiting for it!

all the lines of code match up as they should, and i do have a LB110

ā€œphysicalgraph.app.exception.UnknownDeviceTypeException: Device type
ā€™TP-LinkLB110-110ā€™ in namespace ā€˜betaā€™ not found. @ line 192ā€

1 Like

I told you it wasnā€™t you. I did not catch this even on trying to edit.
In the Service Manager section mentioned earlier, change the line:

> tpLinkModel << ["LB110" : "TP-LinkLB110-110"]

to

> tpLinkModel << ["LB110" : "TP-LinkLB100-110"]

I had placed 110 in the code twice instead of 100-110.

You can either manually modify, Save, then Publish or upload the updated Service Manager. I recommend the FIRST step. Faster.

ERROR CORRECTED.

If you try to install an LB110 (and LB110 only) and get an ā€œError Saving Pageā€ notice in the phone app, you are not crazy. The Service Manager (smart app) had an error. This was corrected in the library effective 08-09 1330PM CDT, US.

Thanks to Bravo261 for catching this error and patiently working with me to resolve cause.

Dave

awesome work. It works really great and better than having to keep a java applet open.

One issue with the PDF installation instructions on 3h, you point to the wrong groovy file. I kept getting errors but used the groovy file from the service manual instead

Thanks. Will fix PDF installation instructions.

What device(s) did you install?

just a couple of plugs. Glad I came across this thread because I was going to sell them off

08-17. Updated the LB110 Energy Monitor device handler to correct an order-of-display error in the SmartThings phone app.

NEED FEEDBACK.

Is anyone still interested in the Hub-Based integration. I need to know in order to determine if I want to spend any time on it or concentrate on the cloud only.

NEED FEEDBACK ON BETA CLOUD-BASED.

Anyone having problems or improvement suggestions on the Cloud-based integration?

I switched to the cloud version a while ago. I havenā€™t had any trouble with it. Itā€™s working great and itā€™s nice to not have yet another node instance running on my Plex box.
The only thing Iā€™d like to see is a configurable refresh time. Right now I think it is 15 minutes. Im not sure if it is a limitation of tp-link, but Iā€™ve been using webcore to refresh a hs200 that people tend to hit the physical switch every 5 minutes and it seems to be working well.

You can change the refresh frequency yourself and now. Follow these steps:

a. Open the Device Handler on the IDE.

b. Scroll down to a section as below:

def setSchedGetStates() {
	unschedule()
	runEvery15Minutes(refresh)
	runIn(2, refresh)
}

c. Change the ā€œrunEvery15Minutes(refresh)ā€ to "runEvery5Minutes(refresh).

d. Select ā€œSAVEā€, then ā€œPublishā€

e. In the application, open each device you need 5 minute refresh on.

f. Go to the settings tab (the cog-wheel in the top-right)

g. Select ā€œDoneā€ (this will cause the device to be updated which restarts the refresh schedule).

I will strongly consider a preference in the app for refresh. Not hard to implement, just never thought of it.

Thanks Dave. I hadnā€™t bothered to look through the code and see if it was in there or not.

Cloud-based is working great. I actually started with a cloud-based node script, then switched to your server, so no bother going back to the cloud.

Iā€™m using it with an HS100 and an HS110. Still not sure if all the reported values on the HS110 are right. Will have another look.

Seconded here that a configurable refresh might be nice. Is there any concern about hitting the server too often?

1 Like

Thanks for the reply. I do have some concern on hitting server; however, The 5-minute should be ok; just will be an extra step in getting each device working. If I can add so that it can be changed, but is not required, then I will add.