Hi, I’ll try!!!
So for an iPhone (different practice for the watch)…
Open the web ui for your Espresense device, change the default page to http://your_espresense_ipaddress/ui. This will show a basic page as follows:
Enter the device name (I don’t think it really matters as we’re going to drop this later - in my example here I have used “MyNewDevice1”) and press enroll.
Now take your iPhone, goto Bluetooth settings and join the Espresense device (obviously you need to be in range!). Make sure that it pairs successfully, if it doesn’t, turn the bluetooth off and back on again on your device until you get a successful pair. Note that your phone will not stay connected to the Espresense for long, even after a successful pair, do not be concerned with that.
When this is done, switch to the Fingerprints link in the left menu and you should see your device show using the name you entered in the Enroll stage.
Next, to get the IRK value (not shown in the fingerprint screen), you will need to take a look at the MQTT data your Espresense is publishing. To do this, I use an app called MQTTExplorer to view all the MQTT data being published to the MQTT broker (super handy tool if you haven’t already discovered it). Under the node espresense > settings you will find an irk:your_irk_value_here entry. To confirm its the right device, if you expand it, you will find a config entry with the device name you used during the first Enroll step.
Now that you have the irk, you need to add it to your HA configuration.yaml as a sensor:
The device_id is where you put the IRK value, you need to enter it as follows (note that I have mine extracted to the secrets file which is a good practice):
device_id: "irk:abc123etc"
You should also then visit the default config page on your Espresense device to populate the configuration with the known IRK number. Note the format here is without any irk: prefix, just the value and for multiple irk values, space separate them. Ideally, register all your devices in one session on a single Espresense device and add all the IRK values to one, and then copy and paste the entire string into all your other Espresense device configs.
So the next part I found a bit fickle. But because the device is “Enrolled” with whatever name you used, this is what is published to MQTT (initially at least), not the IRK number…
To resolve this, I delete the espresense/settings topic on my MQTT broker and restart the espresense device that I did all the enrolment on. There’s a bit of a timing knack to this as they seem to re-populate from each other. I would have thought that this means you should be able to not have to use the IRK values in HA at all, and just use the enrolment names, but I found that this doesn’t work across multiple Espresense devices, whereas using the IRK values does. YMMV
Hopefully you have the MQTT broker installed in HA already, which should pick up these entries after a restart possibly.
You should also have a sensor entity in HA for the device you enrolled.
And then if you look at the state history it will show where it was detected.
You can then use the sensor state for automations / cards etc as you wish.
For Apple Watch’s, the process for retrieving the IRK value requires that you use a computer to access your iCloud Keychain data, but once you have the IRK value, the rest of the process is identical.
I hope that helps.