Home Assistant VM and Frigate Integration

I need some assistance integrating Frigate with Home Assistant.

Background:

  • Server is a QNAP NAS (TVS-h674) on 192.168.1.x.
  • Home Assistant is a VM (haos_ova-11.1.ova) setup through QNAP Virtualization Station 3.
  • MQTT v5 is running on a docker container AND the integration is installed in HA.
  • Frigate v4.0.0 is running in a docker container (followed https://docs.frigate.video/) and recording events.
  • Camera is a ReoLink TrackMix PoE and is integrated into Home Assistant with the Reolink IP NVR/camera.

Everything is running well on their own and only locally. Frigate is displaying a live camera view on the Frigate Web UI (192.168.1.x). HA is on http://homeassistant.local:8123/ and 192.168.1.xx/24. The Frigate integration is downloaded from HACS (visible in custom_components) AND everything has been rebooted (HA, VM, Virtualization Station, Container Station, and the QNAP NAS) multiple times. When I try to add the Frigate Integration in Settings → Integrations with http://192.168.1.x:5000 (both with the “/” and without), it returns a “Failed to connect” message.

I have IPv6 turned off on the QNAP Virtual Switch and in HA Settings under System → Network. I think it is a network routing issue, but yet I can see a log entry in the Frigate Web UI logs for Nginx:

192.168.1.xx ... "GET /api/stats HTTP/1.1" 200 2495 "-" "HomeAssistant/2023.11.2 aiohttp/3.8.5 Python/3.11" "-"

I also tried to curl the Frigate docker with:

curl -X GET http://192.168.1.x:5000/api/version

and the response:

curl: (56) Recv failure: Connection reset by peer

It appears that it is a network issue, but I have run out of ideas to fix it or further pinpoint the issue.

Try disabling your firewall and see if that solves it

I am not running a Firewall on my QNAP NAS, just my router. Everything is contained/protected in the LAN. The Frigate container doesn’t have a firewall to my knowledge (followed the directions from Frigate).

So, where do I disable the firewall on the HA VM?

HA doesn’t have a firewall. Next thing to look at is docker config for frigate. That port 5000 am not be mapped. What is the exact URL you go to, to see the frigate UI?

Post the docker config.

You could also try using localhost instead of the ip addrsss.

The working Frigate Web UI is http://192.168.1.x:5000/, which is the same url I am trying to use for the Frigate integration.

My Frigate docker config is:

mqtt:
  host: 192.168.1.x
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: my_secret_id
  password: 'my_secret_pw'

detectors:
  coral1:
    type: edgetpu
    device: pci:0

logger:
  default: info
  logs:
    frigate.event: info
    frigate.mqtt: info
    frigate.edgetpu: info

ffmpeg:
  hwaccel_args: preset-vaapi
  # hwaccel_args: preset-intel-qsv-h264
  output_args:
    record: preset-record-generic-audio-copy

birdseye:
  enabled: True
  mode: continuous

# detect:
# Commented out for now

objects:
  track:
    - person
    - car
    - dog
    - cat

motion:
  mask:
    - 1920, 291, 1920, 0, 0, 0
    - 0, 0, 730, 102, 0, 137

record:
  enabled: True
  events:
    pre_capture: 5
    post_capture: 5
    objects:
      - person
      - dog
      - cat
    required_zones:
        - front_yard
        - driveway
    retain:
      default: 20
      mode: active_objects
      objects:
        person: 15
        dog: 15
        cat: 15

snapshots:
  enabled: True
  clean_copy: True
  timestamp: True
  bounding_box: False
  crop: False
  height: 720
  required_zones:
    - front_yard
    - driveway
  retain:
    default: 10
    mode: motion
    objects:
      person: 15
      dog: 10
      cat: 10

live:
  height: 896
  quality: 8

timestamp_style:
  position: "tl"
  format: "%m/%d/%Y %H:%M:%S"
  color:
    red: 255
    green: 255
    blue: 255
  thickness: 2

go2rtc:
  streams:
    reo_front:
      - "ffmpeg:http://192.168.1.xx/flv?port=1935&app=bcs&stream=channel0_autotrack_sub.bcs&user=secret_user&password=secret_pw#video=copy#audio=copy#audio=opus"
    reo_front_sub:
      - "ffmpeg:http://192.168.1.xx/flv?port=1935&app=bcs&stream=channel0_sub.bcs&user=secret_user&password=secret_pw"

cameras:
  reo_front:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/reo_front?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/reo_front_sub?video=copy
          input_args: preset-rtsp-restream
          roles:
            - detect
    # best_image_timeout: 60
    detect:
      width: 1280
      height: 720
      fps: 15
    snapshots:
      enabled: True
    zones:
      front_yard:
        coordinates: 0, 153, 1920, 369, 1920, 1080, 0, 1080
        objects:
          - person
          - cat
          - dog
      driveway:
        coordinates: 720,109,1455,220,1593,410,377,263
        objects:
          - person
          - car
          - cat
          - dog

    mqtt:
      enabled: True
      timestamp: True
      bounding_box: True
      crop: True
      height: 270
      quality: 70
      required_zones:
        - front_yard
        - driveway

I just noticed a better example of the issue in the Frigate Web UI under the Nginx logs:

"GET / HTTP/1.1" 200 10522 "-" "HomeAssistantSupervisor/2023.11.3 aiohttp/3.8.6 Python/3.11" "172.30.32.2"

The 172.30.32.2 looks like part of the VM with the HA docker.

If I run the network info command inside the HA VM, I get:

docker:
  address: 172.30.32.0/23
  dns: 172.30.32.3
  gateway: 172.30.32.1
  interface: hassio
host internet: true
interfaces:
- connected: true
  enabled: true
  interface: enp0s3
  ipv4:
    address:
    - 192.168.1.xx/24
    gateway: 192.168.1.1
    method: auto
    nameservers:
    - 192.168.1.1
    ready: true
  ipv6:
    address:
    - fe80:xxxx:xxxx:xxxx:xxx/64
    gateway: null
    method: disabled
    nameservers: []
    ready: true
  mac: 52:xx:xx:xx:xx:xx
  primary: true
  type: ethernet
  wlan: null
  wifi: null
supervisor_internet:true

Addons connect to HA within the docker network using the containers hostname and port

Look here for frigate url

Thanks, but I am trying to add BOTH the Frigate Proxy as an add-on (blank black scree), but the Frigate Web UI Nginx log reports:

GET // HTTP/1.1" 200 10522 "http://homeassistant.local:8123/ccab4aaf_frigate-proxy" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "fe80::90db:2c9e:d1ea:91cb, 172.30.32.1, 172.30.32.2

I am more concerned that I cannot add the Frigate Integration that was already loaded via HACS (reboot of HA and the parent HA VM several times). I am using

http://192.168.1.x:5000/

for the Frigate integration, which is the same as the Frigate Web UI which is working perfectly.

Any other ideas?