Energy dashboard - tracking cost

I have a simple question. What is the “Use an entity tracking the total costs”?
I have a template sensor that calculates the monthly cost based on my utility meter but it doesn’t show up under this list. I searched for the details but couldn’t find it.
How can I use this? What is the criteria for this? I couldn’t use the current price or static price because my utility company uses a complicated calculation.

Did you try setting the device_class of the sensor to currency? Does the sensor have unit_of_measurement set to the desired currency? Did you configure the correct currency for your system?

I have set the device_class as monetary.
I didn’t know about the currency class.
Edit:
Just checked with device_class: currency
HA throws error with that configuration.
The unit is also correct.

Sorry, monetary is correct.

No one knows these requirements?

Can you show a screenshot of the entity and its attributes?

And is your systems currency set to TRY? If you go to the energy dashboard does it show 0 TRY as cost?

Yep, everything is working correctly on that front. It is just the cost tracking sensor is not present in the dropdown menu. I read somewhere here that you need the last_reset attribute for the kwh sensors but not much info regarding cost tracking.

I checked the code and as far as I can tell you are missing one or two things:

  1. The entity needs to be added to your recorder
  2. It needs to have the state_class set to total_increasing

I think this state class will come in the next release of HA. I am on 2021.8.8 right now and only “measurement” class is working.

I am also not sure regarding the difference between the two classes.

measurement The state represents a measurement in present time, not a historical aggregation such as statistics or a prediction of the future. Examples of what should be classified measurement are: current temperature, accumulated energy consumption, accumulated cost. Examples of what should not be classified as measurement: Forecasted temperature for tomorrow, yesterday’s energy consumption or anything else that doesn’t include the current measurement. For supported sensors, statistics of hourly min, max and average sensor readings or of the accumulated growth or decline of the sensor’s value since it was first added is updated hourly.
total_increasing The state represents a monotonically increasing total, e.g. an amount of consumed gas, water or energy. When supported, statistics of the accumulated growth of the sensor’s value since it was first added is updated hourly.

"accumulated energy consumption" is stated in the “measurement” class but it is also stated in the total_increasing class "amount of consumed gas, water or energy"

So, what to use?

With state_class: measurement this sensor did show up for me as selectable “entity which tracks total costs”

unit_of_measurement: €
friendly_name: Kosten Alle gesamt
icon: mdi:currency-eur
state_class: measurement
device_class: monetary
last_reset: '2021-06-04T00:00:00+00:00'

Hi, where should we put this configuration ?

For now, this is how I follow the daily cost with a template sensor.

- platform: template
  sensors:
    daily_cost_total:
      friendly_name: Daily cost
      device_class: monetary
      unit_of_measurement: 'EUR'
      value_template: "{{ states.sensor.atome_daily.attributes.price }}"

This configuration is refused by the “Energy Dashboard”. Do you have an idea to solve this ?

Thanks :wink:

1 Like

As far as I can see, no-one ansewewred this simple question. What is “Use an entity tracking the total costs”?

What can/ should i contain there? Fixed costs, I assume, but are they time based? Per hour? Per month? Per something else? Where is the definition and instructions? What are the “rules” using it and how is it handled in the cost structure especially in teh system that includes both kWh- and time based costs?

3 Likes