Alias with device trackers

I realize this probably isn’t the best place for this question so I’m hoping someone will point me in the right direction. I have a phone in my house that assigns itself a new MAC address every time it reboots. The first three key pairs XX:YY:ZZ are always the same, just the last three change. Is it possible to template this so that it doesn’t keep adding new tracker entities and I won’t have to keep changing things to track this phone?

Split into its own thread - as you said, that wasn’t the best place for that question :wink:

The problem with these approach is that the first three “pairs” of a MAC address are often all allocated to the same vendor. So, If your MAC starts with 00:10:FA then it’s an Apple product (though Apple has many address blocks, so you might also have an apple device that DOESN’T start with those three pairs). So, even if this was possible in Home Assistant (it’s not, that I’m aware of) it wouldn’t be a great idea because if another Apple product joins your network, it could, quite possibly, have the same first three pairs.

A better approach would be to use one of the many GPS-enabled device trackers. Bluetooth device tracking might seem like a good alternative, but, those addresses can change too.

If you really want to take this approach anyway, your best bet will be a python_script that iterates over every device_tracker, examines the MAC and, if one matches that is also “home” turns an input_boolen on. Then, setup an automation that triggers every time a device is seen.

I suspect device_tracker will get an overhaul soon, as it doesn’t follow the more modern aspects of Home Assistant. As of 0.94 known_devices.yaml is no longer guaranteed to be updated. I say this only because, anything you write (automations, python_scripts, etc) may need to be changed in the near future if Home Assistant changes the way this is handled (as we saw in the last big release with Climate).

I’m not even sure how it’s being handled now. I use asuswrt and don’t even have a section for device tracker (I don’t think I do anyhow). I’d be happy at this point to just be able to keep the new entities from littering my screen.