Energy dasboard sensor integration

Hi there,

I’d like to add some sensors to my energy dasboard. But the sensors are not shown to chose.
The sensor is an sensor mounted at my energy meter that provide the total energy consumption to KNX bus.
The sensor is integrated in Homeassistant as follows:

- name: "eHZ_Ausgabe_Wirkenergie_A+_tot._(kWh)"       # Name of entity
  state_address: "0/0/104"                    # GA
  type: active_energy_kwh                         # KNX typ 13.013 Wirkarbeit (kWh)

What I found out, that it is necessary to have the right device class and mybe state class.
Device class is - energy. I think this is set automatically from HA because of the integration of the sensor.
But what about the state class. and how to define it.
What should be the right class?

THanks to all.

This is my template.yaml for calculating gas usage:

### Buderus gas usage calculation
- sensor:
  - name: "Buderus daily gas usage"
    unique_id: furnace_gas
    device_class: gas
    unit_of_measurement: "m³"
    state: "{{ (states('sensor.buderus_on_time_today') | float * 0.065 * 60) | round(2) }}"
    state_class: total_increasing

It calculates gas usage based on furnace running time defined in sensors.yaml

### Buderus running time daily
- platform: history_stats
  name: Buderus On Time Today
  entity_id: binary_sensor.buderus_kessel_betrieb_1_stufe_2
  unique_id: 561dda8d-06a9-4322-8785-9fd364690ed2
  state: "on"
  type: time
  start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  end: '{{ now() }}'

@ddaniel you have set the state_class to total increasing

I will add it to my sensor to and try what happens.
But one question: What is teh output of your sensor? Provides the sensor allways the hole amount of gass usage? example 500 m³ and later then 501 m³?

See the Knx sensor entity documentation and the link to state class definitions there. https://www.home-assistant.io/integrations/knx/#sensor

It provides daily gas usage based on furnace burner running time. I was able to add it to energy dashboard. I also created weekly and monthly sensors for gas usage using utility meter helper.

thanks for our replies, now i think I know how to set the state class.
But what is the right class for my sensor, wich will provide data in the following way:
Example:
5344 kWh
5345 kWh

is total the right class?
The sensor should show the provided value and not the “differences”.

I think I have problems in understanding.

Now it worked fine.
I added the state class as total_increasing

But what I don’t understand, why it is only possible to add electrical Energy (kWh) and not the electric power (W).
I think with adding electric power (W) the moving points in the energy dasboard could be more precise.