Energy: Cost for the individual devices

Hi Mark, I am 2 weeks into homeassistant and really enjoying it. I am trying to replace what you have done here. How are you getting this view?

The view I have is as per the attached.

Thanks in advance.

That view looks like you have the devices setup correctly which is usually the hardest part, well done.

Is this your own custom view, or the default energy dashboard?

Do you have measurements for total house consumption from the grid and have you included those values on the energy dashboard?

Can you show your energy dashboard configuration page?

Hi Mark, thanks for responding so promptly.

I am using the default energy dashboard.

I use Amber Electricity which has a variable rate for power based on current wholesale market spot pricing. The API to HomeAssistant only provides the following inputs:

  • General Forecast (Predicted kWh price per hour)
  • General Price (Current kWh price per hour)
  • General Price Descriptor (String detailing current price “normal, low, etc”)
  • Price Spike (off/on - flags when price is spiking across the network and spot price is increasing or expected to increase)
  • Renewables (percentage of renewable power currently in the grid)

Unfortunately the integration doesn’t provide the daily usage / cost into HomeAssistant, even though it is in the API from Amber. So I can’t add the grid consumption to the energy config page. (see attached screenshot)

I have also played around with using a custom sensor to create a dashboard calculating the cost per hour/day for an appliance (in this case my Synology), however I am not sure if I am heading in the right direction. (Ignore the formatting in the 2nd screenshot - I am just playing with the function not the form). I really like your view where at a glance you can see what is using power for the day.

Thanks again for taking the time to take a look.

1 Like

I’m with Amber as well so we should be able to get this working.

You should probably add the cost of energy to each of the devices under the ‘Gas Consumption’ board like this:

Using the Amber General Price is a good starting point for each appliance, if you have solar or battery there are other prices you can calculate, but this is a good start.

You may also need to include a sensor which measures your grid consumption energy (kWh) and maybe your Solar if you have that as well.

Let me know how you get on.

Hi Mark, I tested putting one of the devices that appears in the list of options for “Grid Consumption”. (See attached). This immediately then gave me the same view as yours (see attached).

So it looks like the energy dashboard requires a “total consumption” to display the sources view with the costs.

So I now need to get the daily consumption into HomeAssistant. I don’t have physical access to my smart meter as I am in an apartment. So I just need to work out how I get the total consumption into HomeAssistant.

Thanks for your help with this.

Is there any way to know if any work is beeing done regarding this feature request, or even if it is planned for any future release?

2 Likes

I guess you can ask around in the dev discord for energy, but I haven’t seen any movement there. It is a shame, but I guess all focus is on “voice” currently. Would be great to see some updates on this part indeed as well.

2 Likes

I second the shame on development having moved to voice, leaving a half-done big feature on the floor. This energy dashboard needs some extra love, specially given this is one of the most voted features of the forum!

And it seems the gas workaround doesn’t work anymore for many moons - last hacktoberfest people fixed the ability to add energy devices to the gas list lol

1 Like

Using ‘gas’ consumption workaround dashboard does work, you just cannot mix energy and volume on the same dashboard.

Yes, it would be nice to get this development included in main.

1 Like

I have been trying to use this Gas for temporary solution to calculate Wall Charger costs.

I am using Nordpool to get data for energy prices.
This works fine because I use this same to calculate my monthly energy costs.

# Nordpool
sensor:
  - platform: nordpool
    region: "FI"
    price_in_cents: true
    precision: 2
    VAT: False
    additional_costs: "{{(current_price * 0.24) + 0.0040}}"

Then I convert this to EUR/kWh

# Nordpool EUR/kWh
template:
  - sensor:
      - name: "Nordpool EUR/kWh"
        unique_id: "sensor.nordpool_eur_kwh"
        unit_of_measurement: "€/kWh"
        state: "{{ (states('sensor.nordpool_kwh_fi_eur_2_10_0') | float(0) / 100) | round(4) }}"

Then I made utility meter for daily energy.

# Wall Connector Utility Meter
utility_meter:
  wall_charger_daily:
    unique_id: "sensor.wall_charger_daily_energy"
    source: sensor.tesla_wall_connector_energy
    cycle: daily

Everything these are working fine.

Then I go to Energy Dashboard and add this Utility meter to gas. I can see there correct values.

And on Energy I can see used energy but this is not some reason calculating costs.

I tested to use static price 0.0025 but this calculated costs very wrong. So I am not sure what I am doing wrong.

Any tips?

it is about half a year that i visited this toppic,
is this already on the road map?
the hack with gas prices isn’t an option for me. since i use that for… gas consumption.

I have not seen it anywhere. Still using the “gas consumption” for individual devices. It is a shame they did not created a seperate section for this in the dashboard, or change the " individual devices " section a bit . For Gas I just use the history explorer card.


1 Like

i dont understand why this is no prio…
i just want to know what stuff would cost, even if they dont cost when solar is on its still what they would have costed without it that is important.

3 Likes

+1 for this feature
Also adding the montly subscription option to calculate the total costs/

1 Like

+1
We really need this.

1 Like

+1 from my side as well

This would be a very nice feature! +1

