How to configure a Sensor so that is useable in in the energy Dashboard

I have similar issue. I have sonoff device that gives output as power W, i tried reimann through UI but … couldnt get it working, not shown anywhere in energy dashboard :frowning:

It’s not surprising for the sonos which exposes a power (in W) while the energy dashboard expects an energy (in Wh).

i know, this is why i tried riemann sum integral. I just dont know how to set it up, do i need to make it via configuration.yaml ?

And, im a complete noob on these things :slight_smile:

There’s no need to do anything in yaml anymore. You can do everything from the UI…

Create a new helper using the Riemann (make sure to give it a new name and select your sensor) than wait a bit and you should have the sensor available in the energy dashboard.

The new energy sensor can also be visible in the Developer tools > States… Take a screenshot from there with the attributes and share it here if you still having issues.

1 Like

Yes, thank you. I was just too hesitant, needed to wait for it to get something to show :slight_smile:

In my case with a value already in m3, so the Riemann conversion does not seem to be the solution?

Dear,
I created a Sensor (Arduino) which give a value in M3.
I need to convert to energy (Wh) by simply make a conversion (multiplication by +/- 10).
It is something similar to Riemann but no “integration” but easier a multiplication.
Is it possible to create a HELPER which do a multiplication and change the unit to Wh ?
If not, I need to do it in my Arduino and expose energy directly. But I suppose other device on the market expose volume and need to be converted to energy.
Thank a lot

You can create a simple template sensor.

Something like this:

template:
  - sensor:
    - name: Your new sensor name
      unique_id: your_new_sensor_unique_id
      unit_of_measurement: "Wh"
      device_class: energy
      state_class: measurement
      state: >-
        {% if is_number(states('sensor.your_existing_entity_id')) %}
          {{ states('sensor.your_existing_entity_id') * 10 }}
        {% else %}
          {{ states('sensor.your_existing_entity_id') }} # this will catch any 'unknown' states from the source sensor and replicate that to the new sensor
        {% endif %}
1 Like