ESPresense - Apple Watch - Device ID

Hello

I’ve set up two ESPresense ESP’s in two different rooms - I am trying to track my Apple Watch

Unfortunately Apple not only changes the mac every 15 minutes but in some cases (which I could not backtrack by now) the Watch also changes the device_id - I have pinpointed it out to two different id’s

Its either

apple:1005:9-24

OR

apple:watch6-9

The problem is also sometimes ESP1 detects the watch as apple:1005 and ESP2 checks out apple:watch and vice versa.

I am currently tracking both (see part of configuration.yaml)

sensor:
  - platform: mqtt_room
    name: "Apple Watch"
    device_id: "apple:1005:9-24"
    state_topic: "espresense/rooms"
    timeout: 5
    away_timeout: 120
  - platform: mqtt_room
    name: "Apple Watch 2"
    device_id: "apple:watch6-9"
    state_topic: "espresense/rooms"
    timeout: 5
    away_timeout: 120

is there a possibilty to have the name: “Apple Watch” check both device id’s?

Nicolas, in case you haven’t already resolved this:

Like you when I used MQTT-Explorer to see both device ids reporting. However, I only defined the equivalent to your second entry. (the different id is probably due to different watch models)

sensor:
  - platform: mqtt_room
    name: "apple watch BLE"
    device_id: "apple:watch3-4"
    state_topic: "espresense/rooms"
    timeout: 4
    away_timeout: 100

I’m also assuming that you entered apple:1005:9-24 is in the

Query device ids for characteristics (eg. apple:1005:9-26):

section of both room sensors which got you to see apple:watch6-9.

I then just ignore the apple1005:9-24 in HA; just doing this I’m able to accurately track which room I’m in.

I’ve been playing with the distance to tune the “bubbles” or room size for each room sensor. A problem I’m having now which just surfaced today is that the watch is bouncing back and forth between the two rooms when I’m setting right next to one of the sensors. I suspect I set one of the room bubbles to large.

Thank you Edward

I’ve tried your suggestions – but still the watch sometime just changes id’s so the precence detection is kind of wonky.

I’m still not sure I’m seeing anything different than you. First, I’m using MQTT Explorer on my Windows desktop to look at the messages being sent to the mosquito broker and capture the data in the MQTT messages.

As each room detector powers up, I see about 6-9 messages generated by apple:1005:9-24 before I see the first from apple:watch3-4. I only have apple:watch3-4 defined in HA though MQTT Explorer sees all ids. After that I see about 10- 20% of the messages coming from apple:1005:9-24 with 80-90% coming from apple:watch3-4. This is why I just track apple:watch3-4 messages.

Is the “switch” or change in id’s you are talking about? I don’t think this is a switch, but the fact the watch is broadcasting both. My iPhone actually is broadcasting 4 ids including my covid tracker and room assistant app both broadcasting their own id. This is why I don’t think the watch is switching, just broadcasting two ids at different intervals.

The problem I’m having is that I could be in my living room sitting right next to the room sensor and about 5-6 meters from the office sensor but I’m detected in the office causing my office lights to come on. Then a second or two later I’m back in the living room causing the office lights to go out and this happens more than once. I normally don’t have a problem if I’m in the office at my desk, but as I type this, my office lights have blinked twice thinking I had left and come back.

Again when I look at the data, for some reason, ESPresense is not always generating the correct distance. When I’m in the living room, more than 5 meters from the office, 8 meters from the sensor, there are times when it thinks I’m 1.6 meters from the office sensor. This is why the lights blink on from my automation.

I think the problem is either in the ESPresense code or my calibration setting from rssi@1m. As I don’t know anything about bluethooth and how it works, I’m only guessing. I just can’t help thinking I’m just a couple of tweaks away from getting this to work flawlessly if I just knew what to tune and how much.

1 Like

Hi,

I’ve just set-up my first ESPresense device tonight and came across the same problem for both my phone and watch.

However, after carefully following the documents on the ESPresense site here… Apple | ESPresense you will see how it explains to retrieve an IRK (Identity Resolving Key) for your iPhone and watch and then add this to one of the settings on the ESP board web ui to get a consistent device id. Took me a couple of goes to figure it out, so hopefully you will be able to do it.

1 Like

Hi @gadgetbazza,

In the link that you provided, it states (11. Add the same string to your HASS configuration with ‘irk:’ added in front e.g. “irk:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”).

Did you need to do this and, if so, where did you add it, please? Wherever I add it (under mqtt: or under sensor: - platform: mqtt_room), the configuration check fails - it doesn’t like irk:.

Cheers
Joe.

Hi Joe,

Yes it needs to go in you HA configuration yaml in the sensors section, see my snippet below for reference.

sensor:
- platform: mqtt_room
    name: "My Apple Watch BLE"
    device_id: "irk:<device_irk_value_here>"
    state_topic: "espresense/rooms"
    timeout: 5
    away_timeout: 120
  - platform: mqtt_room
    name: "My iPhone 12Pro BLE"
    device_id: "irk:<device_irk_value_here>"
    state_topic: "espresense/rooms"
    timeout: 5
    away_timeout: 120
  - platform: mqtt_room
    name: "Another iPhone BLE"
    device_id: "irk:<device_irk_value_here>"
    state_topic: "espresense/rooms"
    timeout: 5
    away_timeout: 120
  - platform: mqtt_room
    name: "Another Apple Watch BLE"
    device_id: "irk:<device_irk_value_here>"
    state_topic: "espresense/rooms"
    timeout: 5
    away_timeout: 120

HTH

1 Like

Hi @gadgetbazza,

Sorry for the delayed response.

Many thanks for answering my question and, particularly, for providing the snippet - it helps no end.

Under sensor: -platform: mqtt_room, I’d put in entries for the ESP32s running espresense but had failed to put in any entries for the devices (beacons).

So, thanks once again
Joe

Hi,

I can see the mqtt topics through mqtt explorer but for some reason i dont see a sensor for my apple watch underneath the developer tools,

I have the following configured
sensor:

  • platform: mqtt_room
    name: “Davids Watch”
    device_id: “irk:1b087407929fc33f19744c82c53369d4”
    state_topic: “espresense/devices/apple:1005:9-12”
    timeout: 60
    away_timeout: 120

i rebooted home-assistant and the espresence device with the following irk key saved

how do i get my apple watchto show up in home-assistant?

Hi.

From first glance, I’d say the MQTT topic in your yaml is incorrect for this piece.

I’ve actually made a start to finish post Here for setting up apple devices on espresense. It doesn’t go into retrieving the irk for a watch but it sounds like you’ve worked that out from the espresense docs anyway. So check what you have against that guide and hopefully you will find the missing piece.

HTH

thanks but you explicitly say iphone… im trying to setup a watch



is this not right?

Now the Senosr looks correct. I have it configured in the same way and it’s working.

They work exactly the same, the only difference is how you obtain the irk.

1 Like

how do you change the scanning interval?

For Bluetooth? Not sure you can that I’ve seen.

Why do you need to change it, it seems to be pretty frequent to me, like every second?

i need another bluetooth device to test

Is there any way to extract the IRK for an Apple Watch without using a Mac? I have an iPhone and an iPad, but no Mac. From what I am seeing, using MQTT explorer only works for the iPhone, not the Apple Watch.

2 Likes

I have the same problem here. Is it possible to get the IRK without a Mac.
I tried to install the iCloud for Windows, I can find “iCloud-Passwords”, but there is no access to the bluetooth stuff.

Any ideas?

i have been debating getting one of those virtual mac in the cloud accounts just to get the IKR for my watch.

1 Like