Wrong calculation of my consumed Energy in Energy Dashboard


i am new in home assistant and i have a problem with the Energy Dashbard.

I have written a litte Script for my ESP8266 that is reading the values from my electricity meter (SML-Protocol) and sending the Power that i have used, and the Power i have send back from my solar panels via MQTT to HA. That works fine, HA writes this Data correct as Float in the Database. But the calculation for the sum of my consumed energy is wrong.

statistics_short_term table

Here can you see, the state value is 17208,5 kwh for a long time, because my Solar Panels are working fine and i dont need energy from my energy provider, but the sum value is increasing.

What i am doing wrong ?

in my configuration.yaml i have

      last_reset: '1970-01-01T00:00:00+00:00'
      last_reset: '1970-01-01T00:00:00+00:00' 
sensor 3:
   - platform: mqtt
     name: "Stromverbrauch Netz"
     unique_id: "stromverbrauch_gesamt"
     device_class: energy
     state_class: total
     unit_of_measurement: "kWh"
     value_template: "{{ value | float  | round (2) }}"
     state_topic: /Strom/Gesamt
   - platform: mqtt
     name: "Stromverbrauch Aktuell"
     unique_id: "stromverbrauch_aktuell"
     device_class: power
     state_class: measurement
     unit_of_measurement: "W"
     state_topic: "/Strom/Aktuell"  
   - platform: mqtt
     name: "Stromverbrauch Einspeisung"
     unique_id: "stromverbrauch_einspeisung"
     device_class: energy
     state_class: total_increasing     
     unit_of_measurement: "kWh"
     value_template: "{{ value | float  | round (2) }}"
     state_topic: "/Strom/Einspeisung" 

In the Energy Dashboard i configure:

“Stromverbrauch Netz” for the consumed Energy
“Stromverbrauch Einspeisung” for the energy i am sending back
“sensor_balkonshelly_energy” from my Shelly 1PM who is giving the produced solar energy in kwh.

What must i do to get the right consumption for my consumed Energy, now it is much to high for every day ?

Best Regards


And her a picture from statistics table

Here you can see the sum from 10:00 to 11:00 is increased 0,45 kwh, but the state stands by 17208,5 kwh.

No one here who can help me please ?