Gas usage sensor filter

Hello everyone,

I was setting up the energy dashboard for someones HA instance and while everything else worked great, I am having trouble adding the gas usage sensor.
The docs say: “Wähle einen Sensor, der den Gasverbrauch in CCF, ft³, m³, GJ, kWh, MJ, MWh, Wh misst.”

So I checked all the sensors provided by the heater and found the perfect one which looks like this:

As we can see it’s a working sensor measuring in m3.
But when I try adding it to the energy dashboard it doesn’t show up:

Only a few sensors show up, all measuring kWh.
I even went so far as to create my own sensor via a template and tried both m3 as well as kWh but even after rebooting they won’t show up either.

Can anyone help me understand what the energy dashboard frontend filter for?

Thanks and have a great weekend!

Try device class ‘gas’. I believe that’s required if you want it to show up as an option under gas.

Hey Ben,
thanks for answering!

I tried changing it to gas as so and rebooted:

Sadly, no difference…

Your cubic needs to be a superscript, like this:

unit_of_measurement: m³

And you need to define a state class of total or total_increasing I believe.

Hey, I’ve tried the unit of measurement as you stated (as well as m3 and even kWh) but again, won’t show up.
I had also tried giving it a state class but that won’t work:
'state_class' is an invalid option for 'template'

it doesnt have

 device_class: gas

You need to provide more information on this. I have integrated my gas consumption by calculating my gas consumption based on furnace burner on/off status. I created sensors and everything was recognized in ha energy dashboard.

Sounds like you’re using the legacy template sensor format, which I don’t believe supports defining the state class.

It would be immensely helpful if you posted the full YAML of the template sensor that isn’t working (properly formatted text and not just a screenshot).

Hello everyone.
Thanks for taking the time. Sure, my sensor at this point of experimentation looks like this:

templates.yaml

- sensors:
    gas_total:
      friendly_name: Gasverbrauch aktuell Gesamt
      unit_of_measurement: m³
      device_class: energy
      #state_class: total_increasing
      value_template: >-
        {{ states('sensor.vicare_heating_gas_consumption_current_day') }}

I’ve been using this format since the olden days. Hadn’t realized there’s been a change in the format.

But I’m wondering if we’re having the classic A/B-Problem-Situation.
The original question was

Why does this sensor show up in the selection:

state_class: total_increasing
unit_of_measurement: kWh
device_class: energy
friendly_name: E3_Vitodens_200_0821 Energieverbrauch in diesem Jahr

But this one does not:

state_class: total_increasing
unit_of_measurement: m³
friendly_name: E3_Vitodens_200_0821 Heizgasverbrauch aktueller Tag

Thanks, have a nice sunday!

This is my setup.
In template.yaml I have

### Buderus gas usage calculation
- sensor:
  - name: "Buderus daily gas usage"
    unique_id: furnace_gas
    device_class: gas
    unit_of_measurement: "m³"
    state: "{{ (states('sensor.buderus_on_time_today') | float * 0.065 * 60) | round(2) }}"
    state_class: total_increasing

and in sensors.yaml

### Buderus running time daily
- platform: history_stats
  name: Buderus On Time Today
  entity_id: binary_sensor.buderus_kessel_betrieb_1_stufe_2
  unique_id: 561dda8d-06a9-4322-8785-9fd364690ed2
  state: "on"
  type: time
  start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  end: '{{ now() }}'

In energy dashboard i use this sensor from template.yaml. It calculates daily gas usage based burner running time. It’s one stage burner.

Hey everyone,

switching to the new format and adding the state_class did the trick, thanks everyone!

- sensor:
  - name: "Gasverbrauch aktuell Gesamt"
    unique_id: gas_total
    device_class: gas
    unit_of_measurement: "m³"
    state: "{{ states('sensor.vicare_heating_gas_consumption_current_day') }}"
    state_class: total_increasing