Gas-calculation for energy-dashboard

Hi folks

I have an utillity_meter to monitor the runtime of my gas-burner.
I know, that my gas-burner uses 14,7 kWh

How can I bulid an entity to use as a gas-use-calculation in my energy-dashboard?

I tried this:

template:
  - unique_id: temp_
  - sensor:
      - name: "Gasverbrauch"
        unit_of_measurement: "kWh"
        device_class: energy
        state_class: measurement
        state: "{{ states('sensor.brenndauer_tag')|float(0) * 3600 * 14,7 }}"

Is this correct?

thanks,
BJ70

Yes, it is possible to add gas usage to the Home Energy Management feature if you know how much gas energy is being used in for instance kWh.

Is this the energy for one full day burn?
And is the sensor.brenndauer_tag giving the duration in days?
If so, then it should be:

state: "{{ states('sensor.brenndauer_tag')|float(0) * 14,7 }}"

to get the total amount of gas energy used in kWh (the number of burn days times 14,7 kWh per day).

No, this is the needed energy per hour.

No, it gives the duration in seconds.

So, is state: "{{ states('sensor.brenndauer_tag')|float(0) * 3600 * 14,7 }}" correct then?

No, you have to use the same time base for both inputs (time and energy), so you have to convert the brenndauer value from seconds to hours because the energy is given in kWh per hour (kilowatt hours per hour).
If the brenndauer is 1 second this is identical to 1/3600 hour, so you have to divide the brenndauer by 3600 to get it in hours.
So the template should be:

"{{ (states('sensor.brenndauer_tag')|float(0) / 3600,0) * 14,7 }}"

The result should be the amount of kWh used.
Does that make sense, and do you get an expected result?

And one more remark just to be sure: you are using a comma as decimal sign. I know this is normal in Germany, but is your Home Assistant server setup like that as well?