Gas KWh not included in total energy use

In the graphic representing my homes energy usage, it shows the energy used from Gas in KWh, but doesn’t include this in the total energy used by my home. Gas usage is being recorded and showing in the charts and cost calculation.

Is this a bug in the Energy dashboard, or deliberate - in which case what is the thinking?

Yes this is a bug that the developper does not consider as an urgent matter to fix.
The more we will ask for a fix, the more we will have a chance to have this fix
Thank you for your mail

1 Like

How did you manage to get gas in kWh?
For me it only works when the unit of measurement is m3.

(My version info: Home Assistant 2022.11.4
Frontend 20221108.0 - latest)


I created a template sensor that converts the m³ provided by my device to kWh by multiplying the m3 value by 11.36267.

The full equation is:

(Gas consumption in m³ * Calorific value of gas (typically 40 MJ/m³) * 1.02264 for correcting for expansion and pressure) / 3.6. This is specified by UK regulations.

Use device_class: energy and state_class: total_increasing so that HA will allow selection of the entity in the energy dashboard.

1 Like

Thanks! So it is not yet there by default (wanted to make sure I didn’t miss it).

Just for others in case they came across this, the multiplier is not a fixed value; one can find it in the utility bills, where m3 is converted to kWh (or simply ask their energy provider).
(In Germany for example, the number is different if one is using natural gas or LPG…)

In France we have a web server that gives the value as mean, max, min depending upon the exact location

1 Like

Hi, could you share your config for this? Also in the UK and want to get my gas cost into the energy dash. Thanks.

      - name: 'Total Gas Used kWh'
      state: "{{ state_attr('sensor.geo_energy_usage_total','totalConsumptionList') | selectattr('commodityType', 'equalto', 'GAS_ENERGY') | map(attribute='totalConsumption') | first/1000*11.36267 | round(2) if is_state('sensor.geo_energy_usage_total','guid') else 'unknown' }}"
      unit_of_measurement: "kWh"
      device_class: energy
      state_class: total

Note that this is quite specific to the sensor I was using which was sensor.geo_energy_usage_total and had the data stored in an array attribute. However you get the m3 value you need to use /1000*11.36267 | round(2) to convert it to kWh and round it to 2 decimal places.

I’m now using the Geo Energy integration which does all this internally.

1 Like

Does this fix the original issue with the gas consumption not being added to the total house consumption? I have the same issue as the original poster and even though I have the gas consumption showing in kWh (I get that directly from a Glowmarkt Glow CAD) it’s still not added to the total house usage.

Good question
This is as well my request to get the total
But always refused for obscure reasons
The more we are to ask the best chances we’ll have to win !

No it does not. The gas energy just isn’t added to the total. I don’t believe this works for anyone.


I am wondering as well if this “problem” will be fixed.

It will not as developpers already refused several times
Let us insist !

This impacts both the chart showing total energy usage and the one showing percentage of energy from carbon free sources.

Both should be changed
This is what I already asked for

I’ll join in. For me, gas consumption is also not added to the total household energy consumption.
This is highly confusing and actually just plain wrong.

Bildschirmfoto 2023-04-18 um 10.27.14

Hi, Just spotted your reply. Am an engineer but new to Home Assistant. Can you share more about how to create such a sensor template.

It really depends how you are getting your m³ value. I get mine from Geo Together, which presents it as part of an array.

My template sensor looks like this:

    - unique_id: geo_gas_usage_total_kwh
      name: 'Total Gas Used kWh'
      state: "{{ state_attr('sensor.geo_energy_usage_total','totalConsumptionList') | selectattr('commodityType', 'equalto', 'GAS_ENERGY') | map(attribute='totalConsumption') | first/1000*11.36267 | round(2) if is_state('sensor.geo_energy_usage_total',my_unique_id) else 'unknown' }}"
      unit_of_measurement: "kWh"
      device_class: energy
      state_class: total

In the state line you can see the equation for converting to kWh, amongst a lot of Jinja templating code.

Unless you are also using Geotogether to get data from your smart meter, your code would likely look somewhat different as it really depends on how your device presents data. Each section of that line separated by a pipe (|) takes data from the left and applies a transformation to it and then passes it to the right, until you get the data in the format you want. Steep learning curve, for me at least.

And if you are using Geotogether I recommend using the Geo integration from HACS which is way easier. I had forgotten I still had those template sensors in my config till just now.

Happy to help further.

I’ve just logged a ticket on Github because it seems crazy that this issue hasn’t been fixed yet.

Hi I already had a lot of discussions with HA development team about that topic.
They just don’t want !
So the more we are to ask, the more chances we will get it
Thanks for your GitHub issue