Utility Meter: Reset service seems not be working

I have setup a utility meter that has the cycle set to yearly but I plan to reset it manually using the reset service every 2 months since there is no such an option in the component. When I do execute the service using the UI by calling utility_meter.reset with the entity set to utility_meter.energy_yearly I do not see this log (debug is enabled): core/homeassistant/components/utility_meter/sensor.py at 1d5ffe9ad5d4a0a918cce33d338419962ac21545 · home-assistant/core · GitHub and the sensor does not go back to 0

The docs state the the entity should be:

Name(s) of the utility meter to reset example: utility_meter.energy

But there is no such an entity for the utility meter except the sensor (sensor.energy_yearly). I have also tried using the sensor without much luck

Config:

utility_meter:
energy_yearly:
source: sensor.powermeter
cycle: yearly

1 Like

The problem seems to be a bug in the code since its mixing the tariff with the reset feature: https://github.com/home-assistant/home-assistant/blob/1d5ffe9ad5d4a0a918cce33d338419962ac21545/homeassistant/components/utility_meter/sensor.py#L149

Adding one tariff in the list will create the proper entity and then the service will work

1 Like

Hi!

The service was never meant to be available without tariffs. But your solution to add a single tariff is spot on! Good work

1 Like

I didnt get this, is it possible to use the utility_meter.reset as a service? I cant even list it under services in my 0.92.2

1 Like

only if you have tariffs setup

1 Like

Hi, I have tried to calibrate my utility meter and here is the result:

image

Also, at some point I changed the “last reset” timestamp to year 2010 instead of 2020, and now it is impossible to change it again.

I tried incorporating one tariff and calling the reset service, with no luck.

Is there any way to completely erase the history of a meter? Thanks!!

PS: Maybe related, the entity appears as sensor.produccion_solar_mensual instead of the expected utility_meter.produccion_solar_mensual. My setup configuration is exactly as in the example.

please make sure to calibrate using the value between “”

like:

value: "5.51"

You always calibrate the sensors generated by the utility_meter, never the utility_meter itself, so that part is all good!

1 Like

Ahh, that did the trick! Thank you!! ^^

I just stumbled across this thread while debugging my utility_meter reset problems.

@dgomes your statement doesn’t make any sense. The utility meter definitions will still reset themselves automatically based on the cycle definitions (daily, monthly, etc.) so why should the tariffs definitions be required in order to use a service to reset them manually? Furthermore, I don’t have any tariffs on things I want to wrap with utility_meter, like bit/byte rates, water flow rates, energy consumption/generation rates, etc.

The reset service is attached to the tariff sensors entities and not to the utility meter entity, that is why it doesn’t work without tariffs. It is a legacy of the original utility_meter purpose (energy_meter).

Since then you have the calibrate service which should cover your use case.

Bu utility_meter.calibrate service also does work only for sensors with tarrifs.
Moreover, when You use the work-around and put one tarrif, it is added this tarrif name at the end of entity_id, what is probably logical but not changeable without template sensor, so… a not very user friendly.

Isn’t there possibility to polish that great integration a little bit?