Energy dashboard sensor value visualization mismatch

I have an issue with the data display of a sensor generated and used on the energy dashboard. The sensor value is correct and is also displayed correctly when clicked on. However, the energy dashboard ‘bar’ shows a different value.

In the highlighted example, the sensor test_prese_netto_forni_energy reads 3 kWh at 11:55 PM on September 22nd while, the energy dashboard displays 3.33 (the day had already ended; these screens were obtained on subsequent days).
The issue occurs consistently.

he sensor is generated from the difference of two other sensors as follows:

        - name: test_prese_netto_forni_energy
          unit_of_measurement: "kWh"
          device_class: energy
          state_class: total_increasing
          state: "{{ ((states('sensor.test_prese_energy') | float (0)) - (states('sensor.test_forni_energy') | float (0)))   | round (3) }}"
          availability: "{{ (states('sensor.test_prese_energy')| is_number ) and (states('sensor.test_forni_energy')| is_number )  }}"     

The ‘original’ sensors that I use to calculate the difference are these:

        - name: test_prese_energy
          unit_of_measurement: "kWh"
          device_class: energy
          state_class: total_increasing
          state: "{{ (states('sensor.emporiavue2_circuit_16_daily_energy') | float(0) / 1000 ) | round (3) }}"
          availability: "{{ (states('sensor.emporiavue2_circuit_16_daily_energy')| is_number ) }}" 
        - name: test_forni_energy
          unit_of_measurement: "kWh"
          device_class: energy
          state_class: total_increasing
          state: "{{ (states('sensor.emporiavue2_circuit_11_daily_energy') | float (0) / 1000 ) | round (3) }}"
          availability: "{{ (states('sensor.emporiavue2_circuit_11_daily_energy')| is_number ) }}" 

Since these are test sensors, I’ve tried modifying them, including changing the state class. However, the error consistently appears only on the sensor that calculates the difference between the two. So, the problem is definitely there, but I can’t figure out what it is. The sensor’s value is always correct, but the energy dashboard displays a different one. What could be causing this?

Thank you!

Any idea? I tried rebuilding the sensor from scratch, but with no luck.
The only thing that changes during the day is the delta between the sensors, even though, considering their actual values, the difference should remain constant