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

Hi Dave, I’m also testing your “Samsun WiFi Soundbar” DH, so thanks again for creating all of this :+1:

Note - The example above showing the use of the attributeState to show a temporary state (or color) in the Tiles is a regular use case for several DHs including from SmartThings. This helps the user to know that the Tile was pressed and is waiting for the next state to be confirmed. :persevere:

Thanks.

On the Samsung WiFi Soundbar, I updated yesterday to change the source selection to preferences. Just too many options that vary by soundbar type. I am also working on making it smart enough to recognize pre-configured groups and then set volume/mute across all. Then I want to make presets work by playing in multiroom app the pressing an open preset in the DH to create the preset.

Cleaned up code today to improve performance and get rid of some crazy things that got inserted during development. It works a lot better now! Hope to release tomorrow after some more shakedown.

Try to figure out how to subscribe to methods returned from the speaker without any command sent (i.e., during transitions). Interface is not UPNP, so somewhat complex - but if I figure it out it will simplify the implementation.

Thank you for your work, I have followed installation instructions from your github page and I get to the point where I can select products to add (I have an HS100, HS105, and several HS200s) however after I select them and press done, when I press save on the next page, I get an unexpected error has occurred with this in the log:

4:09:22 PM: error physicalgraph.app.exception.UnknownDeviceTypeException: Device type ‘TP-LinkHS-Series’ in namespace ‘beta’ not found. @ line 193

This is confusing because that type is there and for all the types of switches I’m trying to add.

Sorry you are having difficulties.

Go to the IDE, Select your location, and select Device Handlers. You should see a list of your handlers and included should be:

Namespace/Name                  Status             Capabilities
beta : TP-LinkHS-Series 	Published 	   Actuator, Polling, Refresh, Sensor, Switch

If this does not appear, then you may have

  1. Installed the incorrect devicehandler (I checked GitHub today, and it is correct)
  2. Not selected your location before installing the device handler.

Another possibility is that the North American and European “device control” is listed as degraded.

Please try again. If it fails, I need to know. (PS, I just deinstalled and installed a HS-105 and it worked fine. I wanted to make sure nothing in the infrastructure has changed.)

Thank you. That lead me down the right path. At first I noticed that the namespaces for the device handler and smart app didn’t match. So I thought it was an error with the code I copied. I then tried modifying both to be either djg or beta. This lead to the exact same behavior. I then manually went back to github and went to the device handler and smart apps code and copied once again. Now it works! Thank you very much for getting me to notice that. So at some point I ended up getting the wrong code copied in there.

Fantastic. This was the last type of lights I needed to add to my smartthings app. I have zigbee, hue, and wemo lights that were already set up.

1 Like

Thank you for the great work on this. I have recently purchased two TP-Link HS-105 plugs. Follow all the steps from your instruction but the Device Service keep on giving me this error. “Error_code:-20002, msg:Request Time out”. From time to time, my HS-105 plugs will stuck in Waiting stat and end up with Communication time out. I have set both plugs with static IPs from my router. Any idea why these happened?

Thanks.

Sorry you are having problems. The error message is generated by the TP-Link site. So that is a starting point. The HS-105 has been having some problems staying connected to WiFi (even if a static IP is assigned). I have two US versions and have had no problems; however, there is different firmware for EU, UK and AUS.

Troubleshooting steps:

  1. Verify it is a TP-LInk problem. When you encounter the error, turn the WiFi off on your Cell Phone and try to control the device through the Kasa app. If so, try the SmartThings again immediately.

  2. If the above fails, try unplugging and replugging one HS-105. Try SmartThings then the above again in 5 minutes or so.

  3. Next, try rebooting your router (unplug the replug). Try again.

During a period of connection, sometime, UPDATE the firmware through the Kasa App.

Some more details on user experience with the HS-105 can be found at:

http://forum.tp-link.com/showthread.php?96845-HS105-Keep-Falling-off-from-network

I will also investigate my TP-Link router docs for settings affecting UDP network performance.

