Skip to content

How to get the IRK (Identity Resolving Keys) for iOS, Android etc

Ashley Gittins edited this page Oct 4, 2024 · 1 revision

Devices that use IRK and randomised mac addresses can be reliably tracked in Bermuda by installing the Private BLE Device integration which is part of HA core. You then need to tell Private BLE Device of the IRK for each of your devices.

This page documents the various ways I know of to find the IRK. Please let me know if you find others!

This works for:

  • iOS devices like iPhone, iPad
  • Android phones
  • Less-simple watches like Apple iWatch, Samsung watches etc

I plan to create an easy way to get the IRK of devices, but in the meantime, here are the various methods that I'm aware of, and what they work for:

FryeFryeFrye Firmware

https://github.com/fryefryefrye/Decoding-Random-Bluetooth-Address offers firmware that you can flash to an ESP32 device. It will create a BLE controller that you can connect to. When you do so, it will emit the IRK via the serial port. This works for iPhone, Android and likely anything else. The IRK it gives you should be pasted directly into Private BLE Device's key field. There is a step-by-step guide to using this process here, and might be a great place to ask if you run into difficulties.

  • Pros: Works on iPhone, Android, probably others. A guide exists.
  • Cons: Requires flashing an esp32 for just this purpose, requires connecting via serial to monitor for the IRK once paired (this is easy if you are using the Arduino IDE).

Macbook Keychain

Described in the Private BLE Device setup docs. I suspect (but am not sure) that this might work for any device paired with the macbook, including Androids. But I have not tested that.

  • Pros: relatively easy, if you have a macbook. Works with iPhone, Apple Watch, maybe more.
  • Cons: relatively impossible, if you do not have a macbook

Android debugging logs

Use debug logging in Android, plus wireshark. This captures the negotiation on an Android phone while you pair to another device. After saving the debug logs to a PC, you can use Wireshark to analyse the traffic, and identify the IRKs for both devices in the connection. Ignore the bits about ESPresence, you only need up to the Wireshark steps to capture the information.

  • Pros: Should work with any Android and any device the Android can pair with
  • Cons: Pretty complicated. Requires a PC, the Android Debugging SDK and Wireshark. Probably not worth it if you're not already somewhat familiar with those tools, but then, anything can be a learning opportunity!

Copy the keys from an existing (or new) ESPresence installation.

  • Pros: Easy if you are migrating from an existing espresence setup
  • Cons: Probably a lot of work compared to the other options if you're starting from scratch.