Cost out energy Usage

Hi all,

I have curerntly my HA install tracking live grid pull and solar generation/usage fine. What I want to do now is track how much I am spending each day on Imported Electricity.

Currently, I have a sensor that tracks live energy from the grid in W from my Lux integration. I thought it would be a simple task to convert the W into Kwh and then cost out my usage based on the following:

00:00 to 05:00 @ 0.05p per Kwh
05:01 to 23:59 @ 0.24p per Kwh

Then from this get a breakdown of total cost from 00:00 to 05:00 and the same fo 05:01 to 23:59 then simply add the 2 together to get the daily cost

Well so far I have been looking at this problem for about 7 days now and I have gotten nowhere. The more I read into this the more I get lost and now I am beginning to think that this is not possible in HA yet.

So I am reaching out to the hive mind of the HA community to confirm if this should be possible and if can anyone point me in the right direction. All the articles I have read so far either don’t explain thing simply or just assume you have a degree in HA already! Yes, I am still a noob in HA as I have only been running this for about 6 months!

Thanks

I have been at this again today and after searching google for all kinds of permeations of what I might need I think this is what I will need to implement:

An automation that will trigger at 05:00 & 23:59 every day
automations.yaml

alias: read power draw at 05:00
description: ''
mode: single
trigger:
  - platform: time
      at:
        - "05:00:00"

Also

alias: read power draw at 23:59
description: ''
mode: single
trigger:
  - platform: time
      at:
        - "23:59:00"

Then I am not sure how to write the rest:
It will read the state from my entity at that time
store that number in a string as it contains xx.xx values in Kwh
then to pull that stored data into a chart or something to see historical data as well as just the data from today with a cost associated to each value

I have managed to figure this out, and I now how 2 charts tracking my peak and off-peak daily usage in Kwh and £. I also have another chart tracking my monthly peak and off-peak usage in Kwh and £. Checked the stats against my Lux Power inverter and the figures match up. Happy days