Energy Measurements
Besides all the automation that you can do with Home Assistant it also has a very nice Energy Usage dashboard to keep track of everything going on in your house. Having historic data is always good, especially if you don’t yet have any solar or a house battery so you can size the systems properly.
My setup keeps track of my grid electricity and gas usage thanks to a smart meter, solar via a couple of raspberry Pi, and water thanks to the fact that water meters broadcast their reading unencrypted!
Electricity and Gas
I finally relented last year and got a smart meter. My electricity is with British Gas and they rather cheekily just booked a meter replacement appointment without me asking. I decided to keep it rather than cancelling it as I’m a sucker for tech! I was put off because my existing meter would actually run backwards if I was generating more than I was using.
With the meter installed, it comes with a readout to show you how much you are currently using. Its not quite straight forward to get the details into Home Assistant. You can sign up on an app called Bright and get half hourly meter readings for free, and this has an integration built into Home Assistant. This is a nice quick way of getting the data but it isn’t very granular.
Alternatively you can get a different display from Hildebrand that not only will read your meter for instantaneous data, but also connects to your wifi and provides data via an MQTT connection to Home Assistant, with an associated integration.
Once connected, you can add the relevant entities into the Energy dashboard.
Solar
I have two relatively small grid tied solar installs (limited by the amount of roof space), one on the garage and one on the main roof both using Solis inverters. The problem with these inverters is that the default method of logging the data writes all the info off to a third party in China. Now I’m not necessarily a security nut, but I do like to avoid cloud based services wherever possible.
Thankfully, the logging stick that comes with the inverter actually just reads RS485 (modbus) registers. After much trial and error due to lack of decent documentation (or more to the point, documentation that actually agrees!) I managed to write a python script which reads the registers and posts the data to MQTT using the Home Assistant auto discovery layout.
This script is running on a PiZeroW, using the connector off the standard logging stick. I did ask if they had any broken sticks to save wasting a working one, throwing away all the electronics.
Water
The last bit of the puzzle for my house was a bit of a long shot. When we moved in we decided to go with a water meter due to the rates for our area being way too high. I didn’t think much of it, but as I now had a smart meter for gas and electric, plus all the solar being logged into Home Assistant, I thought I’d take a look. The fact that the Energy dashboard had a section for water definitely had a influence!
After wiping off a rather thick layer of dust from the meter, I got the model number and started looking things up about it. Turns out it broadcasts the meter reading on a standard 868Mhz, which of course can be listened in on using a simple, cheap USB digital TV dongle. I may have a few of them laying around the house (including one listening in to all the planes passing overhead). Even better, it was unencrypted.
Thankfully I didn’t have to write everything myself, there is already an open source program call wmbusmeters that will use an RTL dongle and output the data in JSON to the stdout. With a quick python wrapper to read that data and post it via MQTT for Home Assistant to read (again, using the auto discovery layout)
Energy Dashboard
All the entities created are then entered into the relevant sections in the Energy Dashboard. This automatically configures everything to display and record the information. It gives a nice page to view all the data. I’ve also got a number of devices hooked up with plug in energy meters so I can see the consumption of things like my server rack, computer, tv, etc. All of these will also get displayed on the dashboard.
Along with the dashboard, I also have graphs in Grafana for more granular details and spotting trends.
Future
At some point I want to possibly get a battery for the house. Once I’ve collected a year or so of data I’ll have a much better idea on the suitable size to get and should be able to calculate a fairly accurate ROI. For now I’m just happy to keep track of the energy usage.
Leave a Reply