Utility meter initial daily value issue

Can any gurus help me solve a problem I’m having with utility meters?

My sensors initial value is not 0 so the entire daily utility meter is wrong and offset by the initial value.

yellow line is the sensor and the blue line is the daily utility meter

Anyway to account for this so the daily utility meter matches the sensor value?

Utility meters reset to zero and only count changes (from valid states) so what you are seeing is expected and correct. It is showing the daily energy use.

Utility meters are counters, and will add to a running total all positive changes in the source sensor. They ignore negative changes, as they assume that these are just due to replacement meter resets.

With the optional day / month reset, Home Assistant also resets the counter just after midnight.

This works nicely, except when using a similar “daily” source sensor, which is itself reset every day by the inverter or EV charger. The problem being seen when the souce resets at a different time to HA.

Here, your EV sensor is resetting, but apparently does so not to zero at midnight, but to the already-used value at the first update after midnight. This confuses the HA UM, since the first value at reset (and not 0) is taken as the baseline. This is what Utility Meters should do, so the problem comes from the EV sensor behaviour.

If indeed your EV reported first value of the day at reset is the first period energy value, then a simple answer is to use a “Total Ever” sensor as the source. In general, a non-resetting total-used-ever sensor is the better one to use as this will only ever increase, and HA can manage the daily reset at midnight for you.

If, however, you only have the daily sensor, and it is not self-reset to zero at midnight, then I think that the only answer is to write an automation to sum any positive change, and also at any change that drops in value to add the drop-to value only.

Of course, if you are really just trying to turn a daily meter value into a daily meter value, then there seems little point as you already have a daily UM, just perhaps one that does not reset to zero at midnight.

If it always resets at 4pm you could use the calibrate action:

triggers:
  - trigger: time
    at: "16:05"
actions:
  - action: utility_meter.calibrate
    target:
      entity_id: sensor.your_daily_utility_meter_here
    data:
      value: "{{ states('sensor.your_energy_added_sensor_here') }}"