[DEPRECATED] Kasa Plug, Switch, and Bulb integration

I am brand new to this. Just got my Hue lights and Kwikset lock tied in. Are there instructions somewhere for getting my tp-link devices onboard. Any help is appreciated.
I am excited to work on this .
Thanks,

Bryan

Welcome aboard Bryan. If you scroll to the top of this topic and follow the link for the installation instructions you should hopefully find what you need.

1 Like

New Update Available
The drivers and application code have been updated to version 5.2.0 and are posted on GitHub:

Driver changes:

  • Improved quick poll processing time by about 5% for each poll.
  • Update to error handling for Hub version 2.2.
  • Fixed issue in bulbs where the response was not processed on some devices after a refresh.

Application Changes:

  • Reworked code flow for greater flexability
  • List of devices is now automatic on starting device.
  • Added following pages
  • Delete Devices - Select installed devices for delete.
  • Advanced Hubitat Tools:
    • Unbind Devices - unbind selected devices from the Kasa Cloud
    • Bind Devices - rebind devices to the Kasa Cloud
    • Reboot Device - reboot a single device (for troubleshooting).

Install location: HubitatActive/KasaDevices at master · DaveGut/HubitatActive · GitHub

Installation Instructions and Descriptions: : Home · DaveGut/Hubitat-TP-Link-Integration Wiki · GitHub

Notes:
Unbind Devices: This function removes the device from the Kasa Hub with the following effect:

  • Device access from Hubitat is not impacted
  • Kasa App can access devices only when connected to the same WiFi as the devices

Bind Devices: Reconnects device to the Kasa Cloud.

Reboot Device: Troubleshooting. Reboots the device (same effect as unplugging and then plugging into power source).

PM me if you have issues.

1 Like

Just installed and KL50 working without error messages. Thanks for your great work, Dave.

1 Like

Stress Testing on My C-5 Hub

A user was having a communications error problem on the 5.2 release (explicitly for dimming switch). The result was that I could not resolve the issue. If anyone else is having significant communications WARNING messages from a Kasa Device, please personal message me.

Stress Test: As a part of the troubleshooting, I set up and ran a quick polling stress test on my active hub (attempting to replicate the problem). I felt these results may be interesting to a wider audience. See below for data on the Stress Test.

  • Results: No communications error at all on the hub, except, as expected, for the HS300 plugs (very occasionally due to six plugs sharing one interface).
  • Conclusion: On my C5 hub, the quick polling does not bring the system to a halt nor does it cause undo communications errors (UDP or otherwise). This result does not mean that other devices/apps on your system are not bringing down your communications or there is something on WiFi that is generally causing the issues. Those items I can not solve.

Below is the configuration of the Hub Under Test (HUT):
WiFi Router: ASUS Blue Cave
Hub: C5
Firmware: 2.2.0.128
Kasa Devices (all running 5.2.0 driver versions)

  • Items below set on quick polling of 5 seconds with debug and information logging:
    • 6 HS300 Outlets (Kasa EM Multi Plug)
    • 2 HS107 Outlets (Kasa Multi Plug)
    • 3 HS105 Plugs (using Kasa Dimming Switch driver)
    • 3 HS200 Switches (using Kasa Dimming Switch driver)
  • Items running normally with debug and information logging:
    • 1 KL50 Bulb (Kasa Mono Bulb)
    • 1 LB120 Bulb (Kasa CT Bulb)
    • 1 LB130 Bulb (Kasa Color Bulb)

Non-Kasa Devices

  • Items running on WiFi
    • 5 - Echo devices (Echo Speaks Device)
    • 1 - Garage Dooor Sensor (through IFTTT)
    • 1 - Telephone
    • 1 - Garage Door (MyQ Garage Door Opener)
    • 1 - Front Doorbell (Ring Doorbell Motion)
  • Z-Wave/Zigbee Devices
    • 2 - Z-Wave Dimmers
    • 1 - Z-Wave Door Lock
    • 5 - Zigbee Color Temp Bulbs
    • 3 - Zigbee Motion Sensors
    • 7 - Zigbee RGBW Bulbs
    • 1 - Z-Wave Thermostat

