Extract apple user id from homekit integration

Is it possible to find out who is initiating an action via the homekit integration?
For example when I say “Unlock frontdoor” from my iPhone iOS client which connects to homeassistant homekit that I can sent a telegram message notification ‘User X has unlocked frontdoor via Homekit’ ?
Any idea’s how to accomplish this?

Thanks in advance!

Regards,
Donald.

2 Likes

The homekit protocol only sends the UUID of the user that did the action (‘the authenticated in user’). We don’t have a way to tie that UUID to an apple id. Its possible the Mobile app could have access to it via one of the apis, but HAP-python would have to also add an api to expose it to Home Assistant.

UUID would be nice too, if I know that UUID x is me and UUID y is a friend?
How to get that UUID from the homekit integration in homeassistant?
If the UUID’s are different from homekit user 1 and homekit user 2, then I can map an UUID to a user and create an automation for it to send out messages.

1 Like

It is not exposed in the current version HAP-python so its not possible to access it.

Ok, thanks for sharing! :slight_smile:

HAP-python 4.1 (coming in 2021.9) exposes the property on the HAPServerHandler instance

1 Like

Sorry for reborn this topic nut would like to know if the uuid is now exposed and can be used. I have HA 2023.12.4 but don’t see it when an event is tiggered:

event_type: homekit_state_change
data:
  entity_id: switch.shelly_luz_wc_servico_switch_1
  display_name: Luz WC Serviço Espelho
  service: turn_on
  value: null
origin: LOCAL
time_fired: "2024-01-19T20:55:37.016093+00:00"
context:
  id: 01HMHR3Y9REKKK21K76MEF4AKT
  parent_id: null
  user_id: null

I don’t have any issue to receive the the internal apple user since I can’t map after it in HA. Thank you.

1 Like

I don’t see it either, I don’t think it is implemented.
Still looking for a solution also.

I’ve made a feature request for this here. Please leave a vote on it to increase the chances of being implemented.

1 Like

Done! I believe that @bdraco might support on this :crossed_fingers: