Best practices for presence detection

Hi,
I'm trying to figure out how to manage a pretty classic presence detection management.

I have multiple devices that can be detected near a light. If only one of them is close then I have to turn on the light but I don't have to turn it off until all the devices are far away.

I'm still new to node-red so I still have problem with the flow approach and I'm thinking about a simple boolean approach.

I just can check all devices status with an OR but I'm not sure it's a best practice.

Do you have any advice?

What kind of devices?
If we are talking about detecting presence of smart phones, in my case iPhones, I definitely say Monitor is very good. Have been using it successfully for more than a year now

I'm using room-assistant (more as a proof of concept) but right now I'm more interested in how to manage in node-red a generic situation that could be handled with a simple "OR" in a classic programming style.

Without knowing what devices or the protocols it's difficult to say.

Your language suggests you are thinking in a procedural / polling manner.

Node-red is much better suited to event based programming e.g. when a device is detected, an event occurs (e.g. a node fires it's output) then using other nodes, you determine what to do with that.

If you provide more details, I'm certain someone can steer you.