Yeah, I’m also not sure why the iBeacon Tracker coders made it work like this. The integration docs say:
Randomized MAC addresses
iBeacons with a randomized MAC address will be combined into a single set of entities once the integration discovers the same UUID, Major, and Minor combination has been seen coming from 10 or more MAC addresses. This allows distance and presence detection based on the last reporting data. When using randomized MAC addresses, only one device must broadcast the unique UUID, Major, and Minor combination.
In the world of iBeacons outside of HA, very few people use MAC addresses for anything. Just let the scanner look for your target UUID/Major/Minor and then trigger some action if it is close enough or far enough or gone. That’s it.
My guess is that this is a security feature so that someone can not simply configure another iBeacon with the exact same UUID/Major/Minor. In other words, making another iBeacon with the same UUID/Major/Minor and MAC address is not something that your basic local thief easily can do. So I suppose that’s why they added MAC scanning into the process.
Your question about how they actually implemented this is a good one. Might be nicer if the “beacon” appeared on the list when it first gets scanned, then later when it shows up again with a different MAC, it should get an asterisk with a note like “this beacon is under security review due to multiple MACs being associated with the same UUID/Major/Minor. If you are using a virtual beacon on your smartphone, this is normal. Please wait until the system confirms”…something something.
Of course, I don’t know how to code an integration, so I’m basically being a Monday morning quarterback here. I’m sure the coders put a lot of hard work into building this.
That said, from the forums, this issue seems to be causing 99% of the problems with this integration. Solution? Just use one of my actual iBeacons and don’t use your phone to badly emulate an iBeacon!
Re ESPHome: The way the ESPHome beacon setup process scans for beacons and then lets you select your target beacon is weird too. It seems like a user friendly way, but in practice, it causes lots of problems (at least from what I have heard). Why not just let users manually enter the UUID/Major/Minor of their target beacons? Some manual typing of long numbers will be involved, but I think it would be easier in the end. Maybe this manual entry is actually possible in ESPHome? If so, I would suggest ESPHome users skip the “scanning for your beacon” setup feature and just enter it manually.
By the way, be careful when using random BLE scanning apps to try to get your beacon’s actual UUID/Major/Minor. Almost all of them will NOT show you the correct info; in fact, they will show you data that looks very similar to the UUID but is not correct. It’s always best to use your beacon’s specific configuration app to get that info. That’s the only way you can be sure you are entering the correct data in ESPHome.