Energy Dashboard - How HA should keep track of the costs

Hello fellow HA users,

I have some questions about how to configure the energy cost tracking and I’m struggling a bit with it. Hoping you guys can shed some light (pun intended) and expertise on the subject.
I have read several topics and read thoroughly the Utility Meter section on the docs. But I’m not figuring how to create a Helper (?) tracking the correct value.

Setup is as follows:

I currently have 5 energy metering devices and they are all at the main circuits board right before the breakers:

  • 1 for the lights
  • 1 for the outlets
  • 1 for the entertainment center
  • 1 for the IT cabinet
  • 1 for the Kitchen

So the total energy consumed is the sum of these five. However I still pay a daily value for my contract. So my energy bill is twofold:

  • one part fixed - fixed price per day for the contract
  • one part variable - consumption in kWh

When I’m at the Energy panel and configuring the grid consumption, I select the consumed energy sensor.
Then I have 4 options:

  • Do not track costs
  • Use an entity tracking the total costs
  • Use an entity with current price
  • Use a static price

So I believe I would go and select an entity tracking the total costs, but what entity is this?
And how to create an entity - or an helper? I got this doubt from reading the utility meter documentation, to charge a daily price of 0,332 and a kWh price of 0,1625?

ok, so add them up altogether so you can have a daily counter looking like this (this is defined directly in sensors.yaml, not using a helper)

  sensors:
   daily_run_estimate_cost:
    friendly_name: "Daily Cost Estimate"
    value_template: {{(states ( 'sensor.daily_production_kwh' )|float * 0.1625 | float + 0.332) | round(2)}}
    unit_of_measurement: "XYZ"

you can check the template construct in Developer tools to address the proper multiplication and addition. I’m guessing it would even be possible to add multiple sensors in one line, but for the sake of example it’s just one there… ( I also rounded the number to 2 decimal points as you see)

This would give you daily estimates in currency of your choice (XYZ).

For monthly estimate you could use monthly reset utility meter that could aggregate daily usage of kWh from all meters, then create a sensor in a similar fashion, that would do the math based on total_kWh * 0.1625 + 10.29 (it does not really matter if it’s 10.29 or 9,96 as you will never reach the level of precision that aligns with your provider’s).

Hi there @hadxb11 thank you for your reply.

So by now I’ve been able to create a sensor that aggregates the consumption from the five using a template.
I’ve struggled a bit as there are so many examples of configurations here, but from what I was able to understand there have been changes to the templates so there’s an old syntax and new syntax. Apparently also the value_template is now state for example. Anyway this is the sensor I created:

- sensor:
  - name: consumo_energia
    # name: "Consumo Energia" 
    unit_of_measurement: kWh
    device_class: power
    state_class: total_increasing
    state: >-
      {% if is_number(states('sensor.output_iluminacao_energy')) and is_number(states('sensor.output_tomadas_energy')) and is_number(states('sensor.output_media_center_energy')) and is_number(states('sensor.output_bastidor_energy')) and is_number(states('sensor.output_cozinha_energy')) %}
        {{ states('sensor.output_iluminacao_energy') | float + states('sensor.output_tomadas_energy') | float  + states('sensor.output_media_center_energy') | float + states('sensor.output_bastidor_energy') | float + states('sensor.output_cozinha_energy') | float}}
      {% else %}
        None
      {% endif %}

Now I’m going for the utility meters and the costs. I’ve gone through a shitload of topics here, many configurations are outdated but there are some good approaches on the subject.