Unerwartete maßeinheit (unexpected unit of measure?)

Hi all, i think i need some help since i am just can’t understand something…

i configured a gasmeter to track in in my energy dashboard and included the config in my configuration files. The sensor is working properly as far as i can tell, it shows up like this:

Its config entry looks like this:

  - platform: template
    sensors:

      gasverbrauch_in_kwh:        
        friendly_name: "Gasverbrauch in kWh"
        value_template: "{{ states('sensor.gas_meter_value')|float(default=0) * 10.3 }}" # Convert 1 m3 => 10,3 kWh
        availability_template: "{{ states('sensor.gas_meter_value') not in ['unknown', 'unavailable', 'none'] }}"
        unit_of_measurement: 'kWh'
        icon_template: "mdi:fire"
        device_class: gas
        attribute_templates:
          state_class: total_increasing

I can add it to my energy dashboard, but after that it shows the following:

image

I don’t understand what’s happening there since the unit of measure is declared in the right way (in my oppionion) as kWh. So why is there this error?

Appreciate any help

Your sensor is an energy sensor and not a gas sensor?

1 Like

Gas should be CCF, ft3, m3
Since you use kWh, i think the device_class should be energy
device_class: energy

SensorDeviceClass.ENERGY Wh, kWh, MWh, MJ, GJ Energy, this device class should used for sensors representing energy consumption, for example an electricity meter. Represents power over time. Not to be confused with power.
SensorDeviceClass.GAS m³, ft³, CCF Volume of gas. Gas consumption measured as energy in kWh instead of a volume should be classified as energy.

1 Like

Ah, i understand now. Tahnks for the advices, you where totally right. Changed device_class and the error is gone. Now i’ll have to wait tillt he first data is recognized. Hope it will show up correctly now.

Thanks again!