-
-
Notifications
You must be signed in to change notification settings - Fork 30
How to get the IRK (Identity Resolving Keys) for iOS, Android etc
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:
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).
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
Copy the keys from an existing (or new) ESPresence installation.
Update 2025-03: @TRSx80 has successfully used this method starting from scratch, and found it fairly easy to complete. They have documented their experience with it at https://github.com/agittins/bermuda/discussions/551
You may need to enter the details of an MQTT server to complete the setup, but it is also possible this might be optional (not tested). Home Assistant has an official Mosquitto add-on that provides an MQTT service.
- Pros: Very 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.
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!
- I've not tried this method personally so can't vouch for it. @TRSx80 had a go at it, but found their initial attempts didn't succeed so moved on to another method. YMMV.