SmartThings Community

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

DEPRECIATED. SmartThings now supports this integration directly:

TP-Link / Kasa Smart Home Device SmartThings Integration

Do not install new instances of this integration. If you are currently using this integration, I strongly recommend that you transition to the official integration using the new SmartThings app. Process:

  • Start the new app and add the devices.
  • You will now be able to access the devices in either new or classic app.

2.22.19 Update. My last official integration - now available but DEPRECIATED.
Devices and instructions are on GitHub site below:

https://github.com/DaveGut/TP-Link-SmartThings

Installation and Upgrade instructions are in the Documentation Folder. The Readme is below.

https://github.com/DaveGut/TP-Link-SmartThings/blob/master/README.md

11 Likes

Hi Dave,

Thank you for your work on the TP-Link products. I’m using the new repository, “DaveGut/TP-Link-SmartThings”. I installed the device handler and the SmartApp in my IDE. I also made sure my location was correct. When I add try to add the SmartApp in the SmartThings Classic app I get this error, “ERROR: [error_code:-20651, msg=Token expired]! Correct before continuing”. Here are the events from the IDE log:

8:29:07 AM: error Error in getDeviceData: [error_code:-20651, msg:Token expired]

8:29:07 AM: error Error in getToken: [error_code:-20615, msg:Password format error]

I’ve changed my password a couple of times in the Kasa app, but that did not help.

Thanks,
Charles

Message is that the Kasa password you have entered is not valid. Do not need to reset the Kasa App password. You need to update your account info in the Smart App (check both username and password). That is where the problem is.

I will check quickly to determine if I am having problems and post here if I find anything else.

Hi Dave, I just started using the new release and I am encountering the following error. I am using the Kasa Account integration with the energy monitoring plug.

groovy.lang.MissingMethodException: No signature of method: 
physicalgraph.device.DeviceTypeExecutorBase$_closure5.doCall() is applicable for argument types: 
(java.lang.String, groovy.lang.GroovyRuntimeException) values: [Sending Command Exception:, 
groovy.lang.GroovyRuntimeException: Cannot read write-only property: installType]

Was the log from the App or the Plug?
Dave

Found error. The Device Handler has been updated on GitHub

Dave

I reset my pass on TP-Link Cloud and it’s working for me now. Thanks!

Dave,

First let me say I am new to SmartThings (just bought the hub today). I followed all the instructions using the Classic app. I am using the Kasa Cloud installation type. I see Select Devices to Add (4 found). The I select the checkbox for all 4 devices and click done. It now lists all 4 devices in the TP-Link manager screen Once I click save in the upper right hand corner, I do not get a message and it returns to my Automation screen. Going back into the Smart App I go to the Device Uninstaller page and no devices are listed. Additionally, I am not seeing any of my devices on the My Home page. Any ideas what I might be doing wrong?

Jeremy

No. I just tried a clean install (successful). Some things to check. Log Into the IDE, go to MyLocations and select your hub.
Then:
Go to My Device Handlers and verify the device handlers are installed and PUBLISHED.
Got to My Smart Apps and verify the Smart App is installed and Published.
Turn on Live Logging.
Go to the classic phone app. Delete the current Smart app and try again. Not the logs in Live logging (you can paste here if you see errors).

Dave

1 Like

I received the green confirmation this time, but still do not see any devices. Noticed in the log (below) the message Device type ‘TP-Link Smart Plug’ in namespace ‘davegut’ not found. Do I need to remove the namespace?

Version:1.0 StartHTML:000000218 EndHTML:000023953 StartFragment:000005018 EndFragment:000023897 StartSelection:000005134 EndSelection:000023891 SourceURL:https://graph-na04-useast2.api.smartthings.com/ide/logs

c0eddad7-634f-44ce-b4e4-737c63c15866 8:04:09 PM: info Device My Fan added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:04:09 PM: info Device Christmas Tree added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:04:09 PM: info Device Fan added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:04:09 PM: info Device LR Lamp 1 added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:04:08 PM: info TpLinkToken updated to 1ae86197-A73bfCKqPGafuYhvLUhE5jm

