How to prioritize which entity i use for location

I have a few automations that check for home or away, mainly for heating purposes.

The app location can be funky at times: by itself or just bad reception on the phones or the fact that for my kids they arent allowed and must be kept in the lockers.

Now my unifi integration while slow to update will always mark a phone home or away. So at the moment i am using that for the heating automations and others that dont care about actual location.

On my frontend i use the person to show if he/she is home or somewhere else.
That one seems to ignore the fact that the person is away as marked by unifi and will show home because of the app location being wrong. The person has both the app enitity and the unifi entity in their device list.

Is there a simple way to prioritize the last change in location for example? So the frontend will at least show away

If any of the devices in this list show home, the person will be home.