I added my energy sensors to the energy dashboard and the energy appears on the dashboard, very accurately and easy to read.
Now, i would like to add the cost for every energy source.
My utility company has different price tiers and I want to create an entity to calculate the current price depending on how many kWh I have consumed so far. Then use that entity here:
My understanding is that the entity I need should be a “helper” template and that it must be based on some other entity providing the consumed kWh. This is where I’m Stuck.
Ideally I want to use the entity that appears under the “energy sources” card. Below is mine for this month.
I want to use this instance because it is adjusted automatically when a different time range is used. For instance, this is the same source but with a time frame of “Today”.
What would be the “Entity ID” for these values?
If I go to the sources table and click on this instance, I found that the Entity ID for this sensor is “sensor,meter_electric” which is my RTLAMR2MQTT sensor.
OK, if I use that entity in my new helper-template to calculate the cost depending on the kWh, it will base that calculation on 26,447.30 which is the current reading on my utility meter, instead of using the accumulated energy for this period (6.86 kWh for TODAY or 349.63 for this MONTH).
So, how can I find the entity ID that home assistant uses to show the energy consumption in the “Energy Sources Table”.
Note, i have seen multiple people suggesting to create a “Utility meter” helper to keep track of the energy consumption and assign it a cycle of monthly, quarterly, daily, etc. Then use that instance as the base for the template-helper to calculate the $/kWh.
The problem with this approach is that it will accurately calculate the $/kWh only for that billing cycle and will be wrong for everything else.
For instance, if i create a Utility meter for the montly consumption, then it will base the calculation on 26,447.30. This may result in 0.12$/kWh. However, if i change my time range to “TODAY”, then the sources table will show a power consumption of 6.86 kWh which should use something like 0.15$/kWh but because i based its cost on a different instance that is monthly, then it will use 0.12$/kWh.
Because of this inaccuracy , I want to avoid using the “Utility meter” if possible.