Energy tracking


I just bought a Sonoff Pow R2 and flashed it with ESPHome.
Everything works, the relay, the power, current and voltage sensors.

Now I want to add it to the new energy dashboard as a individual device, but it doesn’t show in the dropdown list.
When I click the “Why is my entity not listed?” option it explains the statistics need to be configured in the integration.

Is there any way to configure this? Or does ESPHome not support this (yet)?

I don’t think ESPhome supports this. In any event for energy monitoring you need an energy sensor not a power sensor.

So make a template sensor integrating power to energy

Yes you can, using this:

If you have the power in Watts

  - platform: total_daily_energy
    name: "Total Daily Energy"
    power_id: plug_power
        - multiply: 0.001
    unit_of_measurement: kWh
    device_class: energy

or you can use this in HA:


Thank you for your reply!

It now show up as an individual device :smiley:

Hi Guys,

I have tried going the Riemann way to get my Tuya smart plug in the individual device section. Like so (it’s measured in W)

  - platform: integration
    source: sensor.office_power_current_consumption
    name: office_power_total
    unit_prefix: k
    round: 2

it creates the sensor and looking in the developer tools it looks like this.

state_class: measurement
last_reset: '2021-08-19T14:49:20.279125+00:00'
source: sensor.office_power_current_consumption
friendly_name: office_power_total
icon: mdi:chart-histogram

it’s still not showing up in the dropdown. Am I missing something in my configuration file :slight_smile: ?

1 Like

Try adding device class and changing last_reset.
Here’s an example

state_class: measurement
unit_of_measurement: kWh
friendly_name: PZEM 004T V3 Energy
device_class: energy
last_reset: '1970-01-01T00:00:00+00:00

Should be in the docs.
I have created a pull request.