ESPSense - TP-Link Smart Plug alternative (via a little extra effort!)

Some of you may have noticed a link to this on the SenseLink thread, but I wanted to wait to post here until we had some confirmed and calibrated smart plugs.

ESPSense is similar to SenseLink in that it emulates the TP-Link Kasa energy monitoring smart plugs to report usage. However unlike SenseLink, which acts as an “intermediary” to help devices talk to Sense, ESPSense run on devices and reports power usage directly to Sense.

We/I have already identified 4 commercially available plug models that can be flashed “over the air” and will then report usage just like TP-Link Kasa plugs. Example configurations are provided for each.

ESPSense is a “custom component” for the ESPHome platform, which is a firmware system for the Arduino-like ESP8266/ESP32 chip commonly used in a lot of IoT devices and plugs. ESPHome gives you flexibility and control over the hardware, uses a fairly straightforward YAML configuration, and can integrate seamlessly with Home Assistant. It’s awesome for quick, homemade IoT devices as well - I used a $5 ESP8266 board and ESPHome to make a “Music E-stop” button to quickly pause my HomePods when I get a call while working from home!

Now for the “little extra effort” part:

  • As noted above, you do have to re-flash the firmware of any device you want to run ESPHome and ESPSense. I’ve tried to provide guides and links on how to do that over the air, which is certainly the easiest way. It takes a little bit of familiarity with Linux and software configuration.
  • The appropriate calibration for the power monitor chip does need to be determined for each device model - for example, here are the values that have to be determined on one of the confirmed plugs. That’s done by either using something like a Kill-a-Watt and/or a known load like a 90W lightbulb. That said, the idea is to keep track of nominal calibrations for plug models that are identified, so that others can benefit!
  • Keep in mind that re-flashing: (1) this voids any warranty on the destination hardware, and (2) has a risk of “bricking” the device if performed incorrectly!

Like SenseLink, ESPSense is not an official solution and Sense is not responsible to provide support for it! Also keep in mind there is a ~20 plug practical limit for your Sense monitor.

And as a side note - while most of the interest would probably be regarding Kasa alternatives, ESPSense can also be used with development ESP boards and things like CT clamps or other power monitoring hardware to monitor things that simple plugs can’t. Similarly to SenseLink, you can configure it to measure and report more than one “plug” per device as well!

6 Likes

Also I thought there might be some interest in my highly advanced test and calibration setup for all these smart plugs.

Behold, the smartest* area of my house:

*This is debatable…

(Edit: also to clarify, even if ruins the joke, this is not how I actually gathered calibration data!)

4 Likes

@cbpowell, it would be interesting to see your calibration “results” over a range of loads and load types, even if you are only looking a statistical sample of size 1 for each smartplug type. Plus not clear if any of them represents the “golden” measurement, especially since they all probably also have different sample intervals.

1 Like

@kevin1 Yeah agree - internally all the plugs I’ve “confirmed” use the HLW8012 power sensor chip. In doing the base calibration, I’ve been trying to find the approximate/nominal values for the current_resistor (shunt resistor) and the voltage_divider. These would presumably be the same across all plugs of a given model, but individual plugs will definitely have a tolerance around that nominal, like within 5-10% - or whatever resistor tolerance the manufacturer decided to source.

A user on reddit (maybe on here here too) mentioned grabbing some more load values with a Kill-a-Watt, and I’ll probably try to do the same. ESPHome would let us use that data to do a “detail” linear calibration on top of the base values, where you map measured values to truth values on as many points as you want. If there’s a common non-linear trend to some models, that detail calibration would be how it could be corrected.

I bought 2- and 3-packs of the UL listed compatible plugs (to use for my own home), so I’ll eventually get around to comparing values across individual instances and see how they look as well.

Not sure the the Kill-A-Watt should be the golden measure. But glad you are getting a broader sample space. Ultimately the shunt and CT tolerances and any calibration feedback play a bigger role in accuracy than the actual underlying measurement chip.

I have posted in a few places, but FYI - the HS110 uses this chip for measurements.

datasheets.maximintegrated.com

MAX71020.pdf

1031.63 KB

The HS300 uses two of these:

STMicroelectronics

STPM33 - STMicroelectronics

STPM33 - ASSP for metering applications with up to four independent 24-bit 2nd order sigma-delta ADCs, 4 MHz OSF and 2 embedded PGLNA, STPM33TR, STMicroelectronics

I think Maxim is phased out their part - that may be the reason the HS110 has been discontinued.

1 Like

Good to know. Honestly I used my HS110 as the calibration device at first because I didn’t have a Kill-a-Watt…maybe that wasn’t such a bad idea!

I have no doubt the Kasa plugs are better. Just going off cost alone - most of these cheap Tuya-based plugs are <$10 each!