[DEPRECATED] Kasa Plug, Switch, and Bulb integration

Just update, please, using a repair. I did a mx release in one hour after the update.

It is something I will never do again.

ok, thanks I'll do that

Hello, Which ports and protocols are used for the communications between TP-Link devices and Hubitat. Please also indicate the directionality or from which side the connections are initiated.

My TP-Link devices are on a separate subnet from my Hubitat C-7 so I must setup port forwarding.

Thx

Update:

TP-link device port: 9999
Protocol: UDP
Hubitat Port: I do not know (this is not visable in the normal Hubitat Implementation.

1 Like

Awesome, thanks. That worked (for a single device).

As written, the App won't work for multiple devices on a separate subnet because there doesn't appear to be a way to configure multiple discovery ports. Adding a configuration setting so that the user can specify either a range (9990-9999) or a list (9999, 8888, 7777) of ports to discover devices on would "fix" cross-subnet discovery.

I changed the port number in the App code and was able to discover a second device but port 9999 is also hard coded in the driver and used for control, so adding a port configuration field to the (Kasa Plug Switch) driver is the most pressing issue.

Finally, looks like your code isn't correctly handling the apostrophe character:

Final Update. I will have a test version on GitHub by midnite (TEXAS time) tonight. Will only include the APP and the single plug-switch driver for your testing. These can be installed as a NEW app and driver without impacting your current installation. Links for test files to follow.

I will look at implementing this. However, differently than you suggest:

  • APP:
    • Configuration option for portForwarding with user entered list of ports.
      • Each port will take 3 minutes to discover the devices.
    • Catch port for each device as part of database.
    • Use existing Auto Update for existing devices to add port to device data.
  • Driver
    • On initial update, check for new "port" data element.
      • If it does not exist, create as 9999.
    • Modify comms to use port data vice hard code.

Please Private Message Me if you wish to test this for the team. Dave

Update: Have you seen this thread? Interesting information on Subnets.

Test code for app and plug-switch driver links:

App: https://raw.githubusercontent.com/DaveGut/Hubitat-TP-Link-Integration-DEPRECATED/master/TEST_Kasa_Integration.groovy

Driver: https://raw.githubusercontent.com/DaveGut/Hubitat-TP-Link-Integration-DEPRECATED/master/Test_Kasa_Plug_Switch.groovy

Thanks I sent you a couple PMs.

What the story behind the "Reboot device [Caution]" switch?

I actually have a device that is in an attic that I need to reboot but...

I just do not want people using it every day. Use at will, but sparingly.

Why?

Just a concern that I have on over-exercising the feature.

Because doing so will result in Armageddon?

  • What qualifies as 'over-exercise'?

  • What exactly is the concern?

  • What is the appropriate use of this feature? e.g. click the "Reboot device [Caution]" switch on, wait five minutes, click the switch off?

It takes about one minute to reboot (after doing the Save Preferences. Control directly available.

I just do not like over-using the reboot. Personal worries.

OK just updated to new app and driver
getting this error on two devices
KasaInt/6.4.3-r4] Failed to install device.
Device: 50C7BF17BA89={ip=192.168.1.39, plugNo=null, alias=Task light, model=HS100, type=Plug Switch, ledOff=false, dni=50C7BF17BA89, plugId=null}
Driver: Plug Switch

what am I doing wrong (I always assume its user error :slight_smile: )

I am guessing you did not install the driver "Kasa Plug Switch". It should be in your driver's page.

(PS - we all make mistakes. Without those, I would not be.)

well I did install a new driver before I posted my problem :slight_smile: it worked for 1 of 3 TPlink switches I have heres a snippet of it

===== Version 6.4.2 =====
  1. Tweaked communications protocol to reduce errors.
    ===== Version 6.4.3 =====
  2. Added Sync Name with options for Hubitat or Device Master
  3. Fixed various communications ARs.
    ===================================================================================================*/
    def driverVer() { return "6.4.3" }
    def type() { return "Plug Switch" }

What is the explicit error you are getting on the last device?

What is the device Model (i.e., HS115).

Is the device on the list in add devices????

Dave

model HS100

yes its in the list
a HS103 added perfectly

I will pm you immediately.

Having an issue with Kasa bulbs in a Scene:

[dev:27] 2021-12-12 08:03:33.126 pm [error](...)groovy.lang.GroovyRuntimeException: 
Ambiguous method overloading for method java.lang.Integer#multiply. Cannot resolve which method to invoke for [null] due to overlapping prototypes between: 
[class java.lang.Character] [class java.lang.Number] on line 952 (method setColorTemperature)

Logs from line 951 show this (ignore the timestamp difference, I ran this again recently to get the log line):

dev:282021-12-12 08:28:47.737 pm debug[Color Bulb / 6.3.3 / Outdoor Light]| setColorTemperature: 3500 // 100 // null

I have a LB130 and when I activate a scene where the bulb goes from RGB mode to CT mode, I get the error above.

Current bulb state:

* circadianState : **normal**
* color : **{hue=65, saturation=100, level=100}**
* colorMode : **RGB**
* colorName : **Blue**
* colorTemperature : **3500**
* commsError : **false**
* connection : **LAN**
* hue : **65**
* level : **100**
* saturation : **100**
* switch : **on**

Trying to change the scene to this:

Outdoor Light: on, level 100, color temperature 3500 (**3500** )

App Version: 6.4.3
Driver Version: 6.4.3

Oddly, when I look at App and Driver views, I have three App installs listed (6.4.0, 6.4.0 (yes, two), and 6.4.3) and two Driver versions (6.3.3 and 6.4.3). I install via Hubitat Package Manager. Maybe I need to do some clean up?

I do have two Kasa bulbs total.