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

Special HPM Instructions for this release only. After updating via HPM, do an HPM repair. (used to correct discrepancy ).

New users. This integration is now a part of the latest Hubitat version. Installations should be completed using that version.
InstallationNotes have been updated to handle the built-in version as well as the legacy version. Link to all instructions: https://github.com/DaveGut/HubitatActive/tree/master/KasaDevices#readme

Note on KP125M: This device is not supported via this integration at this time. Work is in-progress for a seamless integration. For now, it is supported via a manual installation. See: TP-Link Kasa and Tapo Discovery - #8 by djgutheinz

Supported Devices. Currently, the Kasa Integration should support all non-Matter Kasa devices on the US TP-Link Pages (and by extension, non-US versions of same product types). The integration does not support Tapo devices. The lines below are the current products. Previous versions are also supported.

  • SmartPlugs: Smart Plugs | TP-Link.
    • Also supports the Energy Monitor functions for plugs with that capability.
  • SmartSwitches: Smart Switches | TP-Link
    • Motion Activitated switches: work on basic (on/off, dimming) functions.
    • A future version may support motion activation control; however, there is not way to determine if a motion detection has occurred other than the on/off state of the device.
  • SmartLighting: Smart Lighting | TP-Link
    • Light Strip: A multi-segment light strip is worked as a single-segment only.
  • SmartCamera and Kasa Thermostat/KH100 hub: Not currently supported.
    • Near future development of Control and Motion Alerts from these devices. Special conditions may apply for Control.

Version 2.3.5-1 Update. (Update is optional)

  • Energy Monitor Devices: Added energyToday poll interval select of 1, 5, or 30 minutes.
  • All Devices: Added Manual IP and Port update in preferences (caution).

ISSUES: If you have issues, the first thing to do is read the instruction/help available by the ? icon in the app and Kasa Help button in the devices. Major sections for problem resolution is "Troubleshooting".

Community Integration Links (for users with already installed integrations):

Disclaimer: No association with Hubitat
This integration is custom code developed by a Hubitat community member - with support from other community members. 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.

TP-Link Cloud connect (working)
FS: TP-Link HS-100 wifi outlets (qty 3)
I'm off the cloud! (mostly)
Just got my hub and a quick question
New here; Migrating from ST as soon as HE arrives!
Power reporting on Zigbee outlet
Kasa Integration
Control Alexa linked devices from Hubitat?
Switching from smart things but have all Tplink
Being notified when power draw from a smart plug stops
Kasa integration
Chatty smart plugs with energy monitoring - how many is too many?
[SPECIAL EDITION] Most Popular devices elevated by Community Efforts
Hubitat and Smart Plugs with Energy Montoring
Need help with Aqara button and Google assistant
Plug-in outdoor dimmer recommendations
New to this. Question on plugs
Anyone know if these can monitor power usage?
Kasa KS220M
Connecting Devices - Factory Reset
[RELEASE] HD+ - Android Dashboard
HE & Kasa, Aqara, HomeKit, GA, homebridge, HA, etc?
What comes first - Connect device to Google or Hubitat
Kasa HS300 energy monitor data?
Anyone have any personal experience with tp link kasa lightbulbs?
What's Next for HE?
Testing socket, telnet and websocket interfaces
Kasa Integration HS300's not detected yet HS110's are
Where to start with buying devices in Canada
Newby stuck on adding or selecting Amazon Echo connected devices
LAN Device discovery - no devices found
Lighting, WiFi
Several beginner questions: Remote access, Scenes, Buttons, Schedules, etc
Kasa and/or TP-Link local control
Kasa and/or TP-Link local control
AU/NZ Deals
Non-Cloud Presence Sensing - What's Best?
Smart plugs
Time versus cost decision, to be made in the fog
Received C7 Hubitat - Need Help First Time Owner
Received C7 Hubitat - Need Help First Time Owner
[RELEASE] Echo Speaks v3 + Actions
Show Off Your Dashboards!
Suggestion: I need a 6-12 port power strip
Smart Life (Tuya) vs Kasa (TP-Link)?
Another User Jumping from Wink
Outdoor 2 outlet plug
Mode lighting not firing
AUS outlet switch with power wattage usage(not cumulative hours)
Can Hubitat Elevation be useful to me?
Cheap and good smart plug
Hubitat for AUS/NZ Chat
AU/NZ Products and Retailer Guide
Hubitat for AUS/NZ Chat
Hubitat for AUS/NZ Chat
Washer / Dryer
Home automation Noob Questions
Migrating from Wink Hub 2 to Hubitat
Hubitat for AUS/NZ Chat
Kasa tp-link and currentValue
Considering move from ST to HE
Here is my setup, sans Hubitat
Planning my move from smartthings
Move from wifi switches & Alexa to HE
Welp... I'm dead in the water!
TP-Link Cloud connect (working)
Do any of you use WiFi devices with h.e? What access point do you use?
Sonos Integration with speakers on separate VLAN
Finally time to move from Wink2 Hub... C8 Acquired
Hubitat Elevation Model C-7 introduction & when will Model C-8 be introduced?
Hubitat Elevation Model C-7 introduction & when will Model C-8 be introduced?
Migrated to Kasa internal app from HPM - Now two apps show up
UK WiFi power monitoring outlets
Power meter for AC/TV and control
Suggestions for power monitoring plug other than Zooz
Need help troubleshooting a rule/behavior
Known Ecosystems, Hubs, and Integrations that work with Hubitat (not ZigBee or Z-wave)
Kasa Token for Cloud Keeps Reverting to Null
[PROJECT] Driver for Unifi Network Controllers
Kasa Plugs some work some don't all HS103
TP-Link KASA EP10p4
Can I get help with new button controller?
Any zwave 700 outdoor plugs?
Help adding wi-fi devices
Custom Apps [Wiki]
Amazon Basics smart switches
Wi-Fi plugs with energy monitoring

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.

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?


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"


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

Download the Hubitat app