Energy Dashboard Problems

Hi,

I finally managed to stop my HA from constantly crashing by completely reinstalling it. I have now integrated my Shelly 3EM according to IAmKlaus’s guide and set it up so that the values are displayed in a balanced manner on the dashboard.

However, I’m still encountering the following issue:
The PV generation is being read by OpenDTU and transmitted to HA via MQTT. That part works fine.
I have added PV generation to the dashboard, and it is displayed correctly there as well.
However, the utilized PV power is not being included in the total power usage.

Why is that?

I can’t integrate the export yet because my west-facing balcony power plant unfortunately doesn’t generate enough electricity to feed into the grid.

Attached is the dashboard configuration.


Let me know if you need any help for me! :blush:
Translated with ChatGPT :smiley:

In order to do that the energy dashboard configuration needs a return to grid sensor specified. Even if it always reads 0, you still need to supply a sensor.

Self consumed solar = solar produced - returned to grid.

The calculation is not performed because the return to grid sensor is unavailable.

Create a template sensor that always returns 0 if you never export energy.

Sometimes i will export Energy, but the Helper is first aviable when i exported some energy. But this is not the problem i think, because if i only have PV energy earlier i also got this information in energy use tab.

Oh well if that how you think it works, please feel free to just ignore my advice, and reality.

No No i don’t i have this config. Here is also an export sensor included
And also an sensor for solargen. But i can add the export sensor first when i exported some energy.

But i will try your tip

sensor:
  - platform: template
    sensors:
      # Template sensor for current power comsumption
      power_current:
        friendly_name: "Power Current"
        unit_of_measurement: 'W'
        value_template: >-
            {{ states('sensor.shellyem3_485519d69f48_channel_a_power')|float + states('sensor.shellyem3_485519d69f48_channel_b_power')|float + states('sensor.shellyem3_485519d69f48_channel_c_power')|float }}
        availability_template: "{{
            [ states('sensor.shellyem3_485519d69f48_channel_a_power'),
              states('sensor.shellyem3_485519d69f48_channel_b_power'),
              states('sensor.shellyem3_485519d69f48_channel_c_power')
            ] | map('is_number') | min
          }}"
    
      # Template sensor for values of power import (active_power > 0)
      power_import:
        friendly_name: "Power Import"
        unit_of_measurement: 'W'
        value_template: >-
          {% if (states('sensor.shellyem3_485519d69f48_channel_a_power')|float + states('sensor.shellyem3_485519d69f48_channel_b_power')|float + states('sensor.shellyem3_485519d69f48_channel_c_power')|float) > 0 %}
            {{ states('sensor.shellyem3_485519d69f48_channel_a_power')|float + states('sensor.shellyem3_485519d69f48_channel_b_power')|float + states('sensor.shellyem3_485519d69f48_channel_c_power')|float }}
          {% else %}
            {{ 0 }}
          {% endif %}
        availability_template: "{{
            [ states('sensor.shellyem3_485519d69f48_channel_a_power'),
              states('sensor.shellyem3_485519d69f48_channel_b_power'),
              states('sensor.shellyem3_485519d69f48_channel_c_power')
            ] | map('is_number') | min
          }}"

      # Template sensor for values of power export (active_power < 0)
      power_export:
        friendly_name: "Power Export"
        unit_of_measurement: 'W'
        value_template: >-
          {% if (states('sensor.shellyem3_485519d69f48_channel_a_power')|float + states('sensor.shellyem3_485519d69f48_channel_b_power')|float + states('sensor.shellyem3_485519d69f48_channel_c_power')|float) < 0 %}
            {{ (states('sensor.shellyem3_485519d69f48_channel_a_power')|float + states('sensor.shellyem3_485519d69f48_channel_b_power')|float + states('sensor.shellyem3_485519d69f48_channel_c_power')|float) * -1 }}
          {% else %}
            {{ 0 }}
          {% endif %}
        availability_template: "{{
            [ states('sensor.shellyem3_485519d69f48_channel_a_power'),
              states('sensor.shellyem3_485519d69f48_channel_b_power'),
              states('sensor.shellyem3_485519d69f48_channel_c_power')
            ] | map('is_number') | min
          }}"

      # Template sensor for values of power consumption
      power_consumption:
        friendly_name: "Power Consumption"
        unit_of_measurement: 'W'
        value_template: >-
          {% if (states('sensor.power_export')|float(0)) > 0 and (states('sensor.power_solargen')|float(0) - states('sensor.power_export')|float(0)) < 0 %}
            {{ 0 }}    
          {% elif (states('sensor.power_export')|float(0)) > 0 and (states('sensor.power_solargen')|float(0) - states('sensor.power_export')|float(0)) > 0 %}
            {{ (states('sensor.power_solargen')|float(0)) - states('sensor.power_export')|float(0) }}    
          {% else %}
            {{ states('sensor.power_import')|float(0) + states('sensor.power_solargen')|float(0) }}
          {% endif %}

      # Template sensor for values of energy Solar generation (solar_power > 0)
      power_solargen:
        friendly_name: "Power Solar Generation"
        unit_of_measurement: 'W'
        value_template: >-
          {% if (states('sensor.balkon_1_power')|float(0) + states('sensor.balkon_2_power')|float(0)) > 0 %}
            {{ (states('sensor.balkon_1_power')|float(0) + states('sensor.balkon_2_power')|float(0)) }}
          {% else %}
            {{ 0 }}
          {% endif %}


  # Sensor for Riemann sum of energy import (W -> Wh)
  - platform: integration
    source: sensor.power_import
    name: energy_import_sum
    unit_prefix: k
    round: 2
    method: left

  # Sensor for Riemann sum of energy export (W -> Wh)
  - platform: integration
    source: sensor.power_export
    name: energy_export_sum
    unit_prefix: k
    round: 2
    method: left

  # Sensor for Riemann sum of energy consumption (W -> Wh)
  - platform: integration
    source: sensor.power_consumption
    name: energy_consumption_sum
    unit_prefix: k
    round: 2
    method: left

utility_meter:
  energy_import_daily:
    source: sensor.energy_import_sum
    name: Energy Import Daily
    cycle: daily
  energy_import_monthly:
    source: sensor.energy_import_sum
    name: Energy Import Monthly
    cycle: monthly
  energy_export_daily:
    source: sensor.energy_export_sum
    name: Energy Export Daily
    cycle: daily
  energy_export_monthly:
    source: sensor.energy_export_sum
    name: Energy Export Monthly
    cycle: monthly
  energy_consumption_daily:
    source: sensor.energy_consumption_sum
    name: Energy Consumption Daily
    cycle: daily
  energy_consumption_monthly:
    source: sensor.energy_consumption_sum
    name: Energy Consumption Monthly
    cycle: monthly

You need to specify this:

1 Like

Oh well okay, i understand now. Thanks for your help.

Great thanks to the community. And to @tom_l You do a great job.
Thanks a lot.

1 Like