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.
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.