My mqtt feed is UTC as well, so one hour behind the current summer time. It means you are experiencing the same issue as @glitter-ball . I suggest you try using the lifetime entity as he has sugested as see how that goes.
Unfortunately there is nothing i can do with code, apart from a specific hack for your use case.
You are missing the key for that value_template: > Add that in and indent everything based on that. You can see even in the preview in your developer tab that it does not have a key and is badly indented
Apologies, havent paid attention to what you are doing. You dont need the value_template instead you need a state property as you are not creating a template sensor.
To be honest I doubt it can be considered reliable as even restarting HA during the time when tariff changes will force that consumption chunk to be charged at incorrect unit price. It is a fun experiment though.
Is it the older FIT scheme where you are not ‘paid’ for export ( You just get half the generation ).
Or the newer SEG scheme ?
From what I understand the problem is with the provider setting up the meter for the export data. If you are on the FIT ( as I am ). The provider has no interest in accessing this export data so does not turn it on. Only if you are on SEG do they want the data and therefore enable it in the meter.
Just one more thing (for now :)) the below is working, however it is not rounding it to 2 decimal places so I am currently getting: 1.47407624 instead of 1.47 though clicking the graph does show it correctly?
My meter reset at the same time again for me (00:38). So 45 minutes will be fine and will allow for some natural clock creep. Also it wouldn’t really matter if the sensor only started to calculate around midday as it would still update the energy dashboard correctly when it eventually started to use the calculations. So you could just have a sensor with a really big offset (if you get a random reset time) that was purely used for the energy dashboard cost.
Could you please provide me the current value for:
Gas Import Standing Charge
Gas Import Unit Rate
Gas Cost Today
Gas Import Today (i know this is not the same entity used for the energy dashboard).
The gas import as shown on the energy dashboard
The gas price as shown on the energy dashboard
It should be whatever units used today as per energy dashboar * unit rate + standing charge = energy gas total which should be very similar to gas cost today. This is all correct at my end. If any of these entities are wrong, then the calculation will be wrong