New sensor: Energy Dashboard and historic data

Hello.

I have a Shelly em3 running and sensoring the power for all 3 phases of the house (location Germany). I added these three sensors to the energy Dashboard and it is working fine for more than a year.

Now I want to get rid of the three phases and only have one single value here. Easy, I created a template sensor that’s sums up the three values.

Now I tried to get historical data for this sensor. Which I learned is not possible (or at least hard to achieve via sql queries)

Is there any way I can switch to using only this new template sensor without losing the old data? I don’t care if the past data in the dashboard still has the three different phases. But for future stuff I want to use the new template sensor.

The only solution I found so far is:

  1. Create three new helper for every phase
  2. Set value of the the helper sensors to the current value of the real meassuring sensors
  3. change the metadata_id in statistics and statistics_short_term for the old sensors to the new ones in sqllite

Then I should have all the data saved to the new helper sensor. And I can use those in the energy dashboard.
I won’t be able to do that until Sunday. If anybody has a better idea I’m open for it!