How to add light to Energy section?

Hello,

How can I add a light element to the Energy section? I have a few smart bulbs that give me these attributes:

I tried to use the following code, but it is always empty. I can add it to the Energy section as a device, but it would not change a value. What can I do?

  - platform: integration
    source: light.front_door_left_light
    name: 'Front Door Left Light'
    unit_prefix: k
    round: 2

I think you need to separate the power attribute (of your light) into a sensor, then use that as the source for your integration. So use the current_power attribute and that should do the job. The integration definition will produce a sensor which reports power usage in kwh using the above definition.

Thank you.

There’s no need for that. Your light has two energy attributes already. Just break one of them out with a template sensor. Either the monthly or daily energy attribute will do.

Good point, I missed that.

Something still does not work. I created the sensor:

  - platform: template
    sensors:
      front_door_left_light_power:
        friendly_name: 'Front Door Left Light Power'
        value_template: '{{ state_attr("light.front_door_left_light", "current_power_w") }}'

After that, using Customizations, I added everything else. Now this new sensor looks like this:

I restarted HA, but I still do not have this sensor on the list of devices to add to the Energy section. My question is Why?

After that, I thought that it does not like that units of measurement is in Watts, so I also added the following:

  - platform: integration
    source: sensor.front_door_left_light_power
    name: 'Front Door Left Light Energy'
    unit_prefix: k
    round: 2

This second sensor does not give me any data. You can compare both of the outputs here:

What am I missing?

You need to extract the energy attribute, not the power attribute.

Should I use monthly or daily energy reading?

Like I said:

Thank you, I appreciate the help.