Editing previous energy usage statistics

I am looking for a way to automate updating my energy statistics for a device - once the data is available.

  • This is for my heat pump
  • I can track the status of the system live (idle, heating, heating water, etc)
  • So I have the option of creating a virtual energy use live (based on average or guesstimated wattage)
  • I am also tracking the total hours of water heating and heating each day
  • 1-2 days later, I get the total energy use for both heating and water heating
  • So calculating the average energy use in each of the states can then be done

But currently the only way I know of to edit previous energy stats is via Developer Tools > Statistics, which would of course be a massive manual process.

Is there a way to automatically, either:

  • Do the same as that tab - that is, find and update individual stats windows of energy use, or
  • Update the database directly

I am happy to do this programmatically, perhaps even creating a custom integration for it - but unfortunately I don’t have masses of time to get started if it’s not going to be possible.