AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
5.71k stars 427 forks source link

Can't homekit proxy a camera that is added via the `hass` module #1353

Open davidanthoff opened 1 month ago

davidanthoff commented 1 month ago

I have two Eufy cameras ("eufy Security Indoor Cam C120"). If I add them to go2rt via the homekit source and then use the homekit module I can proxy that camera back to Apple Home. But if I add the camera via the hass source the proxy-back to Apple Home doesn't work. In both cases I can successfully see a camera image via the go2rtc generated streams.

The starting config essentially looks like this (all identifying numbers replaced with X):

streams:
  dining_room_camera:
    - homekit://192.168.1.X:X?device_id=X&device_public=X&client_id=X&client_private=X
    - ffmpeg:dining_room_camera#audio=aac#audio=opus
  kitchen_camera:
    - hass:Kitchen Camera
    - ffmpeg:kitchen_camera#audio=aac#audio=opus
homekit:
  dining_room_camera:
    pin: X
    name: Dining Room Camera
  kitchen_camera:
    pin: X
    name: Kitchen Camera
log:
  level: trace
  streams: trace
  homekit: trace

At that point all the go2rt streams work.

I then start to add these cameras to my Apple Home. It all works well for the dining room camera: I start the pairing process in the Apple Home app, enter the pin that is X in the config and done.

When I then start to do the same for the kitchen camera, I get an error in the Apple Home app that says Unable to Add Accessory. Accessory is not reachable. The go2rtc config file is modified and there is a pairings element added to the homekit -> kitchen_camera element with a sub element client_id that looks exactly like the pairing info that is there for the successfully paired dining room camera. The log shows the following (again any identifying numbers replaced by X):

11:23:34.543 TRC [homekit] 192.168.1.X:X: add pair id=X public=X perm=1
11:23:34.543 TRC [homekit] 192.168.1.X:X: get pair id=X
11:23:34.659 TRC [api] POST /pair-verify 192.168.1.X:X
11:23:34.668 TRC [homekit] 192.168.1.X:X: get pair id=X
11:23:34.669 ERR github.com/AlexxIT/go2rtc/internal/homekit/homekit.go:185 > error="hap: can't dial witout client_id or client_private"

So, to me this looks as if something is not properly handed on during the pairing process between Apple Home and go2rtc, so that things crash halfway through.

AlexxIT commented 1 month ago

Goto go2rtc WebUI > Add > Hass. Find your "Kitchen Camera". And copy-paste homekit source instead of hass.

davidanthoff commented 1 month ago

That works, thanks! Still seems like a bug, right? Ideally this would work directly?

AlexxIT commented 1 month ago

Yes. There is should no be difference.