Energy-panel savings follow up for self-used solar power

Hello!

I really like the energy-panel. It tracks my use very nicely. I do however feel It can be improved.

What we have is:
Solar produce tracking
(Imported Energy) * (Energy purchase price) tracking
(Exported Energy) * (Energy selling price) tracking

What we, in my opinion, lack:
There is no separate COST tracking of what portion of the solar power produce is consumed by the actual household.

Reason for needing this type of follow up is it gives us better data on the return of investment of our solar power installations!
(Used solar power) * (Energy purchase price) = “savings” income (not having to purchase this power)
(Sold solar power) * (Energy sell price) = “selling” income

Savings + selling = total return of solar power

Basically

sun_consumed = sun_produced if power_export = 0 else sun_produced - power_export

And this is then tracked against a cash/kWh sensor/static value as the other data sources.

I have created a sensor of sorts myself but I would love to see it somehow better integrated in the energy tab. I’m still evaluating the sensor I created to see if it works as I have imagined it.

Hey, did you every find a work around for this ?

Hi, I created my own sensor just to have it run in the background but its not visible on the energy dashboard. It’s atleast collecting data

if it helps heres my code
copy and adapt

  # DataSource = Huawei Solar Inverter
  - platform: template
    sensors:
      house_solar_produced_used_power:
        friendly_name: 'Husets Egenbrukade Solkraft'
        unique_id: 'h_eg_solk'
        unit_of_measurement: 'W'
        device_class: power
        value_template: >
          {% set pwr_use = states('sensor.power_meter_active_power')|float %}
          {% set pwr_sun = states('sensor.house_solar_produced_power')|float %}
          {% set not_selling = pwr_use < 0 %} 
          {% set pwr_tot = pwr_sun if not_selling else pwr_sun - pwr_use   %}
          {{ pwr_tot|round }}
        availability_template: >
          {% set sstate = states('sensor.house_solar_produced_power') %}
          {{ sstate != 'unavailable' and sstate != 'unknown' }}

  # Total Solar Panel Power - Riemann sum integral
  - platform: integration
    unique_id: h_tot_sun_usd_pwr
    source: sensor.house_solar_produced_used_power
    name: house_solar_produced_used_energy
    unit_prefix: k
    round: 2
    method:
      left

    # Template power measurement
  # Total Solar Panel Self-Use Saved Money
  # DataSource = Huawei Solar Inverter
  - platform: template
    sensors:
      house_solar_produced_used_power_monetary:
        friendly_name: 'Husets egenbrukade solkraft i kr'
        unit_of_measurement: 'kr'
        device_class: monetary
        value_template: >
          {% set pwr_use = states('sensor.power_meter_active_power')|float %}
          {% set pwr_sun = states('sensor.house_solar_produced_power')|float %}
          {% set pwr_buy_price = states('sensor.energy_cost_w_tax')|float %}
          {% set not_selling = pwr_use < 0 %} 
          {% set pwr_tot = pwr_sun if not_selling else pwr_sun - pwr_use   %}
          {{ pwr_tot * pwr_buy_price * 0.001 }}
        availability_template: >
          {% set sstate = states('sensor.house_solar_produced_power') %}
          {{ sstate != 'unavailable' and sstate != 'unknown' and states('sensor.energy_cost_w_tax')|is_number}}

  # Total Solar Panel Power - Riemann sum integral
  - platform: integration
    unique_id: h_tot_sun_usd_pwr_mnt
    source: sensor.house_solar_produced_used_power_monetary
    name: house_solar_produced_used_energy_monetary
    #unit_prefix: k
    round: 2
    method:
      left
´´´
1 Like

Thaksiwill look to see how i can adapt