(Note, if the router reset fixes the problem, it is a likely a resource problem in the router. I saw similar errors early-on on HS-100 and LB-130 development when I was doing a lot of UDP communications with devices. Have seen very occasionally in day-to-day ops (less than zigbee device problems). But I reboot router and smartthings almost weekly (I am currently playing with controlling Samsung WiFi Speakers).)

A copy from the link that looks promising:

I may have solved the issue of them falling off and becoming unusable. I will give it a few days before I declare victory. Here is what I did.

  1. I wrote down the MAC addresses of each of the smart plugs.
  2. I created IP address assignments for them out of my DHCP Pool and mapped them to the MAC addresses.
  3. I reset each one with the 10 second button press method.
  4. I restarted my router.
  5. I used the KASA app to add them back to my router.
  6. I turned on the remote switch for each and assigned each an appropriate ico

Hi,
I am trying to configure my HS-105 to my SmartThings app. I have followed the instruction, everything seems fine on the SmartThings cloud part.

My smartApp is published. My DeviceHandler is published.
On the SmartThings app, when I select the app ‘TP-Link (unofficial) Connect’, enter my email and password to connect to my tp-link account, and select Initial Install and click Next, I get “java.lang.NullPointerException: Cannot get property ‘id’ on null object” on the Live Logging. If I click on save on the app, I get “error - bad state. Unable to complete page configuration”.

My devices are installed through the Kasa Application and work fine.

Can you help me? Did I forget something?

I don’t have a SmartThings hub, can it be the problem?
I thought it worked without a Hub since it’s a cloud solution?
def hub = location.hubs[0]
def hubId = hub.id

It will only work with a Smart things Hub. Use the Kasa app otherwise.

I have tried hardcoding the place in the code where it’s looking for the hubs[0].id to 0.
Now it’s listing my hs105 devices, I select both my plug but when I hit Save, I get “org.springframework.security.access.AccessDeniedException: Access is denied” in the Live Logging.

Does this have something to do with my hubs[0].id being replaced?

My goal was to use the SmartThings account to support the HS105 on my Logitech Harmony Hub (which support the SmartThings hub but not the TP-Link plugs). I’ll consider buying a SmartThings hub if you can confirm that my access denied is due to me not having a hub.

Thanks for the great work!

Yeah, you have to have a SmartThings Hub to use SmartThings.

I believe strongly that it will work with a properly working SmartThings Hub.

Currently, there are 737 connections via this page with the source. If 50% actually try to install, that means 360+ successful users. Since the current version was released, I have seen only one major issue. The error state was not updating properly. It turned out to be SmartThings wide and corrected itself in several days. Caused issues with the Service Manager, not the devices, so few noticed.

2 Likes

I have had time to review. First, thanks for the hints. I removed in my test code for the switches/plugs the switch:waiting event (they were not there with the bulb). I also removed the isstatechange from the switches (again not their with the bulbs). Testing shows that the events are not triggered. Only way to tell if refresh runs is to monitor the log.

Side note: I had turned-on a device this AM via Amazon Alexa. In reviewing the logs, Amazon is also polling the device every 10 minutes. That added to the problem!

I did a Pull Request on Github, you are missing the / before the * in Line 1 of the (Cloud)TPLinkHS-Series.groovy file.

1 Like

Fixed!. Failed to pull myself (which I usually do and always should do).

Thanks for the catch

1 Like

Install the cloud version and it works great.

Thanks

1 Like

Hello guys. Happy owner of 16 HS-200 switches, I have been using the cloud-based integration for some days.

Unfortunately, most switches temporarily disconnect from the router when using the Panasonic microwave, then come back a few seconds/minutes later.

The router is a AC1900 Nighthawk and hasn’t given me any issue so far with 30+ devices, including streaming 1080P on a tiny Raspberry Pi. I’ll try to change the channel… But this is not the main issue.

After using the microwave yesterday, one of the switches totally went down (Device is offline + COMMS ERROR) on SmartThings, while still fully functional on the Kasa side. I tried to remove/re-add it in SmartThings, no success. Still down.

Any idea?

1 Like