GUIDE - Getting the IRK for iPhone and Apple Watch without MacOS (Maybe also other devices?)

Thank you @legoracers for finding that app! ESPresense can pair securely using that as well! I’ve updated the documentation:

1 Like

Hi, I’m struggling to make Bluetooth terminal app in my AW connect to ESP_BLE_Security.

Basically if i click on the voice in the menu nothing happens (while I successfully managed to do it with my iphone).

Any hint?

Thanks!

Thanks for your GREAT guide!

[quote=“legoracers, post:1, topic:623694”]
This value is the decimal value of the IRK key, but Home Assistant expects the base64 encoded version of this key. Use the following website to encode the key Base64 encoder
[/quote]

Please note the integration docs state at Private BLE Device - Home Assistant

> There are two common representations for encoding an IRK - base64 encoding or hex encoding. This integration supports both.

So there’s no need to use the Base64 encoder, isn’t it?

Forget about it, I tested it - the Base64 encoder is (still) necessary.

Unfortunately those basically unsolved issues

kill all the fun and practical usage of this great integration. In my case it takes from 15 to 20 minutes (!) after leaving (or turning off bluetooth on the iDevice) until the device_tracker entity switches from home to not_home. That makes all of my use-cases pretty useless.

Another minor issue discovered so far is, that after the device left, all sensor.* entities (not the device_tracker.*) render unavailable`.

If someone has an idea on that way to long “has left the house!” period, I’d be very glad to hear.

(edit: see "Private BLE Device" integration: way too long away detection time (and no "consider_home") for this discussion)

Could somebody please tell me what i am doing wrong?

There is a folder called “esp32_get_irk” and when i tried to raname that to “esp32_irk” and open the ino file, Arduino gave me a message that it should be in a specific folder that had to be created. So i pressed OK.


then i had to verify the file

But eventually i got error messages and renamed the folder back to “esp32_get_irk”

BUT…

I’ve got an Atom M5STACK (AtomS3 Lite) and chosen this:

But no matter what version i use, i get this:

or

Does anybody have got a clue on what i am doing wrong?

When trying to install I get this error:
Compilation error: esp_bt.h: No such file or directory

Anybody knows what I’m doing wrong?

There’s been some updates to the Decoding-Random-Bluetooth-Address project and the instructions can be simplified:

2. Installing the software on the device
I found the following code online, This is not my code, I am not responsible if you run this code!

  1. Download the code from Github by pressing the green “Code” button and clicking “download Zip”
  2. Extract the contents of the zip
  3. In the Arduino IDE - Open the “esp32_get_irk” folder and open the esp32_get_irk.ino” file
  4. Connect the ESP32 (or M5STACK atom) to the computer
  5. In the top bar, click on the dropdown and select the port the device is connected to.
    You will now get a prompt to select a board type, for most people it wil be ESP32 Dev Module, otherwise search for the M5STACK Atom.
  6. Click the arrow button in the top left corner, the IDE will start compiling and uploading to your device.
    If the IDE fails, check the instructions for your device on how to upload new code.

3. Getting the IRK

  1. In the top right corner, click on the magnifying glass (on windows Tools/Serial Monitor), this will open the serial monitor.
  2. Change the baud rate to 115200
  3. Download the Bluetooth Terminal app App Store link
  4. Open the app and connect to “ESP_BLE_SECURITY”
    if you get an error try forgetting the “ESP_BLE_SECURITY” device from your phone’s Bluetooth settings
  5. In the serial monitor you will get the IRK key in several foramts:
  • IRK: ,0x1A,0x1B,0x1C,0x5E,0x87,0xD2,0x1D,0x57,0x27,0x14,0x4B,0x19,0xAD,0x58,0xCF,0x41
  • IRK, Base64 encoded for the Home Assistant Private BLE Device service: GhscXofSHVcnFEsZrVjPQQ==
  • IRK, reverse order for Home Assistant ESPrensence: 41CF58AD194B1427571DD2875E1C1B1A
  1. choose the format that fits where you need to use the IRK
  2. If you want to get the key for you Apple Watch too, restart the ESP or Atom Stack, open the serial monitor and connect through the Apple Watch app.
1 Like

Thanks! I changed the guide with your edit!

Thanks for that manual!

For Android phones I just installed the Arduino ino on a ESP32, opened the serial and connected from the device I wanted to find without installing any application. Works like magic!

1 Like

Not sure I understand these instructions. Are you saying you didn’t need to install the “Decoding-Random-Bluetooth-Address” arduino app from the github? It would be great if you could expand slightly. I tried directly pairing the android phone to the ESP32 with the “Decoding-Random-Bluetooth-Address” application, that didn’t work. What did you use to “connect from the device”? I downloaded the “Bluetooth Terminal” program from google play (There were several the one which had OxYmora Technology as the developer) worked. Any idea how to the IRK from a pixel watch. I did an initial google but nothing came up so far. Thanks

Thank you SO MUCH for this comment, it lead me to finding what I needed.

For anyone else finding this, I managed to pull out the IRK from my keychain on my Mac (even running Sequoia) by following the instructions at the link and finding another comment which directed me to opening Keychain manager (instead of the new Passwords app) by going to /System/Library/CoreServices/Applications and opening it from there.

Hope this helps someone else!

Is it possible to to get the IRK from Airtags?

No, unfortunately not.

It’s a real shame that we can’t get the IRK from BLE trackers :confused:

There’s a HACS integration to track Samsung Tags through Smartthings which did work, but my phone screen kept waking up every couple of minutes even though it was disabled from tracking in the integration, so that had to go.

For whatever reason I couldn’t get the Github Arduino code to work on my ESP32 devkit.

However, using espresense to grab the IRK was a snap. I just flashed firmware from the web portal, put in my wifi info (it said it didn’t connect but I just clicked the in-page back button), clicked “visit device”, enrolled my phone, and grabbed the IRK. More directions here from another very helpful user.