Energy Consumption calculates wrong values, using ESP HOME sensor that sends unknown peeks

i use a esp home sensor for my smart power meter. This sensor reads every 30s the total used energy. I use this sensor for my energy dashboard and it worked fine.


  • platform: obis
    channel: “1-0:1.8.0*255”
    name: “strom_zaehlerstand_kwh_total”
    unit_of_measurement: “kWh”
    device_class: “energy”
    accuracy_decimals: 4
    state_class: “total_increasing”
    • throttle: 30s

But in the last weekys the sml_sensor deliveres wrong values. These are always lower as you can see here and i dont know where they come from …

and my values in the energy dashboard are getting crazy as you can see here

I havent found the problem yet. But is it possible to only use values that are greater like before? I thought about a new sensor that only stores the values from the sml_sensor, when that value is greater, then that time before. Unfortunately my coding knowledge for HA are very very poor.

So someone has an idea? I know i could change values for the energy dashboard in the statistic tab. But i also have some other sensors that use my sml_sensor “strom_zaehlerstand_kwh_total” and these are also calculating wrong values:

source: sensor.strom_zaehlerstand_kwh_total
cycle: daily
source: sensor.strom_zaehlerstand_kwh_total
cycle: weekly
source: sensor.strom_zaehlerstand_kwh_total
cycle: monthly

Best Regards

I opened another thread about this problem with a hopefully working solution at the end

        value_template:  >
            {% set total = states('sensor.strom_zaehlerstand_kwh_total') |float() |round(3) %}
            {% set test = states('sensor.stromzaehler_total_test') |float(0) |round(3) %}
            {% if total >= test %} {{ total }}
            {% else %} {{ test }}
            {% endif %}