CCOSTAN / Home-AssistantConfig

:house: Home Assistant configuration & Documentation for my Smart House. Write-ups, videos, part lists, and links throughout. Be sure to :star: it. Updated FREQUENTLY!
https://www.vCloudInfo.com
Other
4.84k stars 505 forks source link

Refactor Frigate setup #1461

Closed CCOSTAN closed 3 months ago

CCOSTAN commented 5 months ago

Add in Seperate Go2RTC instance and point all cameras to that container.

User Go2RTC to split streams into detect and record as appropriate or needed.

Point Frigate at these streams.

             +------------------------------------+
             |              Cameras               |
             +------------------------------------+
                           /   |   \
                          /    |    \
                         /     |     \
                        /      |      \
                       /       |       \
                      /        |        \
          +----------------+  /          \  +----------------+
          |   Wyze Bridge  | /            \ |      Camera     |
          +----------------+               \ +----------------+
                 |                         \        |
                 v                          \       v
+-----------------------------------------------------------+
|                         Go2RTC                            |
+-----------------------------------------------------------+
                 |                                |
                 v                                v
          +----------------+               +----------------+
          |    Frigate     |               | Home Assistant |
          +----------------+               +----------------+
                 |
                 v
+-----------------------------------------------------------+
|                     Home Assistant                        |
+-----------------------------------------------------------+
CCOSTAN commented 5 months ago

Immediately reverted this. :) Looks like Go2RTC can be run RIGHT within the Frigate install.

Current Frigate Docker-Compose:

  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:stable
    shm_size: "1g" # update for your cameras based on calculation above
    devices:
      # - /dev/bus/usb:/dev/bus/usb  # Passes the USB Coral, needs to be modified for other versions
      - /dev/bus/usb/002/003:/dev/bus/usb/002/003
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /dev/bus/usb:/dev/bus/usb
      - ./docker_files/frigate/config:/config
      - /mnt/frigate_video:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000" # Console
      - "1984:1984" # RTSP feeds
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
      - "1935:1935" # RTMP feeds
    environment:
      FRIGATE_RTSP_PASSWORD: "2323password2323"
      PLUS_API_KEY: 238798237489234787

and then FRIGATE Config:

mqtt:
  host: 192.168.10.10
  user: pi
  password: password
detectors:
  coral:
    type: edgetpu
    device: usb
birdseye:
  restream: true
  width: 1920
  height: 1080
  quality: 10

#Global Object Settings
objects:
  track:
  - person
  - car
  - truck
  - bicycle
  - motorcycle
  - dog
  - cat
  - bird
  - mouse

go2rtc:
  streams:
    birdseye_roku: #http://192.168.10.14:1984/api/frame.jpeg?src=birdseye_roku
      - rtsp://127.0.0.1:8554/birdseye
      - ffmpeg:birdseye#video=mjpeg 

    frontdoorbell: rtsp://192.168.10.10:8554/front-doorbell
    PoolCam: rtsp://192.168.10.10:8554/pool-cam
    FilerGate: rtsp://USERNAME:PW@192.168.10.23:88/videoMain
    BedroomGate: rtsp://USERNAME:PW@192.168.10.21:88/videoMain
    DriveWay: rtsp://USERNAME:PW@192.168.10.22:88/videoMain

cameras:
  FrontDoorbell:
    ffmpeg:
      inputs:
      - path: rtsp://127.0.0.1:8554/frontdoorbell
        input_args: preset-rtsp-restream
        roles:
        - record
        - detect

    birdseye:
      mode: continuous
    motion:
      mask:
      - 273,207,265,102,182,0,49,0,0,47,0,223
      - 295,640,480,640,480,616,296,616
      - 511,876,529,917,491,915,417,909,414,869
      lightning_threshold: 0.8
    objects:
      track:
      - person
      - car
      - dog
      - cat
      - mouse

  PoolCam:
    ffmpeg:
      inputs:
      - path: rtsp://192.168.10.10:8554/pool-cam-sub
        roles:
        - detect
      - path: rtsp://127.0.0.1:8554/poolcam
        roles:
        - record
    motion:
      lightning_threshold: 0.8
      mask:
      - 438,360,612,360,611,334,434,330
    objects:
      track:
      - person
      - dog
      - cat
      - bird
      - mouse

  FilterGate:
    ffmpeg:
      inputs:
      - path: rtsp://127.0.0.1:8554/filtergate
        roles:
        - record
        - detect
    motion:
      mask:
      - 0,0,0,37,424,38,427,0
      - 90,355,0,258,0,35,275,34,328,135,267,225
      - 506,574,402,720,891,720,873,642,670,605
    objects:
      track:
      - person
      - dog
      - cat
      - bird
      - mouse

  BedroomGate:
    ffmpeg:
      inputs:
      - path: rtsp://127.0.0.1:8554/BedroomGate
        roles:
        - record
        - detect
    motion:
      mask:
      - 0,36,0,0,420,0,422,37

  Driveway:
    ffmpeg:
      inputs:
      - path: rtsp://127.0.0.1:8554/Driveway
        roles:
        - record
        - detect
    birdseye:
      mode: continuous
    motion:
      mask:
      - 0,35,0,0,420,0,420,37
      - 0,690,0,45,379,55,378,38,350,914,220,907
      - 589,1000,656,998,660,967,593,970
    objects:
      track:
      - person
      - car
      - truck
      - bicycle
      - motorcycle
      - dog
      - cat

record:
  enabled: true
  retain:
    days: 5
    mode: motion
  events:
    retain:
      default: 5
      mode: active_objects
      objects:
        person: 5
        car: 3
        truck: 3
    pre_capture: 5
    post_capture: 5
snapshots:
  enabled: true
  timestamp: false
  bounding_box: true
  # Optional: crop the snapshot (default: shown below)
  crop: true
  retain:
    # Required: Default retention days (default: shown below)
    default: 21
    # Optional: Per object retention days
CCOSTAN commented 3 months ago

https://youtu.be/9QnOWwj6L5s

FRIGATE_yellow

- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.