Custom Energy Sensor

Hi there!

I am using a calculated template sensor to provide a measurement of 3-phase power. This power then gets integrated (rieman sum integral) to an Energy. Now I want to add this energy to the Energy dashboard, but somehow it does not show up…

  - platform: template
        friendly_name: "Tiny House Leistung Summe"
        unit_of_measurement: "W"
        value_template: '{{ states("sensor.l1_leistung") | float + states("sensor.l2_leistung") | float + states("sensor.l3_leistung") | float }}'
        device_class: power
  - platform: integration
    name: "Tiny House Energie"
    source: sensor.tinyhouse_p_ges

What did I forget?

Best regards


For it to appear, you need to specify both device_class and state_class. Furthermore, the device class must be energy (eg. kWh), not power (eg. kW). In your case, you can use Riemann sum integral helper as described here to convert to energy. If you use this, the state_class would be set by the integration to “total”.