Energy Dashboard shows wrong values from energy counter

Sometimes the dashboard shows conumption of the total instead of the day.
It looks like the system gets maybe problem with the decimal and 1000 separator.

IR sensor on the energy meter (EM) using tasmota.

In the normal dashboard everything looks fine.

But in the history it looks like sometimes very low values are arriving.
The upper line shows 1.274kWh so 1274kWh.
The low values are nearly 0 or 1kwh or 85 kwh (may be all 0 but logged during change)

So this morning the ED shows normal values

Going 2 days back it shows crazy values like

So even more than the total amount of the EM

Or is the definition “total increasing” wrong as the EM transfers the total increasing value?

Any Idea how to solve?

The problem is that your energy sensor is reporting 0 instead of unavailable when it is unavailable. i.e. The states act like this:

Total → 0 → Total = add the entire total to the energy dashboard

Total → unavailable → Total = no change.

If you are using template sensors this can be fixed with an availability template.

If you are using some integration for your energy sensors you can report this issue to the developer of the integration. If you have no luck there you can filter your sensors through a template sensor.

Please show your sensor configuration rather than the customizations of your sensors.

Also please do not post pictures of text. Post the actual text and format it correctly for the forum. That goes a long way in helping us help you, as we can then copy/paste/edit the configuration to guide you to a solution.

Here is the code of the sensor defined in config.yaml

    # Eigene Einheiten festlegen wenn keine da sind
    # Zähler Einheiten
      sensor.zaehler_sm_1_8_0: #Zähler Bezug
        device_class: energy 
        unit_of_measurement: "kWh"
        state_class: total_increasing
      sensor.zaehler_sm_2_8_0: #Zähler Einspeisung
        device_class: energy 
        unit_of_measurement: "kWh"
        state_class: total_increasing
      sensor.zaehler_sm_16_7_0: #Zähler Leistung Summe
        device_class: energy 
        unit_of_measurement: "W"

And here is the script of the tasmota device:

TelePeriod 30
=>sensor53 r
>M 1
; Device: eBZ DD3 2R06 ODZ1
; protocol is D0 OBIS ASCII
; 9600@7E1 for OP-type devices, 9600@8N1 for SM-type devices
; Zählerstand zu +A, tariflos, 
; Zählerstände Auflösung 10 µW*h (6 Vorkomma- und 2 Nachkommastellen)
1,1-0:1.8.0*255(@1,Energie Bezug,kWh,1_8_0,0
; Zählerstand zu +A, Tarif 1
1,1-0:1.8.1*255(@1,Energie Bezug T1,kWh,1_8_1,0
; Zählerstand zu +A, Tarif 2
1,1-0:1.8.2*255(@1,Energie Bezug T2,kWh,1_8_2,0
; Zählerstand zu -A, tariflos
1,1-0:2.8.0*255(@1,Energie Export,kWh,2_8_0,0
; Summe der Momentan-Leistungen in allen Phasen, Auflösung 0,01W (5 Vorkomma- und 2 Nachkommastellen)
; Momentane Leistung in Phase Lx, Auflösung 0,01W (5 Vorkomma- und 2 Nachkommastellen)
1,1-0:36.7.0*255(@1,Leistung L1,W,36_7_0,18
1,1-0:56.7.0*255(@1,Leistung L2,W,56_7_0,18
1,1-0:76.7.0*255(@1,Leistung L3,W,76_7_0,18
; Spannung in Phase Lx, Auflösung 0,1V (nur über MSB)
1,1-0:32.7.0*255(@1,Spannung L1,V,32_7_0,1
1,1-0:52.7.0*255(@1,Spannung L2,V,52_7_0,1
1,1-0:72.7.0*255(@1,Spannung L3,V,72_7_0,1
; Statuswort, 4 Byte Information über den Betriebszustand, HEX string
; tasmota can decode one string per device only!
; Geräte-Identifikation, Nach DIN 43863-5 

The sensor just popped up in the HA after he was found as a tasmota device.
Where can I show you the configuration?

Maybe it would be nice to ignore all values below 100kwh as the EM only counts up in the future.
Where and how to do?



No, those are customisations, not sensor configuration. As your devices were discovered, you don’t have the availability template option.

I’m no longer familiar with Tasmota devices so maybe someone can help you with that. Otherwise to filter your sensors you can do something similar to this:

Now I’ve tried the code…

  - platform: template
        friendly_name: "Energy from Grid"
        unique_id: Energy_from_Grid
        device_class: energy
        unit_of_measurement: kWh
        value_template: >
          {% if states('sensor.zaehler_sm_1_8_0') | float == 0 %}
           {{ states('sensor.energy_from_grid') }}
          {% else %}
           {{ states('sensor.zaehler_sm_1_8_0') | float | multiply(1.0) | round(0) }}
          {% endif %}
        friendly_name: "Energy to Grid"
        unique_id: Energy_to_Grid
        device_class: energy
        unit_of_measurement: kWh
        value_template: >
          {% if states('sensor.zaehler_sm_2_8_0') | float == 0 %}
           {{ states('sensor.energy_to_grid') }}
          {% else %}
           {{ states('sensor.zaehler_sm_2_8_0') | float | multiply(1.0) | round(0) }}
          {% endif %}

And add the device class like…

      sensor.energy_from_grid: #Zähler Bezug
        device_class: energy 
        unit_of_measurement: "kWh"
        state_class: total_increasing
      sensor.energy_to_grid: #Zähler Bezug
        device_class: energy 
        unit_of_measurement: "kWh"
        state_class: total_increasing

After that it was possible to use this 2 Sensors in my Energy Dashboard.

Let’s see after a few days if now it runs smoth.

Thanks for the tip


You don’t need most of those customisations. They are in the template sensor already, just move the state_class’s to the template sensors and delete the customisations.

The Hassio was telling me not possible. template do not accept state_class

Ah right. That’s why you should use the new template format.

So I’m using the “old” one?
How is the new one looking?

Hi @mucwendel
did you solve the issue? I do have exactly the same issue for my sensors reading from tasmota the incoming and outgoing kwh.
I receive the sensor values with mqtt via tasmota integration.
Thanks a lot

I integrated the sensors like this:

      unit_of_measurement: "kWh"
      device_class: energy
      state_class: total_increasing
      unit_of_measurement: "kWh"
      device_class: energy
      state_class: total_increasing

moved into a new

Moved to another topic