Gas sensor shows up in eneregy dashboard but reports zero

I have an ESP monitor my gas meter with this config.

# gas meter
  - platform: pulse_counter
    pin: 21
    name: "Gasverbrauch"
    update_interval : 60s
    filters:
      - lambda: |-
          static float total_value = 0.0;
          total_value += x * 0.01;
          return total_value;
    unit_of_measurement: "m³"
    accuracy_decimals: 2
    icon: 'mdi:fire'

Various tips on the forum suggest to add the device and state classes, so my customize.yamlreads

sensor.gasverbrauch:
  device_class: gas
  state_class: total_increasing

All ends up in HA, where the developer tools show

state_class: total_increasing
unit_of_measurement: m³
friendly_name: Gasverbrauch
icon: mdi:fire
device_class: gas

Sadly, the energy dashboard refuses to show anything other then … zero. I’m running core-2021.9.7 if that matters. Anyone any idea?

Hi
Look at mine
You have to add a way to cumulate your counter


# Consommation gaz
  - platform: pulse_counter
    id: gazpar
    pin: GPIO26
    name: "Gazpar debimetre"
#    name: "Gazpar TIC"
    state_class: measurement
    internal_filter: 13us
    update_interval: 1s
    filters:
      - lambda: return (x * 10); # 1 impulsion = 10 l

# Consommation Total gaz Journalière
  - platform: total_daily_energy
    name: "Gazpar Conso Gaz du Jour"
    state_class: total_increasing
    device_class: "gas"
    power_id: gazpar
    unit_of_measurement: "m³"
    accuracy_decimals: 3 
    id: gazpar_conso_gaz_du_jour
    filters:
      - lambda: return (x * 0.001*60);

Hi,

how did you manage to add this to your gasmeter energy dashboard?
Mine refuses to add my gas_consumption sensor:

configuration.yaml:

# For the gas usage sensor
sensor:
  - platform: template
    sensors:
      gas_meter:
        friendly_name: Gas Zähler (gesamt)
        unit_of_measurement: "m³"
        icon_template: "mdi:counter"
        device_class: gas
        value_template: "{{ states ('counter.gas_zahler_rohwerte') | float(0) * 0.01}}"

and (in the customize section of configuration.yaml

    # gas energy sensor  
    sensor.gas_meter:
      device_class: energy
      state_class: total_increasing
      accuracy_decimals: 2
      last_reset: '2022-09-27T00:00:00.000000+00:00'

My energy dashboard refuses to add my gas meter:
image

EDIT:
Actually I can add the gas_meter mentioned above (does not show data).
But I cannot add the monthly / daily gas consumption based on this sensor (Utility Meter)

Well, I didn’t add sensor.gas_verbrauch_tag to the energy dashboard.

I added the sensor that is defined for the ESP (sensor.gasverbrauch), see home-assistant/gas4.yaml at main · swa72/home-assistant · GitHub. Additionally, my customize.yaml includes

sensor.gasverbrauch:
  device_class: gas
  state_class: total_increasing

Thanks,
your “customize” section is in my configuration.yaml as well (changed energy to gas like in your case).
it still does not show data.