[RELEASE] TP-Link/Kasa Plug, Switch, and Bulb integration

Hi Dave (@djgutheinz)

The device also does NOT show up in RM for a refresh.

Looking at the driver code, it also appears it already has both capabilities: poll & refresh

metadata {
definition (name: "(Hub) TP-Link Plug-Switch",
namespace: "davegut",
author: "Dave Gutheinz") {
capability "Switch"
capability "Sensor"
capability "Actuator"
command "refresh"
command "poll"
}

Thanks
J

Those capabilities may be case sensitive. Change to Poll and Refresh.

Changed the first letter for poll & refresh to UPPERCASE - Poll, Refresh
Made no difference - still doesn't show up as a device with that capability to pick it.

Out of interest I did just try something simple, as trying to select it as a switch for an on/off command in RM, and it DOES show up...

J

Sorry - missed something the first time I looked...

Change you driver code as follows:

metadata {
definition (name: "(Hub) TP-Link Plug-Switch",
namespace: "davegut",
author: "Dave Gutheinz") {
capability "Switch"
capability "Sensor"
capability "Actuator"
capability "Refresh"
capability "Poll"
}

Note that I changed the word 'command' to 'capability' as this is what lets other apps know what capabilities are supported.

@ogiewon Dan, changed the code as suggested. Got an error:

image

Changed line 35 to capability "Polling" - the allowed me to save the driver successfully [looked at some of the other drivers I had]

In RM the device is now showing up in the "Refresh and Poll" listing, but still not in the "Poll these devices" listing. I do not claim to understand the magic at all. However, I can now refresh it in RM, making me a happy camper.

J

1 Like

Try "Polling" instead of "Poll"

Sorry about that... working from memory

Will fix on next release.

@djgutheinz

Will you be able to update the drivers to accomodate the new scenes capabilities? In this thread I am having issues with the TP-Link bulb driver not providing the correct events and attributes. Reference this thread for the context:

Is that a custom driver you are using for TP-Link bulb?

It is DaveGut's TPLink he ported over from ST. I don't believe HE natively supports WiFi Color Bulbs like TP-Link.

Yes, we don't have that driver. Your problem is probably with that driver. I think @mike.maxwell addressed that issue in the other thread. This has nothing to do with Groups and Scenes, other than that this app expects color bulbs to conform to the standard Mike pointed to.

I agree completely. Asking developer @djgutheinz what he might be able to do to the driver to conform to HE standards.

What other thread are you referring. If I can get the standards, then I can probably update to accommodate.

Sorry for delay. Been very busy on my real job and out of town for 2 months.

Here are the examples @mike.maxwell was mentioning to me.

Driver code samples

@djgutheinz

What is the upgrade path from current driver/app scenario? Do I have to recreate devices?

Not required. If you want to upgrade, you must upgrade drivers and application. Process is:

a. Open existing Driver of Application.

b. Delete existing code.

c. Copy new code from appropriate file on GitHub.

d. Save.

You will NOT have to recreate any devices.

Excellent job! Though the naming change of the app totally freaked me out as I am looking for TP-Link not Hubitat TP-Link lol!

Hi Dave (@djgutheinz)

Thanks for your fine work!!

I previously had a functional Node config running on a Pi with 2 TP-Link HS105 devices using TP-LinkHub_v2.js

  • Updated the *_v2.js file to *_v3.js
  • Updated TP-Link Plug-Switch (Hubitat).groovy
  • Added TP-Link Hubitat Manager.groovy

Initially got this error in the Hubitat TP-Link/Kasa Manager log
image

Restarted the PI & then got this; ALL OK!!!

image

As both devices were already there & functional, I deleted 1 device.

I also updated the following in the remaining plug:

image

In theory the Hubitat TP-Link/Kasa Manager should now discover the plug I deleted from the system earlier... However, it just sits at this screen & never discovers anything:

image

I am also now getting this error:

image

I am sure this error is because the node server crashed and that a restart will fix it, but I am also sure the crash will happen again...

Edit:

Restarted the Pi, was OK for a short while & back to the error state:

image

Thanks
J

Had to update all my devices with installation type but all is working and migrated. Now to look at you local json implementation as I do have a dedicated Pi3 for the home.

Are the devices working? Indications from the last message is the node.js applet was not running at the time. For PCs, I use a bat file that restarts the node when it stops for an error; however, there may be an untrapped error that is causing the crash on the pi3.

Dave

Download the Hubitat app