Gas consumption will show costs but no m³ and a strange error message

Hi,

my dashboard will not show any m³ but the corresponding costs.

After i added the sensor this message shows up:

This is the config of the sonsor:

template:
  - sensor:
      - name: "Gasverbrauch Total"
        unit_of_measurement: "m³"
        state: "{{ states('counter.gaszaehler')|int * 0.01 }}"
        state_class: total_increasing
        device_class: energy

My techn. config:
I check the state change of an KNX binary sensor via automation and increase a counter each impulse.

Can anybody explain that to me? :slight_smile:

Thank you very much!

BR
Andreas

Change that to device_class: gas. After you update your template have a look at the sensor by going to the statistic tab of developer tools. That would have saved me and some other people a bunch of wasted time had we known to do that. You may have to click the “fix” button there because you changed the sensor.


- sensor:
    - name: daily customer charge increment
      device_class: gas
      unit_of_measurement: 'ft³'
      state_class: 'total_increasing'
      state: >-
        {{ ((now().strftime('%j') | float) - 1) + (1/24 * now().strftime('%H') | float)  }}
1 Like

Perfect this solves the issue. :slight_smile:

Thank you so much!

1 Like