Scan devices in ip range and precense detection

I hope someone can help me?

I would like to scan for people who using my wifi Guest connection.
If someone is connected, input boolean Guest has to turn on and change behaviour of some automations.
so i can make a ip range in my router (ubiquiti AP’s in house) for the guest wifi.

How do i detect if someone is connected and make automation for that?

Maybe nmap?

From my experience, nmap is not so reliable… Mine shows a lot “home” however when I’m not connected, and no matter how low I set the time interval to check…

I dont want to specify ip adresses. Or is it possible to nmap a range?
I already using it for 4 ip adresses, can that be together?

From the page I linked you to:

The IP addresses to scan can be specified in any format that Nmap understands, including the network-prefix notation (192.168.1.1/24) and the range notation (192.168.1.1-255).