How can I correct this problem in the ploting?

Hi all,

I would like to graph the Energy consumption for my Shelly products, the problem I am facing is that with every System reset or Shelly firmware update the KWh consumption is reset to zero (see in the attached picture). Is there a way to resolve this issue?

Any help/tips would be appreciated.