Utility meter calculation wrong

I have a problem with a utility meter sensor. I have a sensor which tracks the total electric energy consumption. This sensor is setup with “device_class: energy” and “state_class: total_increasing”. Based on this sensor, I setup a utility meter to track my daily electric energy consumption. This is defined as follows:

  source: sensor.stromverbrauch_gesamt
  cycle: daily

The problem now is, that the utility meter values are wrong. Last night at 0:00 am the sensor tracking my total consumption was at 285.98 kWh. Now, while I’m writing this post, the sensor shows a value of 311.42 kWh. However, the daily sensor which resets at 0:00 am currently shows a daily consumption of 21.58 kWh. How can this be? Isn’t it supposed to be 311.42 kWh - 285.98 kWh = 25.44 kWh?

To make things even more strange: I used the exact same total energy consumpion sensor for the Energy dashboard. And there the calculation is correct!

I have similar problem. My daily sensor.energy_usage is count correctly but utility meter made from it is showing much bigger values.

On the screenshot you can see that sensor.energy_used from midnight increase about 8 kWh, but on utility meter is 24,64 kWh.

    - name: "Zużycie prądu dom"
      unique_id: energy_used
      unit_of_measurement: 'kWh'
      state: >
        {% if states('sensor.total_yield') | float(0) > 14000 and state_attr('sensor.sun2000_8ktl_m0','grid_exported_energy') | float(0) > 0 and state_attr('sensor.sun2000_8ktl_m0','grid_accumulated_energy') | float(0) > 0 %}
        {{ '%0.2f' | format(states('sensor.total_yield') | float(0) - 
                            state_attr('sensor.sun2000_8ktl_m0','grid_exported_energy') | float(0) + 
                            state_attr('sensor.sun2000_8ktl_m0','grid_accumulated_energy') | float(0)) }}
        {% endif %}                    
      device_class: energy
      state_class: total_increasing
    source: sensor.energy_used
    cycle: daily

Edit. I think I found the problem, it’s in counting sensor.energy_used. There are 3 different values and sometimes this sensor are decreasing. I added in template:

- trigger:   
    - platform: state
        - sensor.total_yield
    - platform: state
      entity_id: sensor.sun2000_8ktl_m0
      attribute: grid_accumulated_energy    

and I hope it will solve the problem.

I have a similar Problem.
My sensor for the total energy consumption of the heatpump is ‘sensor.energymeter_waermepumpe_base’.
At 0:00 am it was 6401,66 kWh
At 8:00 pm it was 6414,23 kWh
So the difference is 12,57 kWh

The utility meter is defined with this config:

source: sensor.energymeter_waermepumpe_base
cycle: daily  

The value of the utility meter at 08:00 pm was 13,61 kWh.

I don’t understand why the calculation is incorrect.
There’s another thread with a similar issue: Utility meter wrong data?

I have the same problem. Any solution to this?
Just as for you @ffm777 , the calculation in the energy dashboard is correct, my understanding is that it might have to do with that the energy dashboard is using LTS data while the utility meter is using the actual sensor source value, but not sure…
Still don’t explain why the utility meter is wrong though…

Solved: Problem was that my energy meter went unavailable every 5th minute due to a poor connection. Fixing the connection problem also fixed the utility meter.