I have seen some people in the community (including myself) struggle to get the IRK for the Private BLE integration.
In the documentation, the documented way is using Keychain on a MacOS device. But not everyone that has an iPhone has access to a MacOS device.
After searching around on the internet I found a way to get the IRK without using MacOS, but with a ESP32.
1. Setting up Arduino IDE
First, download and install the Arduino IDE (Download link).
After installing you want to add support for the ESP32 boards or the M5STACK boards.
ESP32
Open the Arduino IDE and click the second icon down in the left hand bar.
Search for “esp32” and install the one by “Espressif Systems”.
The IDE is now ready for your device.
M5STACK ATOM
Open the Arduino IDE and click “File” in the top left corner and click on “Preferences”.
2. Installing the software on the device
I found the following code online, This is not my code, i am not responsable if you run this code!
Download the code from Github by pressing the green “Code” button and clicking “download Zip”
Extract the contents of the zip
In the Arduino IDE - Open the “esp32_get_irk” folder and open the esp32_get_irk.ino” file
Connect the ESP32 (or M5STACK atom) to the computer
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.
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
In the top right corner, click on the magnifying glass (on windows Tools/Serial Monitor), this will open the serial monitor.
I followed your instructions and it worked first time, great! In order to use this with ESPHome ESPresence, take the number you have in step 4.1 and reverse the order of each pair of numbers so that you end up with a 32 digit hex number. Using the IRK above you would get 41CF…1B1A.
You can then add that number into the Known BLE identity resolving keys field in ESPresence configuration.
Just download the app on AppStore, it has a pairing Apple Watch app which will be automatically installed to your Apple Watch. Thereafter just launch the app on your Apple Watch itself - it can be found in the list of applications.
Did you have to add anything else to the hex number in irk field on espresence config page? My device shows not home and wonder if i’m missing something.
No, just enter the 32 digits. The integration seems to do a sanity check, so it will reject the IRK if it doesn’t see it nearby. You could try enabling debug logging for the integration, and have a look at this github issue for some help.
Awesome, I got it to finally show up in ESPresence but it seems to switch to not home after getting picked up by each room sensor. It will connect for a max of 2 or 3 minutes. Any suggestions?
For whatever reason the app is not installed on my apple watch after installing on my apple phone. Any ideas what I can do??
I already uninstalled an reinstalled the app on the phone.
Did reboots of both devices.
Hi!
Yes, this is enabled … the app is also not presented to be available to be installed at the very bottom of the app-list in the watch app on the iphone.