As the wonderful @april.brandt has mentioned you will want to use (2) presence detection. I personally use the following:
- Life360 for detection away and arrivals
- WiFi presence detection for arrived
- Virtual presence sensor for each person
- Presence Governor to combine the presence into the virtual presence sensor based on my needs (this app allows you to tweak your preferences)
I base all rules, apps, etc off the virtual presence device.
Hope this helps!