Custom entity to track costs

I have a sensor in HA that tells me when my heater for the pool is actively heating. I would like to track the costs associated with it actively heating on a daily/weekly/monthly basis. Has anyone done this before?

Anyone done this before?