Tracking Energy through MQTT sensors

Hi,

I own my own MQTT based sensors to track my electrical power consumption (based on french “téléinfo”).

I could enable both instant power consumption and total counter on my dashboard as simple sensors.

Now I want to enable them in the power consumption tracking, but the wizard does not allow me to select them:

image

I tried many different configuration like:


sensor:
    - name: "Linky PAPP"
      state_topic: "linky/papp"
      device_class: power
      state_class: measurement
      unit_of_measurement: 'kW'
    - name: "Linky CPT"
      state_topic: "linky/cpt"
      device_class: energy
      state_class: total_increasing
      unit_of_measurement: 'kWh'

Can someone give me the exact criteria to enable my sensors as “Energy trackable” ?

Thanks !

That is your problem.
You need to have kWh and for that you need a Riemann sum integral.

Thank you !

I finally came up with this:

sensor:
  - platform: integration
    source: sensor.linky_papp
    name: "Consommation Linky"
    unit_prefix: k
    round: 2

And I could select it in the Energy dashboard.