Why are my sensors not showing in the energy dashboard?

Hey everyone.

I am trying to get my energy consumption into the energy dashboard.
I created these two template sensors from data I get from an ESP, but I can’t pick them in the energy dashboard. Any ideas why?

template:
  - sensor:
    - name: "Energy Consumption"
      unique_id: energy_consumption
      state: |
        {{ states('sensor.tasmota_mt681_total_in')}}
      state_class: total_increasing
      unit_of_measurement: "kWh"
      device_class: energy
      icon: mdi:transmission-tower-import
      
  - sensor:
    - name: "Energy Return"
      unique_id: energy_return
      state: |
        {{ states('sensor.tasmota_mt681_total_out')}}
      state_class: total_increasing
      unit_of_measurement: "kWh"
      device_class: energy
      icon: mdi:transmission-tower-export

Help is much appreciated!
Cheers!

Did you restart HA when you added the template entities?

Yes I did. But still they won’t show up.

If the entities don’t appear at all in your system, you may have placed them in the wrong spot.

I can see the entities under integrations. They just are not available in the energy dashboard.

Template entities do not show up under an integration. They will show up on the entities tab or developer tools → states page.

The requirements to show up on the energy dashboard:

  • Have device_class: energy
  • Have state_class
  • Are being recorded in your database

Okay my bad. They are showing up under entities. That’s what I meant. They are working entities

As you can see in my code. I have both device_class: energy and state_class defined, so I don’t understand why they are not showing up in the energy dashboard.

How can I check if they are being recorded in my database? I can see them in the HA UI as entities, doesn’t that mean they are being recorded?

The entities must have a history

Okay I found the solution… for anyone struggling like me.

Under Developer Tools → Statistic I needed to fix an issue with the entities.

That was it.

Thanks @petro for the help!

3 Likes

Have been looking for ages to get this working. This helped me. Hero!

1 Like

This fixed an issue I was having. Thank you.

1 Like