If I sum up feature requests related to this topic, they would be:

  • Add a Helper that -given two entities (one holding some type of consumption or production total, f.e. kWh plus another holding the current price per unit f.e. EUR/kWh)- keeps a running total of said price multiplied by the latest difference in the total. This helper enables us to keep track of costs and/or compensations of any sensor that has a state_class: total or state_class: total_increasing.

  • Add to the Energy dashboard two automatically created sensors: no. 1: the running total of energy used by the home, calculated as: ((grid-in + solar + battery out) - (grid-out + battery-in)), plus no. 2: the running total of the Value of said usage. This Value would be the costs incurred had the house not have had any solar or battery. This would be very useful for calculating costs saved by having solar and/or batteries.

  • Add to the Energy dashboard another pair of automatically created sensors for each of the ‘energy producers’, like solar and/or batteries, these keep the running total of the energy produced by the producer, plus the compensation we would have received for said energy produced were it delivered to the grid directly.

  • Add to the energy dashboard a _cost sensor for each device listed in the Consumers list.

  • Add to the energy-devices-graph card an additional (optional?) column that lists the cost for the energy consumed by the device.

  • Add to the energy-devices-graph card a toggle that toggles between showing the devices ranked by Energy usage or by cost.

3 Likes

One more idea that devs could add to Energy Dasboard that is a pain in the ass to do it yourself.

Paste from another topic. Sorry for long read, but the point is pretty much in the end. TDLR: Need for a calculation of earnings of PV. Not only sold to the grid but own usage as well :

Did you have any luck solving it? I’m trying to solve the same problem, but really stuck.

Now I want to find a way how to calculate the money i have earned from selling the energy to grid (Nordpool without VAT) and how much i have saved using the solar energy (nordpool with VAT + tariffs). Probably something similar to the Energy Dashboard logic.

So what i have:

Prices.

  1. Nordpool hourly price (current price) excluding VAT: sensor.nordpool_kwh_ee_eur_3_10_0
  2. Nordpool hourly price (current price) including VAT: sensor.nordpool_kwh_ee_eur_3_05_02
  3. Network fee, or Tariff: sensor.el_tariff
    *Actually i have the sensor.total_el_price, which sums the 1. and 3. and which i’m using in Energy Dashboard

Returned electricity to the grid

  1. Phase 1: sensor.phase_1_energy_returned
  2. Phase 2: sensor.phase_2_energy_returned
  3. Phase 3: sensor.phase_3_energy_returned

PV production:
Only one sensor that sums the three Phases: sensor.inverter_total_yield. Usually it produces equal amount on all three phases.

I have managed to make template sensors to calculate “sold to grid” and “used by myself” energy:

  - platform: template
    sensors:
      sold_to_grid_energy:
        friendly_name: "Sold to Grid energy"
        unit_of_measurement: "kWh"
        value_template: >-
          {{ (states('sensor.phase_1_energy_returned') | float + 
               states('sensor.phase_2_energy_returned') | float + 
               states('sensor.phase_3_energy_returned') | float) }}
  - platform: template
    sensors:
      used_self_pv_energy:
        friendly_name: "Used Self PV Energy"
        unit_of_measurement: "kWh"
        value_template: >-
          {% set pv_production = states('sensor.inverter_total_yield') | float %}
          {% set energy_returned = states('sensor.phase_1_energy_returned') | float + 
                                   states('sensor.phase_2_energy_returned') | float + 
                                   states('sensor.phase_3_energy_returned') | float %}
          {% set used_self_pv = pv_production - energy_returned %}
          {{ used_self_pv }}

Now next step would be to calculate the costs based on usage during specific hours and then cumulatively. This actually excaclty what Energy Dashboard is doing, and actually I have at least the energy sold numbers from there, but not used PV energy numbers and because of that i would like to replicate it outside of Energy Dashboard. Seems like a simple task as it has been already done in Energy Dasboard, but i’m out of ideas how to move on.

Would be extremely nice if Energy Dashboard could calculate this out of the box.

In the end I would like to see:

  1. Daily PV energy sold - kwh and € (already in Energy Dashboard)
  2. Daily PV energy self used - kwh and €
  3. Daily total PV earning - kwh and €
  4. Monhtly PV energy sold - kwh and € (already in Energy Dashboard)
  5. Monhtly PV energy self used - kwh and €
  6. Monthly total PV earning - kwh and €
  7. Yearly PV energy sold - kwh and € (already in Energy Dashboard)
  8. Yearly PV energy self used - kwh and €
  9. Yearly total PV earning - kwh and €
  10. All Time PV energy sold - kwh and € (already in Energy Dashboard)
  11. All Time PV energy self used - kwh and €
  12. All Time total PV earning - kwh and €

In Energy Dashboard can be done with th current filter and only self used money calculations are needed.

1 Like

I have been able to track each set of costs from my PV and battery by splitting up my energy flows into the individual components.

Daily:

Monthly:

Unfortunately the dashboard only tracks costs for grid:

But it still tells a compelling story.

The Sankey card can also visualise the information in a neat way:

I would also like to dynamically track not just financial costs ($/€/¥) but also carbon (kgCO2e) as another set of costs. The electricity maps integration provides current kgCO2e/ kWh so I suspect it can be calculated in the same fashion.

1 Like