Hi, Have been looking all over for a easier way to do the following.
Put simple, I would like to create a sensor that contains the average dimming level of all lights in a areas, being zero if all lights are off.
I can do this by creating a sensor for each light in a room using e.g.
value_template: “{{ states.light.lamp34.attributes.brightness | float }}” and afterwards creating a new sensor which is adding these together and divide by the number of lights. Works quite well in the room where I have created it. Im aware that this can be optimized a little by doing it in one go.
With 8 rooms, and 50+ lights this is deemed create errors when lamps are moved or other changes like add of remove lamps.
My YAML knowledge is too limited to determine if this can be done smarter. Any good suggestions?