How to configure a Sensor so that is useable in in the energy Dashboard

Hi there,

I’ve set up an ESP8266 with Tasmota an an IR Reader to make my Energy Meter Smart. But i can not select ist as an Entety in the energy Dashboard.

I Read a lot of thread how to set it up but neither of them gives me the correct result?
What are the steps to do?

i get my Data in Wattage “W”

thanks for the Help

If you just have a sensor for instantaneous measurement of power consumption in W, add a Riemann sum integral sensor via the Helpers section. I don’t have the fully technical explanation but basically turns your chosen sensor into a cumulative sensor in kWh which is what’s needed for the Energy dashboard.

thanks for your answer,

But i’ve tried this Helper, But My sensor doesnt show up!
is there anything missing

Sorry, I’m not sure if I fully understand you.
Your sensor in W is not shown ehn you are creating the helper (Riemann sum) or your new helper is not shown on the Energy dashboard?

“Watts” or “W” is the unit for Power. The energy dashboard shows Energy, so you need something like that Riemann sum in other to calculate the power per time (energy).
The sensor to be listed in the energy dashboard must be an energy sensor (Wh, kWh, etc) and must have the right device_class and state_class.

device_class: energy

You can double check if your sensor fulfill those requirements by going to Developer tools > States and then typing your sensor name, selecting to display the attributes:

Take a look at your sensors at this Developer tools panel and let us know it’s attributes, so it would be easier to troubleshoot.

the Main Sensor from Tasmota is shown in “W” which doesnt work for the Enery Dashboard. So i’ve created a Helper with the Riemann Sum which gives me “kWh” but this doesnt show up also in the Energy Dashboard

Could you please share a screen shot of your sensor with its attributes from Developer tools > States?

Please remove any private info before sharing.

Sensor getting from Tasmota:

Riemann Sum Helper:

So, are you trying to add the sensor to the Energy dashboard in the “Grid consumption” or in the “Individual devices” group?
Isn’t the sensor listed in the list when trying to add it to the dashboard?

I wanna add it to the Grid Consumption. But it doesnt show up in Neither of these

Could you please confirm if the issue persists? As this helper will calculate consumption over time I won’t be surprised if it takes a while until you have useful data.

From your screenshots it looks like your sensor has a device_class of ‘energy’ and the integral helper a device class of ‘total’.

Checking the docs, your sensor should have a device class of ‘power’ (unit is W) which if used for the integral helper will creat an entity with device class ‘energy’ (unit is kWh). I think this is why it’s not showing up for you.

I had a similar issue with Gas. I was able to go to the Statistic tab in Developer tools. There I was able to see the sensor had an issue and fix it.

1 Like

You’re right with the device class. But as I am facing the same problem I wanted to correct that but can’t. When creating a helper via GUI, there is no option to influence (or later on, change) the device class of the helper.

I am fairly new to HASS and still trying to dig my way through the concepts (coming from Iobroker and Openhab, most of the concepts are quite familiar where others are completely new).

I am trying to use KNX Sensors for production and consumption and I am receiving the same error, “last_reset is missing” on both, energy usage and energy to grid. The page you have linked to is a generic explanation of Helpers, but how are they to be set up for the energy dashboard? Furthermore, the helpers I created are not shown in the energy meters list of usable devices. Thought they would be treated like other entities?

Would be great to have a better explanation of how the energy dashboard works and how to define the entities so they can be used.

Thanks a lot.

I’m not an expert, but to clarify info from that link:

Your power sensor needs to have unit_of_measurement as W, and device_class of power. If you are configuring your KNX sensors via YAML, do so using the instructions here.
i think you will need to set state_class as measurement.

Once you have this sensor ready, then create a Reiman Sum Integral sensor via the helper section. The power sensor you created above should be available to select as the source, and it will automatically create a sensor with the appropriate unit and device_class based on the source. In this case kW/hr with device_class of energy. This will then be available in your Energy dashboard.

Thanks for coming back so fast :wink:

