hmmmm thanks for cconfirming. I was turning my head around it. Maybe we should log a bug for this?
I think this is the closest.
Did you pick up any movement on this?
No there has been no acknowledgement this is an issue?
@frenck there is a breaking change with the gas consumption dashboard with 2022.11 could I ask someone to have a look at this?
I fully agree with @Brad_Ford. It doesn’t have to be complex.
To able to track individual costs we first need to be able to set the cost for using self-produced energy, and/or the cost of using battery stored energy. As @rct is pointing out, it is not free from costs. With this information we always know what every kWh costs, and you can easily calculate what every device cost.
In my opinion it can not be more correct than this!
I do this today with the help of template sensors and the attribute last_period. The cost for using self-produced energy is set to the “write-off” for the equipment or the compensation for energy returned to the grid if that is greater. If I had a battery I would have set the cost for using energy from that to the write-of costs plus the cost of the the energy that I charged it with. This would be a little bit harder, because we would have to store the cost for charging, and then use that when consuming the energy. But it is far from complex. There is always, at any given time, an accumulated cost for the energy stored in the battery.
100 W costs nothing (0.1 kW x 0 s = 0 kWh). 0.1 kWh costs something, we just need to give the user a change to tell HA how much it costs.
It cost X times the cost per kWh.
Looking at my formula above, I treat this slightly differently, using the “write-off” is an sensible approach, “write-off” costs is around 3¢/ kWh. But I haven’t considered.
I treat the consumption of of energy from my solar or battery as the same as my feed-in price, as I alternatively could of exported that energy to the grid at that instant.
Currently my feed-in price is $0.02/ kWh and the house is consuming just under 2 kWh. So at this instant the house consumption rate is $0.04/ hr.
For energy I consume from the grid, I calculate my grid consumption cost at the general rate, which is currently $0.10/ kWh, I’m currently consuming 14W from the grid so that consumption rate rounds out to $0.00/hr
My overall household consumption cost rate is those two consumption rates added $0.04/ hr + $0.00/ hr = $0.04/ hr, which when divided by my overall consumption of just under 2 kW works out to be $0.02/ kWh. (Nb the total W don’t add up as I did my screenshot moments apart, but you should get the idea.
This means for any instant, I know what the consumption cost is and this can be applied to any appliance and takes into account the mixing of energy sources for solar PV, Battery and Grid.
If I had a battery I would have set the cost for using energy from that to the write-of costs plus the cost of the the energy that I charged it with. This would be a little bit harder, because we would have to store the cost for charging, and then use that when consuming the energy.
I found it very complex to calculate the cost of energy stored in the battery so you will see it doesn’t feature above, but you are correct it needs to be accounted for. I also haven’t accounted for SOLAR PV that wasn’t instantly consumed so I have created some additional counters for Solar Savings and Battery Savings.
My solar savings rate is:
+ solar2house * general_rate
+ solar2grid * feedIn_rate
+ solar2batt * feedin_rate
My battery savings rate is:
+ batt2house * general_rate
+ batt2grid * feedin_rate
- solar2batt * feedin_rate
- grid2batt * general_rate
This is an elegant solution as it treats solar2grid as a solar savings but a battery cost at the same time.
Which I can calculate and graph over time.
If would be great if I could get some validation from others that this produces sensible results for other use cases.