Convert kw to kwh with new sensor template for energy dashboard

Hi all,

There are many posts about “how to convert w to kwh” on this topic. However, most of them end in “could you tell me how you didi it”, “how did you do this?”, etc. Most of the confusion, I think, comes from the fact that there were recently changes in the sensor template that also requires new tags (for example “total increasing” etc.).

Many youtube tutorials use the utility_meter which does not work with the energy dashboard (at least I cant find the sensor).

So, my assumption is that it would be best to use the Riemann integration.
I would therefore go the following steps:

This is my Input Sensor, quite peaky. It shows the actual kw/Power/Gas used.
Actual_power

to get kwh, we need to integrate this Sensor:

sensor:    
  - platform: integration
    source: sensor.actual_power
    name: gasverbrauch_kwh_integriert
    unit_prefix: k
	method: left
    round: 2

Here, we would be done. However, the Riemann Integration “Sensor” does not support the new “total_increasing” flag as required by the Energy Dashboard. As I understand, this can be fixed by a pseudo sensor.

Would this be the way to go then?

template:
  - sensor:
      - name: Gasverbrauch Dummy Sensor
        unique_id: gasverbrauch_dummy_sensor
        device_class: gas
        unit_of_measurement: "kwh"
        state: "{{ (states('sensor.gasverbrauch_kwh_integriert') }}"
        state_class: total_increasing

However, it does look like this: (integration is 0 and the sensor cant be found):

Any hints?

EDIT: It turns out that using the Riemann integration is enough. I used the Helper Widget, added the Input Sensor as source and added this to the energy dashboard. Worked! Leaving this if someone is looking for the same solution.

I tried this and it lets me add it to the energy dashboard, but I get the error

statistics_not_defined
sensor.inverter_ac_loads_kwh

Is this just a warning?