c0eddad7-634f-44ce-b4e4-737c63c15866 8:04:04 PM: trace settingRemove(userSelectedOptionTwo)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:04:04 PM: trace settingRemove(userSelectedOptionThree)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:04:04 PM: trace settingRemove(userSelectedDevicesToUpdate)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:04:04 PM: trace settingRemove(userSelectedDevicesAdd)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:04:04 PM: trace settingRemove(userSelectedDevicesRemove)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:04:04 PM: trace settingUpdate(userSelectedReload, false, bool)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:53 PM: debug Error Adding null: physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘TP-Link Smart Plug’ in namespace ‘davegut’ not found.

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:53 PM: debug Error Adding null: physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘TP-Link Smart Plug’ in namespace ‘davegut’ not found.

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:53 PM: debug Error Adding null: physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘TP-Link Smart Plug’ in namespace ‘davegut’ not found.

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:53 PM: debug Error Adding null: physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘TP-Link Smart Plug’ in namespace ‘davegut’ not found.

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:53 PM: debug Error Adding null: physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘TP-Link Smart Plug’ in namespace ‘davegut’ not found.

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:53 PM: debug Error Adding null: physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘TP-Link Smart Plug’ in namespace ‘davegut’ not found.

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:53 PM: debug Error Adding null: physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘TP-Link Smart Plug’ in namespace ‘davegut’ not found.

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:53 PM: debug Error Adding null: physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘TP-Link Smart Plug’ in namespace ‘davegut’ not found.

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:51 PM: info Device My Fan added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:51 PM: info Device Christmas Tree added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:51 PM: info Device Fan added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:51 PM: info Device LR Lamp 1 added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:51 PM: info TpLinkToken updated to 1ae86197-A6teUdHtSF684aHfNydFchc

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:45 PM: info Device My Fan added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:45 PM: info Device Christmas Tree added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:45 PM: info Device Fan added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:45 PM: info Device LR Lamp 1 added to devices array

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:44 PM: info TpLinkToken updated to 1ae86197-A4rzEhXk8C5K8HZs29FdJXt

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:15 PM: trace settingRemove(userPassword)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:15 PM: trace settingRemove(userName)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:15 PM: trace settingRemove(userSelectedOptionTwo)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:15 PM: trace settingRemove(userSelectedOptionThree)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:15 PM: trace settingRemove(userSelectedDevicesToUpdate)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:15 PM: trace settingRemove(userSelectedDevicesAdd)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:15 PM: trace settingRemove(userSelectedDevicesRemove)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:15 PM: trace settingUpdate(userSelectedReload, false, bool)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:07 PM: trace settingRemove(userPassword)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:07 PM: trace settingRemove(userName)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:07 PM: trace settingRemove(userSelectedOptionTwo)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:07 PM: trace settingRemove(userSelectedOptionThree)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:07 PM: trace settingRemove(userSelectedDevicesToUpdate)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:07 PM: trace settingRemove(userSelectedDevicesAdd)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:07 PM: trace settingRemove(userSelectedDevicesRemove)…

c0eddad7-634f-44ce-b4e4-737c63c15866 8:03:07 PM: trace settingUpdate(userSelectedReload, false, bool)…

37239189-cc68-456b-b504-fcb14eb0940d 8:03:07 PM: trace getPhrases(), state.welcomeIssue = null

Thanks for your help!

It isn’t seeing the device handler. In your My Device Handlers tab, you should see the below Device Handler under the first column. In the third column, it should say Published.

davegut : TP-Link Smart Plug

Normal rookie errors:

  1. Assure you select My Locations and actually select a location (it goes to another page) before installing anything.
  2. Assure the Device Handler is published without errors and the correct one is loaded.

After installing go to the My Device Handler page and assure the right one is in the page.

Dave,

Just to close this out, I had used the Switch Device Handler instead of the Plug device handler. Once deleted and re-added the correct device handler, The devices installed. I then had an issue because one of the devices was not online. I uninstalled the device that was not online and now my devices appear in Things.

Thank you for this integration and for your help!

Jeremy

1 Like

Just to confirm.
The first integration option 1 no need for a middle integration. It is cloud to cloud based correct?

1 Like

Kasa Account uses the cloud-to-cloud interface.

1 Like

Awesome integration and putting the cloud and node together. Switched over to this and using the smart switch and the energy monitor smart plugs.
Smart switch works great (using cloud at the moment)

Smart energy plug ran into the same problem as the guy before but your update 2 days ago fixed that bug. However I am still seeing a few errors in the logs on getting updates. Has anyone else seen this (I used both cloud and node versions but similar error):

cloud one says this in log:
error groovy.lang.MissingMethodException: No signature of method: physicalgraph.device.DeviceTypeExecutorBase$_closure5.doCall() is applicable for argument types: (java.lang.String, java.lang.NullPointerException) values: [Sending Command Exception:, java.lang.NullPointerException: Cannot get property ‘get_daystat’ on null object]
Possible solutions: doCall(), doCall(java.lang.Object), call(), call([Ljava.lang.Object;), call(java.lang.Object), findAll() @line 414 (sendCmdtoServer)

node one says this in log:
11:33:52 AM: error java.lang.NullPointerException: Cannot get property ‘get_daystat’ on null object @line 247 (useTodayResponse)
11:33:45 AM: error java.lang.NullPointerException: Cannot get property ‘get_realtime’ on null object @line 221 (energyMeterResponse)

The on and off work for these through ST however it does not display the energy usage, etc like it did before (old DTHs). Known bug or just me? Haven’t dug into the code yet for debug.

Give me a day or two to look. Seems simple enough; however, …

I lied. Try the new Device Handler at the GitHub site. Please provide positive or negative feedback (I do not have a EM plug).

That fixed it. All items now show for both cloud and node versions. :slight_smile: Thank you very much

1 Like

Are there any screenshots of what this looks like in ST? I have two TP-Link Energy monitoring plugs otw, was wondering what the energy monitoring looks like in ST.

This was just installed a couple days ago thus the usage is essentially zero).