Template sensor not showing up in Home Assistant

I have been trying to implement a gas monitoring setup as per this post on reddit

However, I cannot get the template sensor to show up in Home Assistant. It does not show up as an entity and there are no error message in the logs.

This is the code in my configuration.yaml that creates the template sensor:

sensor:
  - platform: template
    sensors:
      gas_meter_kwh:
        unit_of_measurement: "kWh"
        value_template: "{{ states.input_number.gas_meter_m3.state | float * 1.02264 * 39.2 / 3.6 }}"

I have been able to get the template sensor example on the home assistant website to show up, however this follows a different syntax, and I do not know how to get this to link with the rest of the setup in the reddit post linked above.

I have tried changing the template sensor to:

template:
  - sensor:
      - name: "gas meter kwh"
        unit_of_measurement: "°C"
        state: >
          {% set bedroom = 2 | float %}
          {% set kitchen = 2 | float %}

          {{ ((bedroom + kitchen) / 2) | round(1, default=0) }}

Which creates an entity called sensor.gas_meter_kwh, but that does not seem to link to any of the other parts in the example on Reddit.

Any suggestions would be greatly appreciated!

So if I uderstand correctly the state of the following entity is a number of m3 (consumption or number of m3 for a certain period of time):

input_number.gas_meter_m3

How frequently this entity is refreshed ? Is it the consumption since the last update ? or the consumption since the beginning of the day or hour ?
The formula that you have in your template transforms I think that consumption in kW or kWh

template:
  - sensors:
    - name: "gas meter kW"
      unit_of_measurement: "kW"
      state_class: measurement
      device_class: power  
      state: "{{ states('input_number.gas_meter_m3') | float(default=0) * 1.02264 * 39.2 / 3.6 }}"

More details is required to understand your project...

Thanks browetd for the suggestions.
Yes the template was to transform kW into kWh, and it is refreshed every time there was an update to the kWh reading.

I have now actually round the reason the template sensor wasn’t showing up. I had two sections of template sensors in my configuration.yaml which needed to be grouped under one template: all the template sensors together otherwise one lot of the sensors would show up. Thanks for your help!

So the right sensor and parameters are:

template:
  - sensors:
    - name: "gas meter kWh"
      unit_of_measurement: "kWh"
      state_class: measurement
      device_class: energy
      state: "{{ states('input_number.gas_meter_m3') | float(default=0) * 1.02264 * 39.2 / 3.6 }}"