Utility Meter - manually enter current total value

I would really like to use all the new and old energy features of home assistant.

Unfortunately it is not trivial in my case to read out the energy meter automatically (multi-tenant home, meter is in the basement).

So until I find a solution, I would like to be my own sensor :grin: and read the total value of the meter manually in irregular intervals and enter it together with the time into home assistant.

Does anybody have any idea how to accomplish this while still using the utility-meter integration?

1 Like

There is a service you can use: SERVICE UTILITY_METER.CALIBRATE

See documentation: Utility Meter - Home Assistant

1 Like

So, what you are suggesting is that I just “calibrate” the utility-Meter whenever I take a reading?
That sound promising. I will give it a try.

Yes that’s it

I was hoping to be able to use this utility meter in the new energy-dashboard for “grid consumption”. However, it is not one of the selectable options.

Am I doing something wrong or is this just not possible at the moment?

It should be possible. On my HA I can select entities from utility_meter as grid consumption:

utility_meter:
  house_consumption_daily:
    source: sensor.shelly_em_energy
    cycle: daily

Damn, I can’t get this to show up.
I guess it’s because the base-sensor for the utility-meter is a template-sensor and template-sensors are not jet enabled for the energy-dashboard.
At least that is the only difference between your and my configuration that I could find.

Did you set:

unit_of_measurement: "kWh"
device_class: energy
state_class: measurement

to your template-sensor? assuming it is an energy sensor and not a power sensor

To be clear, this is just a dummy-sensor with no meaning and a constant value of “0”., as it is required as a base-sensor by the utility meter. I even switched to the new template-syntax (and did a restart of course):

template:
  - sensor:
      - name: home_energy
        unit_of_measurement: "kWh"
        device_class: energy
        state_class: measurement
        state: "{{0}}"
utility_meter:
  home_energy_monthly:
    source: sensor.home_energy
    cycle: monthly

Neither one shows in the grid-selector. Other ESPhome-based “TotalDailyEnergy”-sensors however do show.

And with:

state: "{{ 0|float }}"

I’m having this same issue. My energy monitor comes from smartmetertexas but I dont see the sensors available on this drop down. I’m curious what the difference in ‘modern’ vs ‘legacy’ format is. Can anyone help?

My apologies. I didn’t read your follow-up post carefully and jumped to a conclusion. I have deleted my, now useless, post.

You may need to also add the last_reset option (although it can only be currently added via a Customization because the option isn’t supported by a Template Sensor). Others have also reported that no value is displayed immediately and may require 1 to 2 hours.

The legacy style of defining a Template Sensor doesn’t support the state_class attribute which is needed for the Energy integration.

OK, but how does one define this in a ‘modern’ way that does? I currently have a yaml where several template sensors are defined.

Using the utility_meter solves the last_reset issue for template sensor as this integration has been updated to support it

That does what?

The documentation explains how to define a Template Sensor in the new (modern) way or you can use the example in seanomat’s post (above) as a guide.

How is utility_meter used? Is this an attribute that needs to be added to the template sensor?

I’ll give that a shot.

Thanks

Good point but I was listing what was needed for a Template Sensor alone (as has been done by others and posted throughout the two recent blog threads). Incorporating it with Utility Meter is a good tip.

Not an attribute but a separate integration.

1 Like