UTILITY_METER.CALIBRATE not resetting to zero

Hi,

I’m trying to track how much energy the charging of my car took each night. Only the power is measured by my charger, so I created a utility meter based on the sensor I have available.

sensor:
  - platform: integration
    source: sensor.etrel_active_power_total
    name: E_last_session
    unit_prefix: k
    round: 2
utility_meter:
  energy:
    source: sensor.E_last_session
    name: total_energy_charging

I’ve made an automation to reset (service UTILITY_METER.CALIBRATE) the value to zero when a new charge cycle starts.

- alias: "Reset laadenergie"
  trigger:
  - platform: state
    entity_id:
      - sensor.etrel_status
    to: "Wacht op verbinden voertuig"
  condition: []
  action:
  - service: utility_meter.calibrate
    data:
      value: "0"
    target:
      entity_id: sensor.total_energy_charging

The automation is initiated as is should, but the utility meter is never reset to exactly zero, but to a (to me) random value.
Stangely. If I run the automation a second time manually, the utility meter IS set to exactly zero. See example below:

judging by the code (https://github.com/home-assistant/core/blob/c099ec19f22a19205f1268e3bd3e8b8887b1965e/homeassistant/components/utility_meter/sensor.py#L549), calibrate is just adjusting the value of state without last reset date or last reset period. I know utility meter heavily relies on last reset values to track the ongoing state so I would suggest you to use reset service rather than calibrate, it is working well in my case.

Hi, tried with the service utility_meter.reset but I’m getting similar results…