#Wrong unit in energy dashboard

1 messages · Page 1 of 1 (latest)

icy willow
#

I upgraded my gas meter with a reed contact recently and get correct reading for the impulses. The meter readings are reported to HA through mqtt and are calculated in a template sensor to volume in [m³] . This works all fine so far.

  - sensor:
    # Berechnet den Zählerstand der Gasuhr in m³
      - name: Zählerstand Gasuhr
        unique_id: "ZaehlerstandGasuhr"
        unit_of_measurement: 'm³'
        device_class: "gas"
        state_class: "total_increasing"
        state: >-
          {{ (float(states('sensor.gasuhr_counter_c1')))/100}}```

I created same input number helpers  for the gas-condition-number and for the gas-heat-value. The gas-heat-value has got the unit [kWh/m³] . the gas-condition-number is free of units.

Then I created a template sensor to calculate the  gas usage in kWh.

  • sensor:

    Berechnet den Gasverbrauch in kWh

    • name: Gasverbrauch
      unique_id: "Gasverbrauch"
      unit_of_measurement: 'kWh'
      device_class: "gas"
      state_class: "total_increasing"
      state: >-
      {{ ((float(states('sensor.zahlerstand_gasuhr')))(float(states('input_number.gas_zustandszahl')))(float(states('input_number.brennwert_gas')))) | round(2) }}
Here the unit of measurement is [kWh]. But when I put this number into my energy dashbord, I get an error message regarding an unexpectes unit.
The entity used has not an expected unit. It should be (....,mWh,Wh,kWh,MWh,...) but it is kWh. ???

I am confused here. I can not see my mistake. 
It would be geatly appreciated if anybody could help me.

Kindest regards,
Poppa
barren bluff
#

device class must be energy for kWh

#

gas is for volumes

icy willow
#

@barren bluff
Thank you so much.
I am sure I had energy before and it did not work but probably I mixed something else up.
Now it is working as expecetd. Thank you again.

near kernel
#

It has to be a ulitly meter. Input that sensor to a ultitly meter and then use that for gas usage and it will work

barren bluff
#

It does not have to be a utility meter.

#

A sensor must have the right units and device class, that's all. Sometimes a utility meter can help, not always necessary.