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
sensors:
power_out_cur:
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”)
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)
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):
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.
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:
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: