Questions about device trackers & ubiquiti

I’m using the ubiquiti integration, and in HA, there are multiple device_trackers listed for several of my mobile devices (tablets, phones, etc). I dug into them, and it appears that there is one device_tracker per MAC address. For example, if I connect to both the 2.4ghz and 5ghz networks with the same device - even for a brief period of time - I’ll end up with multiple device trackers for that device because of the different MACs for each of the radios.

Is this the normal behavior? Is there any way to override this and “glue” those two trackers into a single device_tracker? Yes, the mobile app is installed on most of the mobile devices, which uses GPS/zones to figure out where a device is. In this case, I’m looking to use the device trackers that come over from ubiquiti, specifically, to take other actions based on connectivity status of the phones, such that when one of the phones is actually away, I fire an automation.

I thought about using Group (Group - Home Assistant), but I already need to use that integration at the upper level of the logic. Can I nest Groups together? Something like ((my_phone_2.4 || my_phone_5) && wifes_phone)

Ultimately, the logic I’m looking for is roughly shown above for the HOME condition (because one of my device_trackers would always be away). For the away condition, I would need something like
((my_phone_2.4 && my_phone_5) || wifes_phone) to all show away for my AWAY condition to be met.

Yes its normal unless you turned off the device tracking features :wink:

Check out

Configuration > People & Zones > People >

Tap/select a person in the list thrn scroll to the bottom…

Add as many trackers as you want to the ‘person’. Tracking the person is an aggregate of your trackers and when you add /remove trackers you don’t need to redo your automations…

For me, I have the HA device tracker from the companion app and my tracker for the wifi connection for the mac address of my phone. False Away because of GPS bounce is a thing of the past.

So… If I’m understanding correctly, if any tracker shows “home” for a person, then the person is home, and if ALL trackers show “away”, then the person is marked as away? Is that correct?

Yep.

And then you can aggregate your ‘people’ like you planned for whole home status.

(i also add an input_boolean called guest mode to that final aggregation so I can override home away with the throw of a switch)

The guest switch may be useful for something else, but in this case, it’s the state of the devices I’m after. Since guests won’t have any devices that make a difference, whether they are there or not is of no consequence. :wink:

What I’m trying to do is work out the state detection to use with this: Automating unifi port forwarding based upon presence detection

1 Like

I can see it for that. In that case you could create two template sensors for aggregate presence. One that includes the guest mode switch and one that doesnt. Then depending on what you actually need, read that one…