I’ve previously explored the world of home energy monitoring systems and in the past arrived at using the Brultech GreenEye Monitor for a project in a friend’s house. It had the advantage of being local out-of-the-box and had a wide range of compact CTs that made fitting the electronics in the breaker box a lot easier, but it had one flaw that made it not suitable for my condo. It had to be mounted outside the breaker box with wires running into the box. I had no space in my condo, so I instead explored other options.
I came across the Emporia Vue2 and identified that it was running a standard ESP32 device and was easy to reflash with custom ESPHome firmware. ESPHome is an open-source framework for creating firmware to collect data from a variety of different sensors and publish it to MQTT/Home Assistant. This sounded perfect, so I ordered a Vue2 and here’s how I made it work.
Gear Used
- Emporia Vue2 - Obviously
- 13 Emporia 50A CT Clamps
- SparkFun Serial Basic Breakout CH340G - A USB to UART board to write firmware
- Pogo Pin Probe Clip - 6 Pins with 2.54mm / 0.1" Pitch - Used to interface with the ESP32 without soldering
Installation
I found the emporia-vue-local GitHub project here emporia-vue-local/esphome and followed the guide here. I had some issues trying to wire up to the DTR and CTS pins, so I instead connected IO0 and CTS to GND at boot, then let EN go high when I was ready to program.
I tried using the ESPHome Web UI to program the device, but it never worked correctly, so instead I used ESPTool on my laptop (Installation Guide).
First I made a backup of my existing firmware:
|
|
Then I went to my ESPHome dashboard and created a new configuration. I started with the reference ESPHome, but made a few changes. Specifically:
I updated the CTs to match my phases and circuits. You will need to do the same.
More importantly, I restructured how the sensors were configured to improve accuracy and reduce useless events. More information is found in the Accuracy section below.
Here’s the current ESPHome YAML:
|
|
Save the above configuration, then hit Install > Manual Install > Modern Format. Let it compile, then download. Then using the
|
|
References
https://flaviutamas.com/2021/reversing-emporia-vue-2
Installing CTs
Installing the CTs is the hardest and most dangerous part of this. If you’re not familiar with the risks with working inside a breaker box and the fact that the mains generally can’t be turned off, you should consult a qualified electrician.
The official hardware guide can be found here.
When installing the CTs, make sure that you match the phases with the colors and the holes in the top of the Vue2. Otherwise you won’t get the correct data. Note the bolded items. My BLACK wire went into the A hole and RED went into the B hole on the top of the Vue2.
|
|
An in progress pic showing it installed with just the CTs on the main loads. Note that the third phase is unused and is joined to the neutral and not left floating.
When installing the CTs on the individual circuits in North American houses, you may encounter circuits that have two phases (240v circuits). Two CTs are needed if it’s unbalanced, but one CT is sufficient if it’s a “balanced load.” I found the following quote to help me when installing:
If a double breaker circuit is “balanced”, power is evenly drawn through both poles. In this instance, an energy monitoring app can typically take the reading from one CT and multiply it by 2 to get the correct power reading.
However, if a circuit is “unbalanced”, two CTs should be used. Pumps, electric resistance heat, and HVAC units are typically balanced. Subpanels, dryers, electric ovens/ranges, and hot tubs are not balanced. Typically, if a piece of equipment is doing more than one thing, it is an unbalanced load. A dryer needs to rotate the drum and dry the clothes. Also, if a circuit has a neutral wire, this most likely means that the load is unbalanced and requires two CTs.
https://www.powerwisesystems.com/blog/measure-electricity-use-current-transformers/
I only found one unbalanced load, my clothes dryer. I installed a CT on both legs, then updated the ESPHome template to aggregate both legs, then send it to MQTT. The following snippet shows how to implement an unbalanced load sensor:
|
|
Next phase after installing almost all of the CTs. Not all circuits will get CTs.
After everything’s safely installed, turn the breaker on and verify that you’re receiving traffic in MQTT and in Home Assistant.
HA Recorder Management
When I first installed the Vue2 and pointed it to Home Assistant, it didn’t take long for the Postgres instance behind my HA Recorder to run out of disk space.
I checked the highest metrics and as I suspected, the integral was using the most space. It was being emitted every second as a watt-hour with 2 decimal points, but everywhere else I was using kilowatt-hours with 2 decimal points.
|
|
# of states | % total | entity_id |
---|---|---|
643,609 | 22% | sensor.total_energy_3 (The integral generated by Vue2) |
251,745 | 8% | sensor.total_power |
251,281 | 8% | sensor.total_energy |
251,129 | 8% | sensor.daily_electricity_usage |
239,813 | 8% | sensor.total_energy_cost |
210,866 | 7% | sensor.phase_b_power |
192,576 | 6% | sensor.phase_a_power |
92,212 | 3% | sensor.media_cabinet_total_power |
Not good. This is likely due to the fact that the integration sensor in ESPHome emits a new value every 2.88s just like the Watt sensor. This metric is designed to be long-term and Home Assistant’s energy tab aggregates it up per hour, so there’s no need for that level of precision. Instead, I’m going to have it emit it less frequently, but first let’s see what else is wrong.
Accuracy Analysis and Comparison
I then tried to compare the accuracy of the Vue2 versus other devices I have been using prior to this. The following shows a comparison with the Zooz ZEN15 Z-Wave Outlet installed on my washing machine.
Baseline
Here we see there is a difference of about ~1W, but this was attributed to the power draw of the outlet itself combined with another low power device on the same circuit not measured. After removing those devices, the measured value converges on about 750mW from both devices. This is good and indicates both devices are at least agreeing with each other.
Under Load
However, under load from a single wash load we see quite a different perspective:
This graph shows a big difference in the wave-forms. The Z-Wave outlet reported 126Wh for the entire run vs the Emporia Vue2 reporting 204Wh for a difference of 80Wh. Zooming in on this wave form in two places:
I suspect this is caused by the power metric being averaged over ~3seconds and all the momentary drops and increases were getting averaged out.
|
|
I confirmed this by removing the moving_avg filter and configured my Z-Wave outlet to send updates every 1W change and did another load of laundry.
To verify, I ran a query to total the watt-hours over the entire run-time:
|
|
Gave me 75Wh from the Vue2 vs 77Wh from the Z-Wave, a difference of <3% and the wave forms look like this:
These wave forms look a lot more similar than before.
Wave Form with large difference. Possibly caused by sampling or due to apparent/real power
To fix this, I changed how all sensors worked. Previously, esphome would perform a 2.88s moving average, then integrate that value for energy consumption. However, in spiky situations, that could become quite inaccurate. Trying to use HA’s helpers to integrate this would require the esp to send a huge power updates very frequently and increase Recorder usage.
Diagram showing the ESPHome component data flow before and after.
Instead, I could tell ESPHome to integrate the raw value without any averaging and throttle both the power and energy sensor updates to something reasonable. I marked the raw sensors as internal: true, then used the copy component to send the power updates every 3s - 60s. Three seconds ensures we don’t send updates too quickly, and between 3s and 60s if the power fluctuates by >10W, then it’ll send an update, and if not it sends an updates max every 60s. This configuration provides a nice trade-off so constant, lower power devices don’t send a lot of updates.
The energy component takes the raw value and performs the integration, then sends it every 60s since there’s very little value in sending more frequently.
The following snippet shows how a single circuit is represented in the template:
|
|
Voltage Calibration
Each phase has a voltage calibration constant value that influences how the Vue2 measures the voltage. I don’t know how this influences the current or power sensors, but let’s get it calibrated just to be sure.
Using a volt meter, I initially tried to measure the voltage of each phase inside the breaker box connecting the negative to the neutral bar and positive to each phase main line, however the measured voltage fluctuated depending on whether the panel was open or closed. Opened when I measured it, the volt meter agreed with what was in HA, but then I closed the panel and it’d deviate. Notice the first two blue lines in the figure above. I don’t know what could cause this.
After that, I instead measured the voltage from two outlets on each phase without the panel being open. I used the formula as mentioned in the template for each phase:
|
|
I plugged in my values and get this:
Then plugged both values into the template and redeployed:
|
|
After that the measured voltages seemed to align with my volt meter and converged together (not that both phases need to match.)
Comparison with Electric Provider
Next up, it’s time to compare it with my utility provider. This should match as close as possible so ensure that the numbers I show in Home Assistant are actually reflective of reality. My provider shows a daily energy breakdown in my account page (though they round the numbers and I had to use the browser dev tools to see the raw numbers.)
Overall pretty close with a difference of -8.26kWh over the last 30 days and ~2.8%. Not perfect, but I’ll continue to monitor and look for opportunities to improve accuracy.
Conclusion
In this post, I walked through how to use the Emporia Vue2 to monitor my whole home’s energy usage, some different strategies to improve accuracy and reduce MQTT traffic.