Creating a cost sensor for a utility meter with variable rate

I have a sensor that calculates the cost of my electricity since the beginning of the year based on a fixed unit rate

      yearly_cost_variable:
       value_template: "{{ (0.3404 * states('sensor.yearly_inverter_energy')|float)|round(2)}}"
       unit_of_measurement: '£'

I probably shouldn’t have set the unit rate as a fixed value; the rate will change tomorrow, so if I change that it will update the total cost as if the whole year was at that rate
What’s the best way to solve this?