What sensor for battery charged/discharged energy

I have created two MQTT sensors that provides the value of the energy, in KWh, charged and discharged from my ESS (Energy Storage System).

My issue is that when adding a battery to the energy dashboard in HASS these sensors are not available for selecting.

What are the requirements for them to show up and be selected from that list?

I believe your sensors should have those types of data defined if you want to add it to energy dashboard.

unit_of_measurement: kWh
device_class: energy

Thanks for your really quick response. I dont have: ‘device_class: energy’ so I will add it and see if that helps!

Still not working… :frowning:

The sensor config looks like this:

mqtt:
  sensor:
    - name: "EnergyToBattery"
      state_topic: "CerboGX/KWhToBattery"
      unit_of_measurement: "kWh"
      device_class: energy
      unique_id: "EnergyToBattery"
    - name: "EnergyFromBattery"
      state_topic: "CerboGX/KWhFromBattery"
      unit_of_measurement: "kWh"
      device_class: energy
      unique_id: "EnergyFromBattery"

Check sensor states in developer tools.

It can take a while for them to appear.

Looks ok.

I’ll just (impatiently) wait a while then :slight_smile:

I got it working after adding:

state_class: total_increasing