After some direction on a utility meter for PEAK and OFFPEAK time of use power

I just got time of use so power between midnight and 6 is a flat rate of 8c.
The rest of the time it is 32.197 cents.

I have a few things on my dashboard that were calculating daily cost, weekly cost, monthly cost etc for the power.

Now I have to re-engineer these a bit, or delete them and just us the built in energy graph I guess - which I may do if this is all too hard.

I found a nice snippit of yaml to set sensor for the current cost (Current Electricity Tariff Cost) based on the time of day -

  - name: "Current Electricity Tariff"
    unique_id: Current Electricity Tariff
    state: "{{ 'peak' if today_at('06:00') < now() < today_at('23:59') else 'offpeak' }}"

  - name: "Current Electricity Tariff Cost"
    unique_id: "Current Electricity Tariff Cost"
    unit_of_measurement:  AUD/kWh
    state: >
      {% set tariff = { "peak": 0.32197, "offpeak": 0.08 } %}
      {% if now().hour <6 %} 
        {{ tariff.offpeak }}
      {% else %}
        {{ tariff.peak }}
      {% endif %} 

But I have no idea how to build this in for my other things I have on the dash, I have a few but lets concentrate on just one, then I can retrofit the others from it if anyone can help -

I have a utility meter (created in helper) called ‘Daily Imported’. It is using ‘Energy Imported’ as the input sensor and is set to reset daily. I have looked at creating a new one to replace this and the tariffs seem to be the way to go for this.

Unfortunately, I had a stroke some time back and I am not quite getting the process here to use these tariffs. Do they in some way reference the ‘peak’ and ‘offpeak’ I setup in the above yaml ?

Thanks.

I think I have it now.
My yaml edits for “Current Electricity Tariff” and “Current Electricity Tariff Cost” are JUST for the energy dashboard calculations.

Then the new energy meters, with peak and offpeak create their own tarrif sensor, which i update with an automation. Then add some new yaml calculations based on the two prices to get a price for peak and a price for offpeak - they add those for a total daily, weekly, monthly etc etc…

In summary - they are for two different things but I was thinking they could be used in some way.