I have now posted my how-to guide to manipulate HA statistics and resolve spikes, data gaps and missing data like this in the Energy dashboard

I have created 6 different scenarios of loading Home Assistant history from different sources, and two for fixing data glitches:

  • Load statistics from entity state history
  • Load statistics from the GivEnergy portal data
  • Bulk load (multiple days) of statistics from the GivEnergy portal data
  • Load statistics from Octopus Energy import/export data
  • Move statistics from one entity to another
  • Move statistics from a ‘today’ entity to a ‘total’ entity
  • Resolve data glitches and spikes in statistics data
  • Resolving glitches in HA statistics data using DB Browser

https://community.home-assistant.io/t/loading-manipulating-recovering-and-moving-long-term-statistics-in-home-assistant/953802