Source of energy cost field

Hi !

Currently, my consumption data is retrieved from the API of my electricity provider via a HACS (Linky) add-on module. The most recent data retrieved is from the previous day.
The sensor selected for the consumed energy is a statistic (I can find the raw data retrieved in the ‘statistics’ table of the home-assistant_v2.db database).
Although I have selected an entity for the current price, no cost is displayed in my Energy dashboard. I imagine this is because the data comes from statistics and not from an entity.

Therefore, I would like to be able to modify the cost column of the energy dashboard but I do not know from which data source the value displayed in this column is retrieved.

Been a while since I first setup my Energy dashboard but I believe if you add a cost entity after setting up the the energy entities, the cost will only start accumulating from that point on. (ie updated every hour). So when an hourly check is made on the accumulated kWh for the last hour, … that kWh increment is multiplied by the cost entity and added to the cost accumulator.

If that makes sense ? :slight_smile:

First, thanks for your answer :slight_smile:

As I said, I don’t have an energy entity for my global energy consumption.
I have an add-on wich fetch energy consumption from the API of my energy provider.
Every morning, this add-on fetch data of previous day
What I get is a statistic and not an entity.

Here is an energy entity (e.g. my washing machine) → in STATE section

And here is what I get from the addon → in STATISTICS section

If I add my washing machine energy entity to the dashboard with a current price entity, I get a result in the cost field of the dashboard

I think cost tracking is made to work with energy entities, not with statistics.
So, what I’m trying to do is find how cost is calculated from thr energy data of an entity ; and with this information, maybe I would be able to create a script wich works with statistics data I get :roll_eyes:

Sorry I have no experience with using statistics in the way you are for the Energy dashboard. Im lucky to have energy feeds that I can use. :grinning:
I mentioned my memory / learning of when I first setup my Energy dashboard. And I’m fairly certain that the ‘cost’ is calculated / accumulated every hour by multiplying the energy used in the hour that just ended, by the Energy Cost Rate that is current at the time.
It is not that sophisticated to do more complex cost calculations like very frequently changing Electricity rates for example.
Anyway, good luck finding a solution for your use case.