Turn off lights in group but not the rooms that have motion

I would like to turn on lights in rooms that are part of a light group when the robot vacuum starts, then turn them off when it docks, but I don’t want to turn off the light in a room if there is someone there (motion is on).

Any ideas how I can make it skip rooms with motion when I turn off a light group?

Hi there…the robovac is integrated with HA so that HA can see which room it is vacuuming or going to vacuum. If that is set then you can use a condition in automation to check if the lights or motion detector binary sensor is on and then proceed with automation. Its there in the UI itself. If you need any more help…please do ask

Thank you @sheminasalam. I know how to do that. This is just one example where I need to turn a group of lights on or off, but I would like to exclude those lights that have motion in the room. To make a huge automation for each light in the group seems wasteful.

Is there another way? Maybe a script? From a trigger can we call a script for each light in a group? But the script would need to be given the light entity and the motion sensor entity for the same room. How can we do that?

Since lights in the light group function as a single entity i dont think you can analyze each of it at once. You would have to check with individual lights or If you are using nodered, this could be simple with that.