go2rtc icon indicating copy to clipboard operation
go2rtc copied to clipboard

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

Open davidanthoff opened this issue 1 year ago • 3 comments

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.

davidanthoff avatar Sep 15 '24 18:09 davidanthoff

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

AlexxIT avatar Sep 15 '24 18:09 AlexxIT

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

davidanthoff avatar Sep 15 '24 19:09 davidanthoff

Yes. There is should no be difference.

AlexxIT avatar Sep 15 '24 19:09 AlexxIT

I am trying to setup HomeKit proxy and I stumble across this issue.

I can’t quite figure out how to obtain “ homekit://192.168.1.X:X?device_id=X&device_public=X&client_id=X&client_private=X” for go2rtc to use for proxying.

Is there any pointers?

Thank you!

henrybear327 avatar Jan 09 '25 01:01 henrybear327

Pointers two comments above

AlexxIT avatar Jan 09 '25 09:01 AlexxIT

This also does not work for me:

  • I added the camera to Home Assistant (2025.5.1) through Homekit, it works there.
  • Used the WebUI > Add > Hass to find and add the homekit source. It also works on go2rtc. But I cannot add it to Home App on iphone.
  • Tried restarting phone, apple tv, camera, go2rtc addon, hass
Time Level Message
5:41:46.404 PM info go2rtc version=1.9.9 platform=linux/arm64 revision=fa580c5
5:41:46.404 PM info config path=/config/go2rtc.yaml
5:41:46.405 PM info [rtsp] listen addr=:8554
5:41:46.405 PM info [api] listen addr=:1984
5:41:46.407 PM info [webrtc] listen addr=:8555
5:47:18.463 PM error undefined error=hap: VerifyClientAuthenticator caller=github.com/AlexxIT/go2rtc/internal/homekit/homekit.go:189
5:47:40.560 PM error undefined error=hap: VerifyClientAuthenticator caller=github.com/AlexxIT/go2rtc/internal/homekit/homekit.go:189
streams:
  Roborock:
    - roborock://...
  Camera-Hub-G2HPro-0244:
    - homekit://10.0.0.109:37417?client_id=XX&client_private=XX&device_id=XX&device_public=XX
homekit:
  Camera-Hub-G2HPro-0244:
    name: Aqara-G2H-Cam
log:
  homekit: debug

el avatar May 09 '25 16:05 el

Ok I was able to fix it by defining custom device_id. I guess it was a weird cache issue.

streams:
  Aqara-G2HPro:
    - homekit://...
homekit:
  Aqara-G2HPro:
    pin: 12341234
    name: Aqara
    device_id: aqara_g2hpro
    device_private: aqara_g2hpro_private

el avatar May 09 '25 17:05 el

https://github.com/AlexxIT/go2rtc/releases/tag/v1.9.12

AlexxIT avatar Nov 17 '25 09:11 AlexxIT