Unfortunately with KNX, device_class cannot be set. What worked though, is setting the state_class to “total_increasing”, which made the error regarding “last_reset” go away. Now the sensor seems to be accepted at least.

The unit for measurement for KNX sensors is already predefined by the type and can’t be defined with unit_of_measurement.

For Gas, there is a different problem, as I got the impression that the sensor would only be accepted when it is of device_class “gas”, which is (as stated above) not supported by the KNX funktion in HA.
So with kWh and m3 as units of measure being defined by the type, I’d guess the energy monitor is taking this for a electricity value and does not recognize it as gas (which is metered in m3 or kWh as well)

Is there a way to create kind of an generic alias object that can be fed by the KNX objekt but is presented to HA as a different entity?


You can use customize: in yaml to modify any entities attributes.
Or wait till the next release. Add ability to set device class on knx sensor by elupus · Pull Request #81278 · home-assistant/core · GitHub
Some Knx type definitions already set device_class by default - wherever the DPT fits.

Cool, so I then need to wait. As kWh for electricity are the same DPT as kWh for gas… the DPT defines only the unit of measurement, not any type of usage. Hence I guess kWh are currently recognized as electricity.

In the meantime I am going to give that “customize:” tag a try

Thanks !

Ok, got it working. In case somebody else uses KNX sensors and can’t figure this out:

    - name: "Haus Zählerstand Bezug"
      state_address: "13/4/31"
      type: active_energy_kwh
      state_class: total_increasing
    - name: "Haus Zählerstand Einspeisung"
      state_address: "13/4/32"
      type: active_energy_kwh
      state_class: total_increasing
    - name: "Gas Zählerstand m3"
      state_address: "13/5/0"
      type: volume
      state_class: total_increasing

      device_class: gas
      unit_of_measurement: "m³"

Now you can use the Entities in the configuration for the energy dashboard. After some minutes you’ll see the dashboard populate.

Have a great weekend

ps: unfortunately, for GAS you can only use “m³” (be sure to not use “m3” instead) but not kWh, as we pay for gas in €/kWh and the calculation factor between m³ and kWh is slightly different in every area.

Thank you for the information because KNX associated with Home assistant is not usual and it is difficult to find information.
The gas consumption display works and I tried to reproduce the same for the water consumption but I encounter a problem.


#Compteur gaz 
  - name: compteur_gaz
    state_address: "9/7/1"
    type: "volume"
    sync_state: every 30
    state_class: total_increasing

#Compteur eau (litres)
  - name: compteur_eau
    state_address: "9/7/12"
    type: "volume_liquid_litre"
    sync_state: every 30
    state_class: total_increasing


  device_class: gas
  unit_of_measurement: "m³"

  device_class: water
  unit_of_measurement: "L"

the device class “water” is not accepted and I have this error message

Value is not accepted. Valid values: “apparent_power”, “aqi”, “awning”, “battery”, “battery_charging”, “blind”, “carbon_dioxide”, “carbon_monoxide”, “cold”, “connectivity”, “current”, “curtain”, “damper”, “date”, “door”, “duration”, “energy”, “frequency”, “garage”, “garage_door”, “gas”, “gate”, “heat”, “humidity”, “illuminance”, “light”, “lock”, “moisture”, “monetary”, “motion”, “moving”, “nitrogen_dioxide”, “nitrogen_monoxide”, “nitrous_oxide”, “occupancy”, “opening”, “outlet”, “ozone”, “plug”, “pm1”, “pm10”, “pm25”, “power”, “power_factor”, “presence”, “pressure”, “problem”, “receiver”, “running”, “safety”, “shade”, “shutter”, “signal_strength”, “smoke”, “sound”, “speaker”, “sulphur_dioxide”, “switch”, “tamper”, “temperature”, “timestamp”, “tv”, “update”, “vibration”, “volatile_organic_compounds”, “voltage”, “window”.

The device class “water” is well mentioned in the documentation sensor (devices)
The problem is the same with the device class “volume”