Energy Dashboard: Add/calculate self-sufficiency / Autarkie of the Photovoltaik system

The “self-consumption quota” you describe already exists in the sidebar of the Energy dashboard and is called “Self-consumed solar energy” there, right? (Personally, I don’t think this metric is that relevant, the smaller your PV the bigger value you’ll get. If you want to achieve 100% there then you should build a PV consisting of a single PV module. Or break your PV such that it produces way less than it could. :man_shrugging:)

I would be very interested in a gauge that shows the Autarkie (“self-consumption quota”), too! Actually, it’s the more relevant metric in my opinion: It is a measure of how well my PV works and how well my home is set-up to use the PV energy (and how much my PV is able to reduce my energy bill).

2 Likes

+1 for the autarkie of the photovoltaik in the energy dashboard!
The daily/monthly/yearly statistics would be nice.

2 Likes

does anybody know where to find the code of the current implementation “Self-consumed solar power”

as all data already available it is hopefully not to complicated to add this information

I am missing this information within the energy dashboard, too.
The way I solved this, was by creating a custom dashboard (with all relevant PV data) and then create custom sensors to calculate such information:

grafik

# Sensor zur Autarkie-Kalkulation
    solaredge_calculated_self_sufficiency:
      friendly_name: 'Autarkie-Grad'
      unit_of_measurement: "%"
      value_template: >-
        {% if is_state('sensor.solaredge_selfconsumption_energy_kwh', '0.0') or is_state('sensor.solaredge_consumption_energy_kwh', '0.0') %}
          0.0
        {% else %}
          {% set selfconsumption = states('sensor.solaredge_selfconsumption_energy_kwh') | float(0) %}
          {% set consumption = states('sensor.solaredge_consumption_energy_kwh') | float(0) %}
          {{ ((selfconsumption / consumption) * 100) | round(2) }}
        {% endif %}

# Sensor zum Nutzungsgrad der PV-Anlage
    solaredge_calculated_solar_usage:
      friendly_name: 'Nutzungsgrad'
      unit_of_measurement: "%"
      value_template: >-
        {% if is_state('sensor.solaredge_energy_today_kwh', '0.0') or is_state('sensor.solaredge_selfconsumption_energy_kwh', '0.0') %}
          0.0
        {% else %}
          {% set production = states('sensor.solaredge_energy_today_kwh') | float(0) %}
          {% set consumption = states('sensor.solaredge_selfconsumption_energy_kwh') | float(0) %}
          {{ ((consumption / production) * 100) | round(2) }}
        {% endif %}

# Sensor zum Berechnung der Netzeinspeisung
    solaredge_calculated_energy_export:
      friendly_name: 'Netzeinspeisung'
      unit_of_measurement: "%"
      value_template: >-
        {% if is_state('sensor.solaredge_energy_today_kwh', '0.0') or is_state('sensor.solaredge_exported_energy_kwh', '0.0') %}
          0.0
        {% else %}
          {% set production = states('sensor.solaredge_energy_today_kwh') | float(0) %}
          {% set export = states('sensor.solaredge_exported_energy_kwh') | float(0) %}
          {{ ((export / production) * 100) | round(2) }}
        {% endif %}
8 Likes

Hey @CChris ,

thank you for your script. This is exactly what i need. My PV System is currently under installation. After it is runnig i will test the script.

Greets
Basti

I would indeed be very helpful to have within the energy dashboard a view on how much of your usage of the day came from Solar

2 Likes

The lack of self-sufficiency is a major shortcoming of the current dashboard. We should orient ourselves to the key figures and values offered by almost all PV inverter manufacturers. Here, self-sufficiency is missing as an essential parameter.

It is precisely the values of self-consumption and self-sufficiency that are crucial for controlling the consumers in a smart home and monitoring the effectiveness of the measures taken so that, depending on the objective, one can switch the consumers on or off, start charging processes for the battery or charging an electric car, set the setpoints for the heating accordingly and so on.

The calculation logic is trivial and the necessary values are all already available in the dashboard: Self-sufficiency = 1 - externally sourced electricity (grid) / total electricity consumed.

This should therefore only be a small finger exercise for standard development, and if the value of self-sufficiency were available, this would enhance the entire dashboard enormously.

5 Likes

link to existing WTH:

1 Like

Wo trage ich das script wie ein??

EN: These are templates (legacy format) which can be added to your configuration.yaml.
You could also create a new file and include it into your configuration file.

DE: Das sind templates (altes Format) welche z.B. in die configuration.yaml hinzugefügt werden können.
Du kannst diese aber auch in eine separate Datei schreiben und dann in die configuration.yaml einbinden (include)…

EN: Since the above code is in the old legacy template format, it would probably better to write it in the new template format.

DE: Am besten aber wäre es, wenn diese Sensoren nach dem neuen Template Format angelegt werden.

- platform: templates

