Frigate NVR

When I first set up Home Assistant I wanted to monitor my thermostat, but after setting up some weather charting it seemed like a natural next step to integrate the cameras also. Unfortunately Zoneminder does not seem to work with Home Assistant anymore, so I started looking at what other Home Assistant users were using, and they mostly seemed to like Frigate.

I had to read a bit, and in the end it seemed like having dedicated hardware was better, but using a container in Proxmox would probably be good enough for my simple setup to start with. I used a Debian 12 turnkey core template, installed Docker Compose on it, and after a little configuring did a ‘docker compose up’ to start Frigate. The documentation for Frigate is straightforward, so it did not take long for me to get the cameras working.

The big draw for Frigate is its use of a USB Coral TPU, made by Google, for image detection. These are “side processors” that unload work from the CPU or GPU. the interesting thing about them is they are “high volume, low precision”, which is different than both CPUs and GPUs, making them ideal for ML workloads and image detection. They are still not widely available, but I was able to order a USB one from Seeedstudio and it arrived in a couple of days.

Now we are at the tricky part: I want to pass this USB device through the Proxmox LXC container to the docker container running Frigate (USB > Proxmox > LXC > Docker > Frigate). After plugging it in, the ‘lsusb’ command on the Proxmox host displayed it as “Global Unichip Corp.”, but after it is initialized the first time its name should change to “Google”.

The two main parts to making this work are the LXC config and the Docker compose file, and the details in most of the guides are correct, but I did have to make a change to each. In the LXC config, the lines to pass through the USB are usually shown as “lxc.cgroup.devices.allow”, but in Proxmox 8 these need to be “lxc.cgroup2.devices.allow” – cgroup2 instead of cgroup. Once I did that, the device name finally changed to “Google”, but Frigate still didnt detect it. I knew I was close!

The other big difference was in the compose file. Instead of passing “- /dev/bus/usb:/dev/bus/usb” in the device: section, I moved it to the volumes: section as suggested in a github comment, and that did the trick. Frigate rewarded me with “frigate.detectors.plugins.edgetpu_tfl INFO : TPU found”

Frigate with the Coral for detection is great. Instead of capturing every movement in the cameras field, it only captures when it makes a detection. This means a lot less false positives, and less storage used. I wish I was able to use the iGPU for motion processing, but because I did not choose hardware wisely and IOMMU passthrough in Proxomox seems a bit fragile, I am skipping it for now. So far it has not been a problem.

Leave a Reply

Your email address will not be published. Required fields are marked *