I wanted to get some smart plugs with built in energy monitoring, specifically Zigbee models. There are not many but the Samsung SmartThings models are suitable and supported by Zigbee2MQTT.

They connect immediately to my Sonoff CC2531 dongle and appeared in Home Assistant.

As it happened they arrived just after Home Assistant had released their Energy Management system. When I tried to add them to the energy dashboard nothing was listed apart from a vague error “No matching statistics found” and a link to documentation. The documentation was also not so clear to me. Eventually I saw some forum threads and was able to piece together what was needed.

I edited configuration.yaml with the following entries:

homeassistant:
  customize:
    sensor.samsung1_energy:
      last_reset: "2021-07-30T00:00:00+00:00"
      state_class: measurement
      device_class: energy
    sensor.samsung2_energy:
      last_reset: "2021-07-30T00:00:00+00:00"
      state_class: measurement
      device_class: energy

Update: This has changed since late 2021. https://developers.home-assistant.io/blog/2021/08/16/state_class_total/

homeassistant:
  customize:
    sensor.samsung1_energy:
      state_class: total_increasing 
      device_class: energy
    sensor.samsung2_energy:
      state_class: total_increasing 
      device_class: energy

Using the Visual Studio Code add-on is the easiest way to make these edits.

After the restart the dashboard was live:

Energy dashboard

It’s still basic but already has been interesting to see that Samsung1 which has my server plugged in consistently uses 90W of energy. I can even see a small increase nightly after 3am when Snapraid runs a sync job which spins up all the hard drives.