How do I obtain Energy Cost Information

Hello Guys,

Im looking to publish my monthly energy cost to a sensor that I can make use on a dashboard. I can’t seem to work out how I would do that?

Im hoping to obtain the highlighted figure from the energy dashboard for the active month. Could anyone confirm how I would achieve this?

Thanks

I think entities get created if you setup cost tracking in the grid consumption configuration:

I have 2 cost entities for peak and off-peak usage:

Try searching for “_cost” entities.

I use a dynamic sensor template to keep my tariffs always correct (I needed to for the complexity but like having just one anyway) and tied that to my energy dashboard:

sensor:
  - name: "Current Energy Tariff"
    unique_id: e3eb0f96-c83a-41d3-8a01-a6df38895301
    icon: mdi:currency-usd
    unit_of_measurement: "USD/kWh"
    state: >-
      {% set tariff = { "OFFPEAK": 0.11, "MIDPEAK": 0.19, "ONPEAK": 0.27 } %}
      {% set dow = now().strftime('%A') %}

      {% if dow == "Saturday" or dow == "Sunday" %}
        {{ tariff.OFFPEAK }}
      {% else %}
        {% if (now().hour >= 15) and (now().hour <= 19) %}
          {{ tariff.ONPEAK }}
        {% elif (now().hour >= 13) and (now().hour <= 15) %}
          {{ tariff.MIDPEAK }}
        {% else %}
          {{ tariff.OFFPEAK }}
        {% endif %}  
      {% endif %}