You need to define a Template Sensor for each light entity.
An alternative is to use a custom integration that does most of the work for you: