I have a lot of devices that don’t have a build in power meter.
They are just ‘on’ or ‘off’ nothing else is known about them.
But I do know how much they consume (just read what is printed on the light (eg 15w), gives a good indication).
So I want to create entities that have exactly this amount of power for each light, but when the light is off, the entity shows 0, when it’s on, it shows 15w.
A good start I think would be a naming convention.
The light is called light.livingroom
So the sensor should probably called sensor.light_livingroom_power
You could try to create a template sensor that shows 15 if the light is on and 0 if the light is off and add the unit_of_measurement: 'W' and device_class: power.
I adapted the above value_template for lights that are actually dimmers. In this example I use a dimmable lightbulb that, at full power, uses 15w, and assuming dimming to 33% will effectively consume 5w. This will probably not be exact, but it is the closed I can come to the truth, considering I don’t have a power meter for each light.