IRK and Identity MAC for iPhone without MacOS

Hi,

is it possible to get the Identity MAC without MacOS?

I got the IRK without any issues from ESPresence and this did it too:

BUT

for use with TheengsGateway we do need a MAC.

I don‘t get the correct MAC to run it constantly. It changes randomly.

With ESPresence enrollment it Shows the actual random MAC and with DRBA (Link) the same.

NOW i tried the PrivateBLE Device integration from HomeAssistant. It only ask for IRK.
It runs two days since now without issues:

I tried the MAC Source it Shows me under Attributes without success:

Thanks!

Welcome @nukleuz

While usually some users ask if and how it is possible to get the IRK for an Apple device without a Mac, getting the actual Identity Bluetooth MAC address is an easy one, as it is visible on the device itself in the Settings, as described at

The reason it still might not work for you when entered into Theengs Gateway, is that the IRK you retrieved through ESPresense needs to be either reversed and/or converted to base64 to be correctly recognised, i. e. to be in the same formats when being looked up on a Mac.

I hope this helps.

Thanks for the hint with base64 coded irk.
I will try, but if i take the irk how it is with the actual random MAC it works since the MAC changed…

Well, it didn’t really fully work, and random MAC address broadcasts will be picked up, but only with the Identity MAC stated and the IRK to resolve any broadcast random MAC address to then verify the result against the Identity MAC address makes it complete; to then be able to publish the received and resolved broadcasts under the always same Identity MAC/id.

This is also how you can verify if the IRK was reversed/converted correctly, when you see the correctly resolved messages in MQTT Explorer or some other MQTT monitoring application und the always sameIdentity MAC address.

I can´t get it work…

This is my Indentity BLE MAC address from iPhone: Settings → etc.:

This is my IRK (from ESPresence): d2e6e762dcf9721xxxxxxxxxxxxxxxxx

TheengsGateway --identities 0C:DB:EA:XX:XX:XX d2e6e762dcf9721xxxxxxxxxxxxxxxxx

TheengsGateway --identities 0C:DB:EA:XX:XX:XX xxxxxxxxxxxxxxxxx1279fcd267e6e2d

TheengsGateway --identities 0C:DB:EA:XX:XX:XX  0ubnYtz5cxxxxxxxxxxx==

TheengsGateway --identities 0C:DB:EA:XX:XX:XX  REeGrxjkBaxxxxxxxxxxxx==

So i tried all possible combinations. It is not working.

Do you have any suggestions?

Can you try with keeping the 8-bit octets as they are within each byte, but just reverse the bytes? So that

d2e6e762dcf972xxxxxxxxxxxxxxxxxx

should become

xxxxxxxxxxxxxxxxxx72f9dc62e7e6d2

Just make sure to remove the leading hex indicator 0x from the resulting reversal, if using the converter above.

@nukleuz

It is working fine for me here, when I am testing it the other way around, with my base64 IRK from my Mac, converted to hex and then reversed - gives the same result as entering the base64 into the ESPresense converter. And using online converters to get it back to base64 brings me back to the original.

See the link above for the byte wise reversal, and then use this hex to base64 converter

But I also just tested it with only the reversed hex IRK, which also gets recognised correctly in Theengs Gateway.

1 Like

YES, that did the trick - it´s recognized as Apple iPhone/iPad and not changing anymore :slight_smile: :wink:

1 Like

So, now i´m pretty sure there is a solution without iMac/MacOS to get all you need…

Why not mention that in the documentation!? :grinning:

COOL - thanks for your support!

Because you are actually the first person to come back with definite confirmation that an IRK retrieved by ESPresense, once reversed, is fully compatible :wink:

So far everyone we have suggested it to never got back with any confirmation or negative results.

Just for full confirmation, did you just use the reversed hex IRK or did you also additionally convert it to base64?

Good to hear it’s working correctly for you now :slight_smile:

I just use the ESPresence IRK and use your mentioned tool:

I deleted the 0x in the result.

So it would pretty cool if someone can confirm this!

Later i will try it with another iPhone…

Well, you did confirm and thanks for that :slight_smile:

I’ve also added a PR with an additional small paragraph for the documentation about how to convert IRKs retrieved by ESPresense.

1 Like

Can you tell me, how to configure the identities with theengsgatway SNAP?

I tried it with:
sudo snap set theengs-gateway identities="0C:DB:EA:xx:xx:x 447468fa814e508axxxxxxxxxxxxxx"

But it isn´t recognized by it - other BLE devices are showing the data…

Thanks!

I tried it with my work-phone (iPhoneSE) controlled by the company - i get the irk with espresense but it don´t send any ibeacons - it´s invisible…

I honestly do not know, as I have never used the SNAP version of Theengs Gateway myself, but looking at the linked to SNAP documentation, do you see any identities entry in the configuration file at all, and how does it look?

I suppose we’ll have to look into extending the documentation with these new features, as well as brining the SNAPm version up to date.

Is Bluetooth turned on at all on your work iPhone SE? It could well be that Bluetooth is restricted through a work installed configuration profile.

 "ha": {
                        "discovery": 1,
                        "discovery-device-name": "TheengsGateway",
                        "discovery-filter": "IBEACON GAEN MS-CDP",
                        "discovery-topic": "homeassistant/sensor",
                        "hass-discovery": 1
                },
                "identities": "0C:DB:EA:xx:xx:xx 447468fa814e508axxxxxxxxxxxxxxxx",
                "log-level": "WARNING",

SNAP Version is on 1.4.0…

And just for verification, did you also test the work iPhone SE with your previous setup, which I assume was not the SNAP version, where your other phone was correctly recognised and the random MAC resolved?

YES, that did the trick - it´s recognized as Apple iPhone/iPad and not changing anymore

Or have you tried that iPhone with the SNAP version as well? Just to confirm with a working setup before we try to find out the correct SNAP version definition format.

my previous setup is still there :slight_smile:
i have an rpi3b+ and i wanna use it for additional presence detection.

I´m on it to get it run…

EDIT: Yes, i tried… no success