Problem with utility meter template (for Emporia Vue data)

Hi all,

Relatively new to HA but learning quickly and experimenting.

Have an Emporia Vue system and the integration brings in three entities for each circuit in my panel: an hourly power average (kW), a daily energy value (kWh), and a monthly energy value (kWh).

It also brings in the same values as totals for the panels on which they are installed. I have two panels, and the one thing the Emporia app can’t do, is it can’t combine data to get a total power reading summed from both panels, which is one of the opportunities I see for HA.

In order to effectively use the data from the Emporia entities to graph hourly, daily, and weekly values, I found that I needed to create a Utility Meter Template to have a continuously increasing total for the entities.

I created the Utility Meter Template using the daily entities from Emporia. I set them up as “always available” and “periodically resetting” because each day at midnight the daily numbers reset to 0. I figured this selection is how you tell the template to ignore the 0 and continue accumulating as the input continues to increase.

This worked perfectly for 5 days, and then a glitch in the matrix last night at midnight. Right at 12:06am, the total value jumped instantaneously by 100kWh.

It’s definitely not a real shift in energy use, but I can’t tell what caused it. When I review the Emporia data in their app, all looks good.

Can anyone help with troubleshooting the issue? Possibly something in my setup? Nothing was changed yesterday, so I’m not sure what it could have been.

Thanks!

Can you share the history graph for the source sensor the utility meter uses for the same time period?

More than likely it’s an erroneous report by the vue hardware. Would need to see the history of the energy sensors for those time frames to be certain.

Yes, clearly an issue with the source data (why didn’t I think to check that? :slight_smile: ), but I’m not sure what happened or if that can be corrected within my template…

Just posted, thanks.

Please share the template you are using.

Likely needs this: Why an availability template is important for energy template sensors

Just using the UI utility meter template. I need to get schooled on how to code a template I guess…

If the source data drops to an actual 0 twice, is that an availability issue, and would it be captured by the availability template?

Ok that is not a template, it is integration configuration. Nothing you can do there is going to fix your source sensor.

Does the source sensor use jinja templates or does it come directly from the Emporia Vue integration?

Sorry, I guess it’s technically a helper. The template I have is the one that sums the two panel helpers.

Panel 1 helper (continuous total for Panel 1)
Panel 2 helper (continuous total for Panel 2)
Total template = Panel 1 + Panel 2

The source sensor comes from the Vue integration.

Interesting, I thought the helper would implicitly use availability. So if either source sensor is unavailable the helper should be unavailable, not zero (which is what caused your issue).

Can you show the history for those two sensors over the same time period (or even zoomed in a bit to where the glitch happened).

I know that some of the helpers, whether the ones for Panel 1, 2, or the sum, had sensor availability options. I can’t remember what I selected for them; and unfortunately for some reason I can’t find those settings in the existing helpers, would need to create new ones.

Vue sensor for Panel 1:

Vue sensor for Panel 2:

Totalized Utility Meter helper for Panel 1:

Totalized Utility Meter for Panel 2:

Template for combination of the totalized Panel 1 and 2:

Finally, the daily meter which takes the combined total and resets it daily:

Sorry, as a novice I’ve probably got my terminology all wrong for the different items. I certainly need to take some steps to improve my device/sensor/entity/helper names as even I get confused when I go back to look at them.

I have seen a similar issue with my Emporia Vue as well. In my case, it happened after a very short power outage. Energy went to 0 briefly, then reverted back to its previous value, causing the energy dashboard to report a doubling of energy in that short time window.

Here’s something that might help going forward: use ESPHome instead of the Emporia app. Depending on your hardware version, flashing the device is fairly straightforward. I actually had this happen when using ESPHome, before I read some discussions from others having the same issue, and finding the fix. The fix (which is now documented in the project README) is to add restore: false to each platform: total_daily_energy sensor.

In terms of correcting the issue, I’m not sure how the Emporia integration defines these entities, but for me, the total daily energy sensors have state_class: total_increasing (you can find this in Developer tools -> States), so I can go into Developer tools -> Statistics and adjust the sum, effectively erasing the false step up to the previous value.

Unfortunately availability is not going to help. Those sensors went to zero instead of unavailable.

Your options:

  1. ESPHome as mentioned by mwaterbu above (I know nothing about this particular device ESPHome firmware).

  2. If it is caused by power outages, a small UPS or DC UPS. My IoTaWatt energy meter needs this to prevent glitches during power loss. See IoTaWatt Discussion - #71 by tom_l

Nothing in the Utility meter setup can prevent this occurring and filtering your sensors to reject 0 values is not possible as they legitimately reset to 0 periodically.

So the Vue sensor is a daily number, which will reset to 0 each night. It almost looks like it reset, then came back up, then reset again. The purpose of the totalized meters was to just continue the totalization after the reset. I believe I set them up to recognize that the sensors would zero out periodically.

It’s not the resetting to zero that is the issue. It is the return to the total value from zero. All of that is added to your total.

The utility meter operates like this:

0 to some value → Add some value to the Utility meter total
unavailable to some value → do nothing.

I have a hunch which I’ll need about 28 more days to prove… the day of the month where this glitch happened is the day of the month I have the Emporia Vue set to reset my monthly usage information (for cost/bill tracking). The Vue sensor I use is the daily value, and it may just be coincidental that the issue occurred on the monthly reset day, but if it’s fine until the 21st of next month, I’ll have some more confidence this is where the issue is coming from.