MQTT Sensor "No matching statistics found" on Energy

Hello everyone!
I’m trying to configure Energy dashboard with no luck.
I already read all posts about this topic but I’m still not able to solve my problem.

I read my house energy consumption from a shelly EM that communicate with HA through MQTT.
I already added “state_class”, “device_class” and “last_reset” but sensor still not shown on Energy dashboard.

My HA version is 2021.10.6 and Homeassistant OS 6.5.

This is my sensor:

sensor:
  - platform: mqtt
    name: "Shelly EM Consumo Casa energy"
    state_topic: "shellies/shellyem_quadro/emeter/0/total"
    unit_of_measurement: "kWh"
    value_template: "{{ (value|float / 1000 ) | round (3) }}"
    device_class: energy
    state_class: measurement
    last_reset_topic: "shellies/shellyem_quadro/emeter/0/total"
    last_reset_value_template: "1970-01-01T00:00:00+00:00"

I also tried with a template sensor:

template:
  - sensor:
      - name: "House electricity energy"
        unit_of_measurement: "kWh"
        state: >
          {{ states("sensor.shelly_em_consumo_casa_energy") }}
        device_class: energy
        state_class: measurement
        attributes:
          last_reset: "1970-01-01T00:00:00+00:00"

What am I missing?
Are there something else to enable on configuration.yaml?

Thanks!

1 Like

The state_class should be total_increasing, from what I get of your screenshots.

Thank you Chris for your replay, unfortunately still not working :pensive:

It should. You likely must wait one hour for an actual statistic to be recorded, though.

@davided11 did it work after waiting a while? I am at the same point :slight_smile:

Sorry for late answer! Hope you have solved in the meantime. My problem was I had excluded the entity from recorder.

1 Like

This is very good info, I do not record all entities and didnt see the energy sensors there at all, this topic/response pointed me into the right direction. Thanks!