Jc2k/aiohomekit

Video & Intercom Doorbell in HA

LukasGrebe opened this issue · 6 comments

I'm not sure if this is the right place to ask.
i have a video & intercom doorbell that only has a HomeKit api and that I would like to integrate into Homeassistant.

I've created a thread about it at https://community.home-assistant.io/t/adding-a-homekit-native-doorbell-to-homeassistant/568808

I've since gone down the rabbit hole and started to understand a bit about how HomeKit devices work.

I've identified several interesting characteristics of the device through the home assistant dump that are not exposed as an entity in home assistant.

would this project be the correct place to expand on homeassistant video intercom doorbells or would code within the home assistant core project need to be modified?

I'm in the process of descending the same rabbit hole - what specific dump mechanism did you use to pull the raw device capabilities?

I'm getting very close to returning a Honeywell T9 thermostat since the HomeKit integration is so minimal - but from what I've discovered as I begin descending the rabbit hole, these missing features may be on the HomeAssistant side, in which case it seems like it may be time to familiarize myself with HA development.

At least based on the descriptions of this project, it appears that modifications would likely be needed both here AND in HA core for both your use case and mine.

Jc2k commented

@Entropy512 when homekit_controller pairs a device it stores a copy of what it calls the "entity map". This is JSON. In the case of the IP backend, this is pretty much the JSON returned by the device, so we know there is no data missing. We might normalize it though.

You should find it in /config/.storage/homekit_controller-entity-map (where /config is the directory that your configuration.yaml lives).

I haven't seen this data for a T9. If you posted a new ticket with it I can give it a quick once over. I can tell you that the T6 was very basic.

In general, the climate interface is very limited compared to the manufacturers own interface. In the case of Ecobee, the vendor implemented their own horrible barely functional extensions to homekit. These are so bad and cause so many issues that i'm tempted to remove support from them again. So if you find something that isn't documented in the apple documentation, we'll need some convincing to add it upstream.

Jc2k commented

@LukasGrebe some here, and some in homekit_controller. From what I recall, the hard part is setting up an RTSP stream and interfacing it with the ffmpeg stuff in HA core. Have you got a copy of the Apple protocol documentation?

https[://]pdfcoffee.com/hap-specification-non-commercial-version-pdf-free.html

If you post your thinking here happy to help.

OK, pulled the entity map, will file a separate ticket tomorrow. Thanks for the info on how to do so!

thanks for the pdf @Jc2k.

I've never done any serious python programming or any video stream interaction, so this may spread out to be quite a long project with a steep learning curve 😃

ill start with baby steps maybe. im thinking the characteristics of a device, as listed in the debug json by HA, should be represented as entities in HA.

In the HAP spec, I found the service "8.12 Doorbell" which requires nothing more than the characteristic "9.75 Programmable Switch" I found the corresponding UUID 00000073-0000-1000-8000-0026BB765291 of it in the dump of my HA connected device.

Section 11.3.2 of the HAP spec defines a "video doorbell Profile" – a "11.3 Service" of an "11 IP Camera" – as
a "8.12 Doorbell" service with
secondary, required, services: "8.6 Camera RTP Stream Management", ”8.36 Speaker” & ”8.27 Microphone”

I think this would make for a nice roadmap:

  1. start with the button
  2. add the speaker function, this should be an easier start into streaming application(?) and would enable the neat automation of playing a sound file telling people at the door to go around back with home assistant
  3. maybe microphone function because it would be audio again or Video.first.. we'll see.

so let me know what you think of these assumptions:

  • Device Characteristics should map 1:1 to HA entities (possibly the new events with 2023.8)
  • implement Spec 9.75 Programmable Switch, and have it create an entity in HA (yay we could have doobell presses in HA)
  • Continue with Audio, then Video
Jc2k commented

The easy thing first.

The doorbell button has been supported for.. probably over a year. There wasn't really a way for home assistant to have entities for it though. Entities are about state, and a button press is an event, not state. So it was exposed through device automations.

On Wednesday in 2023.8, HA got an event entity. This was designed to handle things like doorbells and buttons. And in the same release we added support to homekit controller for the doorbell as an event entity.

I'll need to get back to you about the rest.

Think about it from the HA side as well as the characteristics. What entity in HA do you map the speaker to? what features does that HA entity require?