How to backfill history of a newly created template sensor

So, a friend of mine realized they did need to use a template sensor to properly compute their PV production and use. They created the following template sensor:

{{ float(states('sensor.xyz_dc_current_2')) * float(states('sensor.zyz_dc_voltage_2')) }}

Data for those sensors goes back for the past year or so.

Is there a safe way to backfill the history of the template sensor, other than directly writing to the sqlite database?

Nope. There is not. You’re editing the dB if you want to modify history.

1 Like

There’s a custom integration that might help…