Emulated Kasa integration Brings SenseLink to HomeAssistant

Hi @jefflayman!

I think between myself and @enbickar, we can provide some details!

As an initial explanation, the TP-Link Sense integration works as follows: your Sense monitor sends out a UDP broadcast requesting power data from all plugs on it’s subnet. All TP-Link plugs (real or emulated) then respond back with their power usage, which Sense uses to display the plug bubbles. So no cloud computing here, it’s all local - and no accounts required. You won’t need accounts with Github or Home Assistant regardless.

In all cases, the emulation works by either calculating the power usage to report back based on another value (e.g. bulb brightness) or by directly reporting (e.g. device that reports it’s own power usage), and then replying back like a “real” TP-Link plug would.

There are two “branches”/approaches as of right now:

SenseLink:

This is a stand-alone tool, that runs on a computer (even a lightweight one, such as a RaspberryPi). You would need this computer running 24/7 to get continuous data reporting to Sense. It’s written in the Python language, so it should work on a wide variety of operating systems and hardware. It can communicate with a Home Assistant instance or devices running MQTT to source the “raw” power value or the attribute (i.e. brightness) data, in order to report to Sense via the TP-Link emulation.

You configure it by writing a YAML (Yet Another Markup Language, .yaml or .yml) text file, and provide it that configuration file when running the Python program. There are some configuration and usage examples on the README page, and I’m happy to help further as needed.

Emulated Kasa:

This is a version of SenseLink that has been adapted to be a Home Assistant integration, meaning it runs as part of Home Assistant. If you already have a Home Assistant (HA) setup, this the the simpler and more efficient way to do it (as long as you don’t have a specific caveat, see below). HA also needs a computer running 24/7 if you want 24/7 reporting, but you can integrate all kinds of smart home devices and it acts as a central hub for smart home information and integration. Full details of setting up HA are probably a little out of scope for a summary reply, but there are some great tutorials out there.

Emulated Kasa can use any kind of sensor or device that’s setup in HA as source data for an emulated plug, without needing to run SenseLink separately. Configuration is similar and also through a YAML file, although it’s part of a combined YAML configuration for the HA instance as a whole.

Caveat: As described above, your computer running HA does need to be on the same subnet as your Sense monitor, in order to receive and reply-to the UDP broadcast request from your monitor. But if you haven’t set up a separate network/VLAN for your IoT devices, you can ignore this!

Summary

So in short - if you already run Home Assistant (and don’t have an IoT VLAN) you probably want to look at Emulated Kasa. If you don’t run Home Assistant already, you might be interested in the stand-alone SenseLink to source data directly from devices (or HA!).

8 Likes