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

There are now a local and cloud version of the Kasa Integration. The cloud version is intended for use when your firmware has been upgraded to the latest version. If that occurs, the local version will not work.
There are three sections: General, Local Installation, and Cloud Installation

Acknowldegement: To the many HubitatEnvironment, SmartThings, and gitHub users that have contributed to my knowledge and resolution of anomalies - Thanks now and forever.

Welcome to the TP-Link / Kasa device Hubitat Integration thread. This thread is for the community-developed Kasa Integration of the Kasa series of plugs, switches, and bulbs. Note, in the below information, Quick Polling is NOT supported in the Cloud Version. The following are supported:

  • Plug Switch: HS100, HS103, HS105, HS200, HS210, KP100: On, Off, Refresh, Quick Poll.
  • Dimming Switch: HS220: On, Off, Level, Refresh, Quick Poll.
  • Energy Monitor Plug: HS110: On, Off, Refresh, Quick Poll, Energy Monitor functions.
  • Multi Plugs: KP200, HS107, KP303, KP400: On, Off, Refresh, Quick Poll for each plug on the device.
  • Energy Monitor Multi Plug: HS300: On, Off, Refresh, Quick Poll, Energy Monitor functions for each plug on the device,
  • Mono Light Bulbs: KB100, LB100, LB110, KL110, LB200, KL50, KL60: On, Off, Level, Refresh
  • Color Temperature Bulbs: LB120, KL120: On, Off, Level, Circadian Mode, Color Temperature, Refresh
  • Color Bulbs: KB130, LB130, KL130, LB230: On, Off, Level, Circadian Mode, Color Temperature, Color, Refresh

Quick Polling Warning: Quick Polling can have negative impact on the Hubitat Hub and network performance. If you encounter performance problems, before contacting Hubitat support, turn off quick polling and check your system out.

Installation Asumptions: This integration, by design, assumes the following:

  • The devices are installed to your network via the Kasa App
  • The devices are on the same network segment as your Hubitat Environment.
  • All devices have been assigned a Static IP address in your router. (Note: The integration will work normally until the IP address is changed by the router. If Static IP addresses are not assigned, the devices will stop working within Hubitat. Recovery is to run the Kasa Integration app and just press "Done" on the first page.)

Local Installation
Initial Installation Instructions:

  • Recommended: Install Hubitat Package Manager (recommended), then in HPM:
    • Select "Install"
    • Select "Browse by Tags"
    • Choose tag "lights and Switches"
    • Select "Kasa Devices Integration by David Gutheinz"
    • After completing HPB Install, run the "Kasa Integration App" and select your devices.
  • Manual Installation:

Update Instructions:

  • Using Hubitat Package Manager
    • After update, run the application or complete a "Save Preferences" on each device.
      • Running the app will update the device data in each app. At the main screen, select "Done"
  • Manual Update:
    • Requires both Drivers and Application
    • Go to Driver Code page and open the driver
      • Select the Import
      • Select save
    • Go to the Apps Code page and do the same for the Kasa Integration.
    • Run the Kasa Integration app then select done
      • While opening, the app updates each installed device.

Cloud Installation
Go to link: "HubitatActive/KasaCloudDevices at master · DaveGut/HubitatActive · GitHub"
I will create the installation instructions when time permits. Hopefully Hubitat Package Manager installation will be added soon.

It is a typical installation:

  • Install Application
  • Select your required Drivers from the driver list.
  • Install Drivers
    • Run Application
    • Enter username and password
    • Select devices, then done.

