In my quest to find more interesting things out about my house's energy usage, I wanted an easy plug-in power monitor. Something that I can quickly plug inline with a device like the washing machine and measure how much electricity is used.
Such a plug needs to be small enough to be unobtrusive and work with whatever socket powers a device. It needs to be cheap enough so I can buy several. It needs to support the full 13A available from a UK mains socket. And of course it needs to work with Home Assistant. I'm not an Apple house so that rules out anything using HomeKit. The Hue smart plugs look close to what I'm after, certainly in terms of form factor. They're not cheap though.
Local Bytes to the rescue
A look around the Home Assistant forums showed I'm not the first person to ask this question. And one smart plug in particular quickly caught my eye: The Power Monitoring Smart Plug from Local Bytes.
These little WiFi plugs don't need a separate ecosystem or hub to work. These are cheap enough that buying a few won't need a new credit card. They come pre-flashed with the excellent Tasmota firmware. They communicate with Home Assistant via MQTT and they work with the native Home Assistant Tasmota integration, providing sensors for voltage, current and power use (both real and reactive), and even a remotely controllable switch. (One of?) the guy(s) behind Local Bytes even posts on the Home Assistant forum.
In short, they look perfect. So I ordered a bunch.
Prerequisites
Ensure Home Assistant is correctly working with a MQTT server.
Add the Tasmota integration to Home Assistant.
Setup
The initial setup is straightforward and detailed by the guide on Local Bytes. In brief:
Power on the plug.
Use a phone to connect to the WiFi SSID being radiated by the plug, something like "tasmota-f7d8d4". My phone jumped straight to the Tasmota WiFi credentials page but if not you'll need to open a browser to http://192.168.4.1.
The plug had scanned for my WiFi SSIDs. I selected the relevant one and entered the password. The plug rebooted and connected to the WiFi instead of radiating its own SSID.
I use static IP leases handed out through DHCP because I always want to know what address is assigned to what device, so I created a new assignment for the plug using the MAC address the router had observed. The plug needed a reboot to pick up the new address. This is an optional step, there's no particular need for a static allocation, you only need to know the IP address that the plug has picked up via DHCP for configuration.
Now, connect to the plug's web page:
Device name
Click Configuration then Configure Other.
The Device Name is the name that Home Assistant assigns to the overall device. Names can be anything but do need to be unique. I use a simple naming scheme of "plug-room-device" e.g. "plug-kitchen-dishwash".
The Friendly Name is the name given to the switch entity created within Home Assistant. I set this to the name of the device, e.g. "Dishwasher".
The Home Assistant Tasmota integration documentation explains how the names relate between the Tasmota UI and Home Assistant in more detail.
The plug will reboot to apply the new names.
MQTT
Click Configuration then Configure MQTT. Enter the details for the MQTT server:
Host
Username
Password
Do not make any changes to the MQTT topics because otherwise the Home Assistant discovery process won't work correctly.
The plug will reboot to apply the MQTT settings. When it reboots, Home Assistant should add the device automatically.
Presto!
The plug as it appears in Home Assistant. Look at all those lovely measurements!!
Advanced Configuration
There are two further configuration tweaks to apply.
Timezone setup
The plug reports values for "ENERGY today" and "ENERGY yesterday. For these to be accurate, the plug needs to know when midnight is in your timezone. My plugs were set to GMT+1 upon arrival which isn't correct for the UK.
Use the reference table to find the correct commands to instruct Tasmota about your timezone. On the plug, click Console then enter the command pasted from the table. In the case of the UK, this is what was needed:
Backlog0 Timezone 99; TimeStd 0,0,10,1,2,0; TimeDst 0,0,3,1,1,60
In the same command entry, you can find out the current timezone settings by typing:
status 7
Sensor reporting interval
By default, the plug reports its sensor values every 5 minutes. That isn't anywhere near often enough to get a nice graph of things like the power consumption. I set mine to 15 seconds by clicking Console then entering:
teleperiod 15
You can adjust this to get the best out of your system. The command documentation explains more. The more often the sensors report, the more work Home Assistant will do and the quicker you'll fill up your database though. Everything's a balancing act.
Installation
Meeting the requirement to be really easy to install, once I'd configured the plugs, the installation was a total doddle. In fact, making the little label probably took longer than the configuration.
Two plugs fit perfectly side-by-side in a standard UK 2-gang outlet (buried in a cupboard hence the poor lighting, sorry):
Let's get graphing!
This is what we're here for, after all.
Well I guess that's not hugely impressive but it does rather neatly show the power consumption of our washing-related white goods last night.
With the 15 second sensor reporting, this 24-hour (apexcharts-card) graph ended up querying so much data that the Home Assistant frontend ground to a halt. I had to use the averaging functions to group consumption into "average every half-hour", which makes the chart less bleedingly accurate but the relative use of the three domestic devices is still shown well enough.
I also took control of the update_interval and set the chart to refresh around every minute instead of the default of refreshing every time a graphed sensor sends a new value.
Here's the YAML for the card:
- type: custom:apexcharts-card
header:
title: Power Consumption
show: true
show_states: false
colorize_states: true
all_series_config:
type: column
graph_span: 24h
update_interval: 67s
stacked: true
series:
- entity: sensor.plug_kitchen_dishwash_energy_power
name: Dishwasher
group_by:
func: avg
duration: 30m
- entity: sensor.plug_kitchen_washer_energy_power
name: Washing Machine
group_by:
func: avg
duration: 30m
- entity: sensor.plug_garage_tumble_energy_power
name: Tumble Dryer
group_by:
func: avg
duration: 30m
Yes I know I could template the series' group_by functions. On the todo list : )
I also added a Glance card to display the daily total consumption:
Conclusion
The Local Bytes power plugs are exactly what I wanted for a bit of quick, relatively cheap, power monitoring into Home Assistant. I will be looking for future opportunities to install more of them.
Comments