# sensor to calculate the self sufficiency
   - sensor: calculated_self_sufficiency
     unique_id: 'calculated_self_sufficiency'
     state_class: measurement
     unit_of_measurement: "%"
     state: >-
        {% if is_state('sensor.solaredge_selfconsumption_energy_kwh', '0.0') or is_state('sensor.solaredge_consumption_energy_kwh', '0.0') %}
          0.0
        {% else %}
          {% set selfconsumption = states('sensor.solaredge_selfconsumption_energy_kwh') | float(0) %}
          {% set consumption = states('sensor.solaredge_consumption_energy_kwh') | float(0) %}
          {{ ((selfconsumption / consumption) * 100) | round(2) }}
        {% endif %}      

# sensor to calculate the usage of your solar installation
    - sensor: calculated_solar_usage:
      unique_id: 'calculated_solar_usage'
      state_class: measurement
      unit_of_measurement: "%"
      state: >-
        {% if is_state('sensor.solaredge_energy_today_kwh', '0.0') or is_state('sensor.solaredge_selfconsumption_energy_kwh', '0.0') %}
          0.0
        {% else %}
          {% set production = states('sensor.solaredge_energy_today_kwh') | float(0) %}
          {% set consumption = states('sensor.solaredge_selfconsumption_energy_kwh') | float(0) %}
          {{ ((consumption / production) * 100) | round(2) }}
        {% endif %}

# sensor to calculate the grid export percentage
    - sensor: calculated_energy_export:
      unique_id: 'calculated_energy_export'
      state_class: measurement
      unit_of_measurement: "%"
      state: >-
        {% if is_state('sensor.solaredge_energy_today_kwh', '0.0') or is_state('sensor.solaredge_exported_energy_kwh', '0.0') %}
          0.0
        {% else %}
          {% set production = states('sensor.solaredge_energy_today_kwh') | float(0) %}
          {% set export = states('sensor.solaredge_exported_energy_kwh') | float(0) %}
          {{ ((export / production) * 100) | round(2) }}
        {% endif %}

EN: But I haven’t tested the new format yet - since I’m trying to avoid such sensors in my new installation.
The major issue is, that the calculation will be done, whenever one of the source-sensor values change.
That could / will cause issues with the calculation when for example - the value for export does change, but the sensor value for production has not yet changed (or does change just a bit later).
In this case, the calculation will give you wrong values for a short period of time.

DE: Ich habe das neue Format aber selber jetzt noch nicht getestet, da ich in meinem Neuen System größten Teils auf diese Sensoren verzichte.
Das Problem mit der Berechnung solcher Werte ist, dass die Berechnung immer dann stattfindet, wenn sich einer der Werte ändert.
Das kann dann dazu führen, dass z.B. der Wert für Export ändert, der für Produktion aber noch nicht - oder erst kurz darauf.
Für eine gewisse Zeit bekommt man dann also ungenauere Werte im System angezeigt.

und btw:
Hier im Forum sollte man am besten englisch schreiben - damit auch andere aus der Community helfen können und die Beiträge verstehen :slight_smile:

2 Likes

thx for helping me. Sorry, my english isn´t the best.
I have a probplem, the script doesn´t work. I dont no why. I have 3 states, Solarproduktion, Akku entladen and Netzbezug. Thats all. How does it work with this three states?

Thx Jarnsen

can you show / share your configuration and what exactly does not work?

I cleared the yaml. I have all in packages.
von Batterie = sensor.soyosource_wifi_dongle_battery_power
Netzbezug = sensor.gesamt_verbrauch
Einspeisung = sensor.gesamt_einspeisung
Tagesertrag Solar = sensor.tagesertrag

This are all necessary entities.
I dont now the right funktion.

OK, pls. write me a private message - then we can try to discuss this in german - and maye, it will be easier :slight_smile:
The thing here in the forum - since it is public, is that conversation should be in english - so that everyone can have a benefit from it… but sure. It does make things a bit difficult sometimes, if your english isn’t that good.

I can´t write pm, there is no button. :thinking: If you like, send me a pm.

I really would love to see this feature as a gauge like the one already present. In addition, it should also be straigt forward to implement the savings from the self consumption using a tarife. Either by using the tarif you would have had to pay If energy was consumed from the net,or (relevant fro some old tarifes in germany, e.g.) additional money you get for self-consumed energy.

4 Likes

Hi there, I created this Bundle Card without even knowing others would like this.
Someone pointed me to this post, so might as well share it now :slight_smile:

I submitted a PR to add this card as a default repository to HACS, so shouldn’t take too long to have it as default HACS repo

Edit:
This card also displays self-consumption (meaning how much of your produced energy was used by you). The goal is to have a bundle card. If you have an idea for another info to display, feel free to submit it, I’m open for suggestions :blush:

Cool. great. But how can I add this to the energy-dashboard? (I know, via code-editing maybe) but if so what about a pull request to HA adding the autarky to the energy dashboard?

I saw this:

so it might get merged very soon

YEAH! :slight_smile: thank you