Utility Meter unit of measurement

I have question in regards to the utility meter and units of measurement, I have connected power meter to Home assistant where I get my power consumption readings from, these are in kWh, I use the utility meter to calculate daily and monthly power consumption, but for some reason the unit of measurement are in W.

I also tried to use the utility meter to calculate daily driving distance from my cars Odometer, the daily driving distance was reported in Km.

It seems as if the utility meter is adopting the input sensors unit of measure, so how come daily and monthly power consumption is converted to be W and not kWh? Is there a way to change the unit of measure in the utility meter configuration or do I need to crate an additional sensor just to have the correct unit of measurement?

Many thanks.

If I look at my config it looks like it uses the source unit of measurement which makes sense. I have an intermediary one where I set the unit of measurement so it works fine for me. Since it doesnā€™t look like the utlity_meter components supports changing the unit you could just have an interim one.

sensor:
- platform: template
  sensors:
    meter_kwh:
      value_template: "{{  states('sensor.powersensor')|int }}"
      unit_of_measurement: kWh

Hereā€™s mine which also converts from watt seconds to kWh.

    power_furnace_kwh:
      friendly_name: 'Furnace kWh'
      unit_of_measurement: kWh
      value_template: "{{ state_attr('sensor.power_furnace', 'watt_seconds') * 0.00000028 }}"
1 Like

Thank you for responding, I created a new utility_meter using the same power sensor so I could play around with it, the thing is, this new daily measurement got the correct unit of measurement. I just renamed the daily and monthly measurement that showed the wrong units and after that they was showing kWh.

Hi. I came looking for this same issue (W instead of kWh).
I did almost the same thing and created a second utility_meter with the name ā€œenergy_useā€ instead of ā€œenergy_usageā€, which reset it and now has the right unit.
(I initially tried just commenting out the sensors and utility_meter then restarting, then putting it back, but it didnā€™t work.)

@lindsayward - What exactly did you do to fix it? Just rename the sensors (the utility meters or energy meters) and restart HA?

Yes. The issue was some kind of cache where HA remembered what I had previously set for these sensors and would not accept my change, so creating new ones meant I could set what I wanted the ā€œfirstā€ time.

Thanks. I found the cache and was able to delete the old device.

1 Like

If anyone is curious about how to delete the old devicesā€¦

1 Like

Hi and thank you for the tip.
I had the same problem.
I just edited core.restore_state changing W to kWh where needed, saved, rebooted and my sensor got updated without removing/readding them :wink:

1 Like

hello, sorry if I ask you could you post the script of how do you detect the daily measurement of the kilometers traveled by car?
I can only make the historical graph but not have the day by day count, can you help me?
Thank you

type: history-graph
entities:

  • entity: sensor.mileage
    refresh_interval: 0
    title: Contachilometri
    hours_to_show: 72