[Solved] UniFi Binding: Dealing with MAC Randomization

I recently (finally) upgraded to OpenHAB 3.1 from 2.5.10 and finally decided to chase down an annoyance I have had with the UniFi binding. Please note this is not an OpenHAB 3 issue–I was actually having this problem in 2.5 as well but did not feel like spending time working on it.

Modern phones used randomized MAC addresses. This makes the MAC-based identification a nuisance. If I disable the random MAC on my phone then all of my OpenHAB instrumentation works great. Example working item:

Thing wirelessClient hmc_iphone "Howard's iPhone"  [considerHome=600, cid="88:a4:79:dd:ee:ff"]

Thing works fine, everything is great. If I change it to use a hostname (as displayed from the UniFi controller) or an alias I create on the UniFi controller the Thing will not work, e.g.:

Thing wirelessClient hmc_iphone "Howard's iPhone"  [considerHome=600, cid="Howards-iPhone"]

Has anyone else experienced this? I have Googled / searched the forums as extensively as possible prior to posting a topic about it.

Relevant version information:

  • I am running OpenHAB 3.1.0 via the 3.1.0-1 Debian package on Ubuntu 20.04.3 LTS, Intel
  • UniFi Bundle (naturally) also reports v3.1.0
  • UniFi controller version 6.4.54

I am going to leave this here for future reference rather than deleting it, but I believe my question was predicated on an incomplete understanding of what Apple was doing.

When I poked a bit more into the UniFi view (and enabled debugging on the UniFi binding) I discovered that in addition to the randomized MAC address, that security option also prevents any textual client-identifiers from being transmitted.

With randomization, the entry the UniFi controller comes purely as a MAC with no other identifying information.

 - UniFiClient{mac: '96:85:6b:35:bf:64', ip: 'null', hostname: 'null', alias: 'null', wired: false, blocked: false, device: null}

Great for privacy, not so much for presence triggers.

Thanks for reading.

1 Like

I dunno about Apple, but android you can choose to enable/disable that PER wifi Network. I have it disabled for my home networks for this exact reason.

Yeah, there was a bit of windmill tilting going on here and a lot that I did not pay attention to. In the Apple ecosystem you can disable it per-SSID, which is a relatively convenient solution. It actually also looks like the randomized MAC address that Apple devices generate is salted with the SSID and is the same each time for a given WiFi network. So having the Thing entry simply set to the fake MAC appears to work long term… with a sample size of a few days and one device.

I’ll probably flip other family members over eventually. But yes, just disabling it for the home WiFi network is also a totally workable solution.

Rambling post about a nothing burger. My valuable community contribution.