Help interpreting the energy dashboard

Hi everyone,

I am confused about the recent results of my energy dashboard (power consumption).
My config is:

Whereas the Stromverbrauch [kWh] is the power meter values read by an ESP and reflecting the real consumption (power consumption - solar generation).
And Einspeisung kWh is the Rieman integral of:

- platform: template
      unique_id: sensor_power_out_cur
      friendly_name: "Einspeisung akt. [W]"
      device_class: "power"
      value_template: "{{ states('sensor.energy_consumption_current_w') | int *-1 if states('sensor.energy_consumption_current_w') | int  < 0 else 0 }}"
      unit_of_measurement: "W"

(I got this somewhere from the forum, because the power meter does not return the power returned to the grid (German: “Einspeisung”)

As a result I get this (which looks ok):

But sometimes the Solar generated just add up to the total power consumption:
(and the solar power generation looks far too high for a max 600W balcony solar system)

It seems that the unrealistic jumps correlate with these:

I guess the reason is, that the inverter is not available at this time.

Any comment on my interpretation?
And more importantly any suggestion for improvement?

Yes, the problem is that your solar energy sensor jumps from zero to some value after it becomes unavailable. This adds the full value to your energy dashboard total again. Instead of looing like your last screenshot above we need to make it look like this (gaps are ok, dropping to zero is not):

Can you share your config for your solar energy production sensor?

Hi Tom,
thanks for your lightning fast response.

My solar energy sensor is the generic one from the Omnik Inverter.
So there is no specific config.

So how about creating a new sensor with e.g. Combine the state ... with the option Most recently updated
This should iron it out, right?

Can you link to the integration you used to create this sensor?

Sure - thank you for your support!
GitHub - robbinjanssen/home-assistant-omnik-inverter: Read the current, daily and total Wh from your Omnik Inverter via local network (no cloud!)

As Tom said, the production total going to 0 or something lower and back is bad. From a math point of view I do not understand why it does that, but I would start by adding a default to the int cast (use int(0) instead of just int) in the templates for power_out_cur, because they will now produce an error when the inverter is not available instead of the watts going to 0 as your template seems to want to accomplish. Maybe the error interferes with the calculation of the Riemann sum? Because whatever happens there is not supposed to happen from normal calculations.

They aren’t the sensors that are causing the issue.

@NCO3 as this is a third party integration, you need to open an issue with the developer, here: Issues · robbinjanssen/home-assistant-omnik-inverter · GitHub

Thank you, Tom - will do.

I did follow your recommendation to switch over to the total solar generation sensor.
Of course this messes up the statistics:

This can be found in the statistics value as well:

is is safe to adjust this to 0 - as this is the original sensor data, which is not the value for / from the energy dashboard, I suppose?

Although I am not sure, if this sensor will work either (even though it’s working for you according to your github comment).
Because it shows a similar bahavior like the day sensor:

On a larger scale it looks even worse:

What about creating a max sensor of the Solar power generation (total) aka Solar Ertrag (gesamt)?

I think this will work with the dashboard, even though the sensor is unavailable at some times…

Not really sure how to fix this otherwise, as your inverter goes offline and “unavailable” actually is this value…

Going unavailable is fine. Going to zero when unavailable is not. The energy dashboard works like this:

Total → unavailable → total : no change (keep counting up from last total).

Total → 0 → total : add the whole total to the dashboard again, causing massively inflated readings.

With the total Sensor instead it does not work either.
The value jumps from normal (currently around 282 kWh) create even worse results due to the higher deviation from 0 to 282 kWh):
In this specific case the 282 to 0 and back obviously happened 3 times between 8 and 9 pm:
3 * 282 plus one time between 5 and 6:

I have found a post from you from b/o last year mentioning a filtered sensor:
Heavy energy peaks (120kwh in 30 min), using shelly 3em - Configuration - Home Assistant Community (
I have created such a sensor and hope to fix my issue with this.

By the way: I was not able to include the sensor in the dashboard, so I have added a customize setting:

  unique_id: sensor_solar_ertrag_ges_filter_kwh
  unit_of_measurement: "kWh"
  device_class: energy
  state_class: total_increasing
  accuracy_decimals: 2

I will report back if this helps…

Can you share your config for this?

in templates.yaml I have:

- sensor:
    - name: "Solar Ertrag ges. (Filter) [kWh]" 
      unique_id: sensor_solar_ertrag_ges_filter_kwh
      icon: "mdi:counter"
      unit_of_measurement: "kWh"
      state: "{{ states('sensor.bosswerk_mi600_solar_energy_total')|float(0) }}"
      availability: "{{ states('sensor.bosswerk_mi600_solar_energy_total')|float(0) > 280 }}"

in customize.yaml:

  unique_id: sensor_solar_ertrag_ges_filter_kwh
  unit_of_measurement: "kWh"
  device_class: energy
  state_class: total_increasing
  accuracy_decimals: 2

It seems so far, that the jumps a smoothed out: