Frigate
Proxmox + HassOS (Home Assistant) + Frigate (Intel NUC6CAYH)
Pigiausias (low budget) setupas, nors cpu apkrovos jaučiasi, bet puikiai veikia su 4-6 kameromis. Diegime tuo pačiu ir Home Assistant, kuris naudojamas išmaniųjų namų automatikoje. Frigate diegiamas kaip plugin (papildinys) Home Assistant'ui
Reikalinga:
- Nuc6cayh Intel NUC'as
- Coral Accelerator Coral USB AI akseleratorius, plačiau apie jį čia.
- Proxmox diegimo usb flash diskas.
Sudiegiame proxmox
FIXME
|
Kai sudiegiame proxmox..
- Prisijungiame prie proxmox valdymo panelio https://ip:8006/
- Einame į Datacenter > PVE > Shell
Rašome:
bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/post-pve-install.sh)"
Sekame instrukcijas diegimo metu...
Įgaliname Intel iGPU Passthrough
/etc/default/grub pakeisti tik vieną eilutę
GRUB_CMDLINE_LINUX_DEFAULT="quiet quiet intel_iommu=on i915.enable_gvt=1 iommu=pt pcie_acs_override=downstream,multifunction video=efifb:off video=vesa:off vfio_iommu_type1.allow_unsafe_interrupts=1 kvm.ignore_msrs=1 modprobe.blacklist=radeon,nouveau,nvidia,nvidiafb,nvidia-gpu"
Įdiegiame MQTT brokerį kaip LXC konteinerį
- Prisijungiame prie proxmox valdymo panelio https://ip:8006/
- Einame į Datacenter > PVE > Shell
Rašome:
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/mqtt.sh)"
Sekame instrukcijas diegimo metu...
Diegimui pasibaigus pasijungiame per proxmox konsolę prie mqtt lxc konteinerio ir pakeičiame failo /etc/mosquitto/conf.d/default.conf turinį į
listener 1883 allow_anonymous true listener 9001 protocol websockets socket_domain ipv4
Įdiegiame Home Assistant OS
- Prisijungiame prie proxmox valdymo panelio https://ip:8006/
- Einame į Datacenter > PVE > Shell
Rašome:
bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/vm/haos-vm.sh)"
Įdiegiame Home Assistant Frigate pluginą
Einame į Home Assistant > Settings > Add-ons > ADD-ON STORE > Spaudžiame viršutiniame dešiniame kampe tris taškus ir pasirenkame Repositories, pridedame repozitorių:
https://github.com/blakeblackshear/frigate-hass-addons
Atnaujiname repozitorius ir spaudžiame įdiegti Frigate plugin'ą.
Frigate konfigūracija
Kad patogiau būtų redaguoti konfigūracijos failą, įdiegiame Home Assistant pluginą File Editor per Settings > Add-ons > ADD-ON STORE įdiegus pluginą pasidarome Show in sidebar. Paspaudę ant šio sidebar meniu punkto nunaviguojame ir sukuriame failą frigate.yml direktorijoje homeassistant/
Failo turinys:
Ubuntu 22.04.4 LTS + Frigate Docker (ThinkCentre M920q)
Reikalinga:
- ThinkCentre M920q
- Coral Accelerator Coral USB AI akseleratorius, plačiau apie jį čia.
docker-compose.yml
version: "3.9"
services:
frigate:
container_name: frigate
image: ghcr.io/blakeblackshear/frigate:stable
restart: always
privileged: true
shm_size: "256mb"
ports:
- "1935:1935"
- "5000:5000"
devices:
- /dev/bus/usb:/dev/bus/usb
- /dev/dri:/dev/dri
volumes:
- /etc/localtime:/etc/localtime:ro
- /srv/dockers/frigate/conf/config.yml:/config/config.yml:ro
- /srv/dockers/frigate/data:/media/frigate
- /srv/dockers/frigate/db:/db
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 1000000000
# ports:
# - '5000:5000'
environment:
- FRIGATE_RTSP_PASSWORD=123456
networks:
- traefik
restart: unless-stopped
labels:
- traefik.enable=true
- traefik.docker.network=traefik
- "traefik.http.routers.frigate.rule=Host(`frigate.domenas.lt`)"
- "traefik.http.services.frigate.loadbalancer.server.port=5000"
# resources limit
mem_limit: 6G
cpus: 3.0
cap_add:
- CAP_PERFMON
networks:
traefik:
external: true
frigate.yml
detectors:
# cpu1:
# type: cpu
# cpu2:
# type: cpu
coral:
type: edgetpu
device: usb
num_threads: 3
database:
path: /db/frigate.db
ffmpeg:
hwaccel_args: preset-vaapi
output_args:
record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
logger:
# Optional: default log level (default: shown below)
default: info
# Optional: module by module log level configuration
logs:
frigate.mqtt: warning
frigate.ffmpeg: debug
mqtt:
host: 192.168.1.1
topic_prefix: frigate
client_id: frigate
stats_interval: 60
rtmp:
enabled: false
birdseye:
enabled: false
detect:
enabled: True
max_disappeared: 50
width: 640
height: 360
fps: 5
record:
enabled: True
retain:
days: 14
mode: motion
events:
pre_capture: 10
post_capture: 5
objects:
- person
- car
- bicycle
- motorcycle
- bus
- dog
- truck
required_zones: []
retain:
default: 3650
mode: active_objects
snapshots:
enabled: True
timestamp: True
bounding_box: True
crop: False
height: 1000
retain:
default: 3650
objects:
track:
- person
- car
- cat
- dog
- bicycle
- truck
- motorcycle
- bus
- horse
- sheep
- cow
- bear
- umbrella
- handbag
- suitcase
- bottle
- apple
- cell phone
filters:
person:
min_score: 0.5
threshold: 0.7
car:
threshold: 0.70
truck:
threshold: 0.70
cameras:
Cam1:
ffmpeg:
hwaccel_args: preset-intel-qsv-h264
input_args: -avoid_negative_ts auto -fflags nobuffer+genpts+discardcorrupt -flags low_delay -rtsp_transport tcp -use_wallclock_as_timestamps 1 -timeout 2000000
inputs:
- path: rtsp://admin:admin@192.168.1.10/0/av1 # h264 MPEG-4 AVC (h264) 640x352
roles:
- detect
- path: rtsp://admin:admin@192.168.1.10/0/av0 # h264 MPEG-4 AVC (h264 1920x1080
roles:
- record
detect:
width: 640
height: 352
fps: 5
objects:
track:
- person
- cat
- dog
- truck
mqtt:
height: 1080
crop: False
timestamp_style:
position: "bl"
format: "%H:%M:%S"
color:
red: 255
green: 255
blue: 255
thickness: 5
effect: "shadow"