Applications

  • Kasa Integration (only operates on 4th consecutive comms error or when called by user)
  • Amazon Echo Skill (29 Devices)
  • Echo Speaks
  • Groups and Scenes (6 groups)
  • Hubitat Package Manager
  • Hubitat Dashboard
  • IFTTT Integration (2 devices)
  • MyQ Lite (Garage Door comms)
  • Notifications (2 notifications)
  • Rule Machine (10 rules)
  • Thermostat Scheduler
3 Likes

Version 5.2.1 Release to address some issues:

The entire set has been updated to 5.2.1. Changs are only in the following items:
Application:

  • Led On/Off; Added ability to control device led on/off.
  • HS300 Devices: Inserted logic and clear warning message to explain HS300 return being incomplete and unparsed if the total length of plug names exceed ~102 characters.

EM Multi Plug Driver:

  • Update to date handling to avoid using state.currDate.
  • Inserted logic and warning message to handle HS300 return being incomplete and unparsed if the total length of plug names exceed ~102 characters.

Kasa EM Plug: Update to date handling to avoid using state.currDate.

Version 5.2.0 notes for reference:

1 Like

Thanks. You mentioning the Hubitat Package Manager forced me to look into it, and I'm glad I did. It's a great app, as is your TP-Link integration. Thanks.

3 Likes

Does anyone have TP-Link switches working with Rule Machine 4.0?

I'm trying to get a TP-Link (HS200) switch to trigger other switches (also HS200).
But what I'm finding is that there's some delay or doesn't trigger at all.

Yes I have them working, but due to their implementation over WiFi, they rely of polling to detect a physical press. So you will have to enable quick polling per device. I have mine at every 5 seconds, which results in a delay of up to 5 seconds, assuming no communication errors, on physical presses.

What is the rule you are trying to implement btw?

Thanks for the info about the polling. Do you notice any network issue if you have the polling set to a low interval?

The rule I'm trying to implement is just getting one switch to trigger others. So if I turn the switch on in my foyer when I arrive, the hallway switches also turn on.

I'm probably not the best guy to ask about networking issues as Dave can attest, but that is a story for another time, but when it did work well for me, like a month ago, 5 seconds did not seem to have an issue.

I asked about the rule, because what you are trying to do might be easier if you use the built-in app called Motion Lighting. It also contains something called Mode lighting inside that app that allows you to turn lights on and off per mode and have a certain switch act as a trigger, this is the documentation for it and see my rule below:

The traffic for a command stream is relatively low (one sent and on received per poll). This is generally not a problem on WiFi performance. Hubitat performance is another thing. See.

Hi Dave!

Thanks for the reply and all your hard work.

I'm primarily using Hubitat to add more Smart integrations with the Kasa switches since the app only allows 3 Smart integrations.

So far it's been working great!

So a 5 sec polling would more affect the Hubitat than my network? Would that be detrimental to the Hub then?

On an average installation, no. The secret is limiting quick polling to as few devices as necessary (one?) and then run for a while.

One hint. The switch attribute has a type of physical or computer. If you only want the other switch to turn on when the device is manually pressed, then the type should be physical in your rule (this came from other users).

Thanks Dave.

I'll give it a try when I get back home.

It took me awhile to realize that the Kasa switches do not "ping" the Hubitat when you physically push the switch, so my Rule wasn't firing.

1 Like

Thank you so much for this integration. One question. I'm trying to use the MakerApi and Tasker to be able to toggle the plug from my smartwatch.

It seems like the device only supports on/off and doesn't have a toggle, is that correct? This is what I see when I query the device for supported commands:

[{"command":"off","type":["n/a"]},{"command":"on","type":["n/a"]},{"command":"refresh","type":["n/a"]},{"command":"setPollFreq","type":["NUMBER"]}]

If so, how would I go about accomplishing simulating a toggle?

Yes. The device is a switch. No toggle capability. To simulate a toggle, I would use rule machine and a virtual toggle device. You would toggle the device, rule machine would determine current state and turn on or off.

Thank you. I was a little confused because my Iris V2 switch supports toggle.

In any case, I wrote a RM rule to do as you suggested. Since I don't currently have polling enabled, my rule does device refresh and waits for 1 second before determining the current state (in case hubitat is out of sync with the actual state of the switch). It seems to be working correctly.

1 Like

Thanks for this app. It works superbly!

Will get to it in a few hours....busy right now (which is why I'm on here ! )

1 Like