Lost per day consumption after Tasmota downtime

Hi,

I have a tasmota reading my total_in / total_out / current_consumption like this:

With a little extra config in configuration.yaml the sensors can be added to the energy dashboard, all fine:

homeassistant:
  customize: !include customize.yaml
  customize_glob:
    sensor.tasmota_sml_total_out:
      unit_of_measurement: "kWh"   
      device_class: energy
      state_class: total_increasing
      last_reset: 1970-01-01T00:00:00+00:00
    sensor.tasmota_sml_total_in:
      unit_of_measurement: "kWh"   
      device_class: energy
      state_class: total_increasing
      last_reset: 1970-01-01T00:00:00+00:00
    sensor.tasmota_sml_power_cur:
      unit_of_measurement: "W"   
      device_class: energy
      state_class: total
      last_reset: 1970-01-01T00:00:00+00:00

The energy dashboard showed consumption spread on a daily / weekly / monthly basis.

Now tasmota IR Reader had a power outage (as I tried to use a power-bank for it and apparently the power bank shuts off after a couple of hours automatically) and now the data is all gone. The energy dashboard now looks like this:

I guess this is as the data about “when the totals were measured” got lost.

Question 1: as Tasmota feeds the data to mqtt and this is persistent , what data did I use to show in the dashboard?

Question 2: how can I avoid this in the future? Do I somehow read the date directly from mqtt in the energy dashboard? How would I do that ?

Thank you

Found a way to fix the issue but not the root cause. After the long period of no data (couple of hours) there was one dataset with the overall amount of kwh. For the other datasets in the past it only shows the delta.

To change this “faulty” dataset, just go to Developer Tools → Statistics → Filter for your Sensor and adjust the faulty dataset with this button to the right of the sensor (choose date & time of faulty dataset, put in a new value, done): image