Cannot add Reimann Sum to energy dashboard

I have a sensor template that convert a UPS load into Watts:

template:
  - sensor:
      - name: "Office UPS load (Watts)"
        unique_id: office_ups_load_watts
        unit_of_measurement: W
        device_class: power
        state_class: measurement
        state: "{{ (300 * (states('sensor.officeups_load')|int / 100))|int }}"

I also have a Reimann Sum calculation to work out total energy used:

  - platform: integration
    source: sensor.office_ups_load_watts
    name: ups_energy_used
    unit_prefix: k
    round: 2

The calculation appears to be working as expected, the instant load shows (for example) 97 W and the energy graph shows (for example) 0.6 kWh. So far so good.

However when I try to add the integration to the energy dashboard it doesn’t appear in the dropdown list.

An integration from the current clamp monitor works as expected for the house energy usage but I can’t get this new one to appear.

Is it because the sensor is a template sensor and not a ‘real’ one? Or have I configured something wrong?

What are the attributes of your Reimann Sum entity?

state_class: total
source: sensor.office_ups_load_watts
unit_of_measurement: kWh
device_class: energy
icon: mdi:chart-histogram
friendly_name: ups_energy_used

Pretty sure that state_class needs to be total_increasing.

1 Like

I can try swapping it but before I do this is the history of the integration, which looks correct:

image

Hey Tom,
Did you have any success here - I seem to have a similar issue.

It does appear that the Energy Dashboard only consumes sensors with a state class of “total_increasing” which means that the dashboard is smart enough to read an increasing sensor for example “Today’s Solar Energy Generation” measured in kWh – it will sample the sensor and take the difference between the previous value and the current value to determine the amount of energy generated during that sample and graph it for you

Checking further, I was able to get my Integration sensor added to the Energy dashboard after customizing the device_class.

homeassistant:
  customize:
    sensor.current_solar_power_generation_kwh:
      icon: mdi:flash
      device_class: energy

The attributes are listed as seen below – notably my state_class is “total”

state_class: total
source: sensor.envoy_current_power_production
unit_of_measurement: kWh
icon: mdi:flash
friendly_name: Current Solar Energy Production
device_class: energy

I’d put this to one side for a bit but will try again over the weekend.

@Puneit_Thukral
I’ve not changed anything and the option now appears on the energy dashboard as an option. An update must have fixed it.

1 Like