Help needed with Lights automation

Is it possible to check which light is turned within a light group and use that to turn on a fan?
The logic is:
if state changes,
and state change is within a light group,
specify which light entity caused the trigger and for each light entity turned on, turn a specific fan

I’m trying to write an automation where if a particular washroom light turns on within a light group, the entity should be outputted and used to turn on the corresponding fan or do I have to write the automations per room?

You don’t have to. I have taken the tact of writing individual automations and then if I think it is worth the time investment I combine.

 alias: Bar Restroom Fan Run
 description: Turn on bar restroom fan if light was turned off
 - platform: state
   entity_id: switch.bar_restroom_light
   from: 'on'
   to: 'off'
 - condition: state
   entity_id: timer.bar_restroom_fan
   state: idle
 - service: switch.turn_on
     entity_id: switch.bar_restroom_fan
 - delay:
     seconds: '{{ states(''input_number.fan_runtime'') | int(0) }}'
 - service: switch.turn_off
     entity_id: switch.bar_restroom_fan
 mode: single