Adding TP-Link Smart Plugs to HomeKit

There are quite a few smart plugs on the market, all offering much the same functionality—the ability to turn a plug off and on. With summer around the corner, I wanted to automate a desk fan so that I can keep cool when going to bed, whilst not wasting electricity leaving it on all night.

When I began researching HomeKit plugs I was disappointed—most of the plugs I found were US sockets, and the few UK sockets I found were all from brands I’ve never heard of. The only exception was the Eve Energy plug, but at £44.95 it was far too much to spend on a single plug.

After the initial disappointment, I decided to look at what was on offer within the Homebridge realm and was not disappointed. After looking at a few different plugs I found TP-Links’ HS series plugs, these fit my needs perfectly and already has a Homebridge plugin.

The TP-Link smart plugs only cost around £20 each—which is far better than the £44.95 Eve Energy plug. As I’ve already got Homebridge setup, adding another plugin was going to be simple!

Setting up the TP-Link Plug

When I first got the TP-Link plug I was fairly impressed, annoyingly you can’t plug them in next to each other due to the form-factor, but it does have an ON/OFF button on the plug which is nice.

The plug came with very straight forward instructions. One of the plugs I bought didn’t come with the manual but all you need to do is download the TP-Link Kasa app (App Store/Google Play) and create an account. The app does an extremely good job of guiding you through the rest of the setup—and as we’re not going to be using the app for automation you’ll only need it to update the plugs and add new ones.

If you do need to reset your smart plug just hold down the small top button for 5 seconds and the Wi-Fi light will start flashing green and orange.

Homebridge Setup

Whilst the Kasa app is nice, using the native app was never the end goal for this project. If you’ve read my previous guides you know my mission is to have everything exposed to HomeKit. If you haven’t got Homebridge up and running check out my setup guide here. The homebridge-tplink-smarthome plugin works extremely well. Additionally to the smart plugs the Homebridge plugin also supports TP-Link’s range of smart bulbs too—which is pretty neat!

To install the plugin you’ll first want to type the below command:

sudo npm install -g homebridge-tplink-smarthome

Once you’ve installed the plugin you can then configure it. To add this plugin to your Homebridge system you’ll want to add the following to your config.json:

"platforms": [{
    "platform": "TplinkSmarthome",
    "name": "TplinkSmarthome"
}]

Adding this to the config will give you full control of your TP-Link smart plugs adding all connected plugs automatically. HomeKit also allows you to change the device type, so you can set it up to appear as a fan instead of a plug socket.

If you do add more plugs to the Kasa app, restart Homebridge and they’ll be added automatically.

Additional Parameters

For most use cases the above config will do everything you need it to, but there are several device parameters that can be added to the config to add or change some functionality of these smart plugs. A couple of these parameters only work with plugs that support energy monitoring—such as the HS110 plug.

There are several device parameters that can be added to the config to add or change some functionality of these smart plugs, a couple of these parameters only work with plugs that support energy monitoring—such as the HS110 plug.

“addCustomCharacteristics”: true, //Allows the energy monitoring to be viewed within the Eve app (Only works with HS110).
“inUseThreshhold”: 0, //Measured in Watts, set the flag that changes the Outlet In Use tag to true (Only works with HS110).
“switchModels”: [“HS100”, “HS110”], //Creates a Switch appose to an Outlet for the models specified in HomeKit.
“timeout”: 10, Measured in Seconds, sets the time for communication timeout.

The only additional parameter that I use is the inUseThreshhold, which I use to see when my Washing Machine is finished—annoyingly you can’t use this as a flag for automation, but is still a useful feature. To include any of these parameters simply add the line to your config.json underneath the ‘name’ line, excluding the description after the // in the above.

As well as the above parameters there are some Device Discovery parameters and the ability to manually specify devices via IP, for more information about this, check out the plugin creators GitHub that explains these parameters.

Overall installing these smart plugs was extremely simple and I would highly recommend them to anyone looking for an easy solution to HomeKit smart plugs that won’t break the bank! If you have any questions about these smart plugs, drop a comment below and I’ll be more than happy to answer them.

Leave a Reply

avatar
  Subscribe  
Notify of