Problems or issues with this integration

  • Pplease use this thread to report same. I need information on
    • What you were attempting to do
    • Debug logs for the device only containing any error codes
    • The impact on the operation (i.e., device did not turn on/off, state is incorrect.

Disclaimer: No association with Hubitat
This integration is custom code developed by a Hubitat community member. It is in no way certified by Hubitat. The developer has fully tested this code within a home environment using available TP-Link/Kasa and other devices. No significant problems have been found that would impact other integrations; however, the complexity of the Hubitat system does not guarantee some level of adverse interaction in other installations.


Just want to post a thanks to Dave. First for being patient enough to deal with a total noobs questions and being very patient about it. Second for jumping on board and saving me any more suffering trying to figure this out.

EDIT: Works perfectly!!


THANK YOU DAVE!!! Truly appreciate your work!

Wow....super excited. Thanks Dave!!

I saw in the logs that devices this updated every 30 minutes. If someone manually activates it, the status will be synchronized within 30 minutes in Hubitat. However, the "refresh rate" command in the driver does not work. And if we change is parameter. The default 30 minutes refreshing will not work anymore.

Thanks for the feed-back. Actually, Hubitat does not have a Capability Refresh. I added the command in the metadata to keep the ability (since the device can be controlled outside Hubitat and SmartThings).

I just test. It works per spec after changing frequency. I did find that runEvery1Minute does not work in Hubitat.

With smartthings for tp-link devices. The poll function worked very well.

But in RM I do not see the tp-link for the POLL function

Poll is not there (forgot need). I can add back in (where poll does a refresh). Take about 5 minutes to add. Do you want it?

UPDATE. Just updated the code on GitHub for

  1. Remove "runEvery1Minute" command which causes an error in Hubitat.
  2. Add back the exposed "poll" command.

The poll add may or may not help your RM functions. Note that Hubitat does not have the Capability Poll. So if the app is looking for capabilities, it will not work. Same is true for Capability Refresh. If this is the case, you can look for the capability switch and know that the tp-link devices have the "poll" command and you can send them!


1 Like

the refreshrate in the driver every 5 minutes works really well. I will not even need the RM.

Good work. Thanks you :ok_hand:

1 Like

Thanks for this! I completely forgot I have TP Link plugs I don't use since I couldn't see them in ST (wanted a central place to see everything). What's the best way to subscribe to any updates you make have on this down the road?

Has anyone got this to show up in the Dashboard?

I have a plug on several dashboards set as an outlet and as a switch.

What did you have to do? Mine is working through Hubitat as a device, but does not appear within Dashboard as a device to add. Thanks

I didn’t do anything special, that I know of. If it is showing in your device list, it should be available. When you create a dashboard or edit an existing one from the apps web page, are you able to see the plug there in the list of devices to be exposed to the dashboard? (I select all devices for each dashboard because I have a terrible memory)


Too funny. All my Dashboards I had selected All Devices when I created them, Somehow, this one wasn't. Could be that I was testing the ability to chose the devices in advance to have the Dashboard auto create itself with those pre-selected device choices. Thanks for the sanity check :slight_smile:


Just thought I would leave this here.
Pretty good deal on these plugs.

1 Like

Hi Dave (@djgutheinz ) and/or anybody else

I have a new Pi 3. Installed node.js on it; version 10.8.0
Installed the Hubitat driver, added device & filled in the correct IP addresses as required for my switch in the Hubitat environment.

I'm stuck on what to do to integrate it with the node.js server...
Can somebody provide me with a little more granular information on how to implement the TP-Link node.js side of things (I'm a Pi noob)

Thanks in advance

1 Like

OK, figured it out by myself - well, Google did!

So for those that want to follow in some footsteps:

  • I created a folder TPLINK in /home/pi
  • Copied/Saved TP-LinkHub_v2.js to this new folder created above; no modifications were made to it
  • Edited the file \etc\rc.local; you may have to change permissions on it before editing to allow it to be saved again. This is done to allow the node server to start up after a pi reboot or power outtage
  • Added the line sudo node /home/pi/TPLINK/TP-LinkHub_v2.js < /dev/null & just above the exit 0 command; saved the file

Before rebooting the Pi, test this command sudo node /home/pi/TPLINK/TP-LinkHub_v2.js < /dev/null & from a Terminal window first to ensure it doesn't give any errors; cross-check in your Hubitat setup the commands are being executed/responded to via the Logs window

Several web sites listed the command to be added to the rc.local file as
su pi -c 'node /home/pi/app.js < /dev/null &'
While this worked from a Terminal window, it always prompted me for a password, so it would never execute properly in the rc.local file upon reboot

My knowledge on the Pi and any flavour of *ix is severely limited. While I may have managed to get it to work for me, your mileage may vary. Regrettably if you run into any issues with these steps I am 99% certain I will not be able to assist.


I am trying to use my newly configured Tp-Link switch in Rule Machine, specifically using the Poll command.

It does not however show up in both the device list of "Refresh and Poll" or "Poll". [Showing just Poll]
My understanding was 05-05-18 - Updated to remove "runEvery1Minute" and to add in "poll" command.

Any ideas?