Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Config Support]: storing go2rtc config in /dev/shm causes it to lose homekit pairings #9116

Closed
rasika-jay opened this issue Dec 29, 2023 · 1 comment
Labels
duplicate This issue or pull request already exists support triage

Comments

@rasika-jay
Copy link

Describe the problem you are having

To reduce repetition, I started using go2rtc bundled within Frigate to expose cameras to HomeKit. I'm using go2rtc 1.8.4 and frigate 0.12.1 in Docker (compose).

I have successfully paired go2rtc cameras to HomeKit and it works as expected until I restart the frigate container (or config->save->restart).

When you pair a go2rtc camera with HomeKit, it seems to add a new section pairings with client_id to go2rtc.yaml file:

study:
    device_id: study
    pairings:
      - client_id=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&client_public=XXXXXXXXXX&permissions=1

However when Frigate is restarted /dev/shm/go2rtc.yaml is recreated from fresh, without the above pairings section, which makes the previous HomeKit pairings invalid.

2023-12-29 14:46:06.351562417  14:46:06.351 ERR github.com/AlexxIT/go2rtc/internal/homekit/homekit.go:179 > error="hap: PairVerify from: 192.168.XXX.XXX:XXXXX, with unknown client_id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"

I've got around this by making my own Docker image with go2rtc.yaml being persisted as /config/go2rtc.yaml in /docker/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run and /docker/rootfs/usr/local/go2rtc/create_config.py.

Is there a reason why go2rtc.yaml needs to be in /dev/shm? Is it possible to update the code to persist go2rtc.yaml in /config? Thanks!

Version

0.12.1

Frigate config file

database:
  path: /db/frigate.db

mqtt:
  host: 192.168.XXX.XXX
  stats_interval: 10

detectors:
  coral:
    type: edgetpu
    device: usb

detect:
  enabled: True
  width: 1280
  height: 720
  fps: 10

objects:
  filters:
    person:
      threshold: 0.8
    cat:
      threshold: 0.7
  track:
    - person
    - cat

record:
  enabled: False
  events:
    pre_capture: 30
    post_capture: 30
  retain:
    days: 14
    mode: active_objects

ffmpeg:
  hwaccel_args: preset-vaapi
  input_args: preset-rtsp-restream-low-latency
  output_args: 
    record: preset-record-generic

snapshots:
  enabled: True
  bounding_box: False
  clean_copy: True
  retain:
    default: 14

rtmp:
  enabled: False

birdseye:
  enabled: False

live:
  height: 1080
  quality: 15

go2rtc:
  webrtc:
    candidates:
      - 192.168.XXX.XXX:8555
      - XXX.XXX.XXX.XXX:XXXXX
  streams:
    kitchen: 
      - tapo://XXX@192.168.XXX.XXX
    living_room: 
      - tapo://XXX@192.168.XXX.XXX
    study: 
      - tapo://XXX@192.168.XXX.XXX
    bedroom: 
      - tapo://XXX@192.168.XXX.XXX
    hallway: 
      - tapo://XXX@192.168.XXX.XXX
  homekit:
    bedroom:
      pin: XXXXXXXX
      name: Bedroom
    study:
      pin: XXXXXXXX
      name: Study
    hallway:
      pin: XXXXXXXX
      name: Hallway
    kitchen:
      pin: XXXXXXXX
      name: Kitchen
    living_room:
      pin: XXXXXXXX
      name: Living Room

cameras:
  kitchen:
    motion:
      mask:
        - 744,179,839,221,861,98,760,72
        - 0,0,756,0,720,275,233,323,112,389,63,720,0,720
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/kitchen
          roles:
            - detect

  living_room:
    mqtt:
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 500
    motion:
      mask:
        - 446,164,555,166,580,21,447,21
        - 1280,0,655,0,650,260,817,262,826,213,1010,249,1280,413
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/living_room
          roles:
            - detect

  study:
    mqtt:
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 500
    motion:
      mask:
        - 1035,300,777,280,756,0,1280,0,1280,720,1116,720
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/study
          roles:
            - detect

  bedroom:
    mqtt:
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 500
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/bedroom
          roles:
            - detect
  hallway:
    mqtt:
      timestamp: False
      bounding_box: False
      crop: True
      quality: 100
      height: 500
    motion:
      mask:
        - 474,147,503,0,624,45,570,251
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/hallway
          roles:
            - detect

Relevant log output

2023-12-29 14:46:06.351562417  14:46:06.351 ERR github.com/AlexxIT/go2rtc/internal/homekit/homekit.go:179 > error="hap: PairVerify from: 192.168.XXX.XXX:XXXXX, with unknown client_id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"

Frigate stats

No response

Operating system

Debian

Install method

Docker Compose

Coral version

USB

Any other information that may be helpful

No response

@NickM-27 NickM-27 added the duplicate This issue or pull request already exists label Dec 29, 2023
@NickM-27
Copy link
Sponsor Collaborator

Is there a reason why go2rtc.yaml needs to be in /dev/shm? Is it possible to update the code to persist go2rtc.yaml in /config? Thanks!

because frigate applies its own default values that are not set by the user, having a config that is directly persisted would cause confusion and conflicts especially as frigate changes these defaults between versions.

For now you can access the homekit values and then save them in the go2rtc section of the frigate config. In the future we can implement something that does this automatically.

Closing this as a duplicate of #9016

@NickM-27 NickM-27 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists support triage
Projects
None yet
Development

No branches or pull requests

2 participants