The Home Automation Project


The below code snippets will help you setup your Frigate Add-on in Home Assistant.
Simple configuration
Here is a sample code for a simple / basic config of frigate.yml:
Link to download the sample yml file: Click this link to download frigate.yml file

                            mqtt:
                              host: ip # example, 192.168.x.x
                              user: mqtt-user
                              password: password
                            
                            #not required if using google coral usb stick!
                            detectors:
                            cpu:
                                type: cpu
                                num_threads: 2
            
                            cameras:
                            tapo_c200:  # <------ Name the camera
                                rtmp:
                                enabled: False # <-- RTMP should be disabled if your stream is not H264
                            
                                ffmpeg:
                                    #output_args:
                                    #  record: preset-record-generic-audio-copy
                                    #hwaccel_args: -c:v h264_v412m2m
                                    inputs:
                                    - path: rtsp://username:password@ip:554/stream1
                                      # special character substitution with ASCII is required above, example,
                                      # if you have the character '@' then replace with '%40' in the string.
                                      # search online for other such equivalent ASCII charset
                                      # refer here: https://www.w3schools.com/tags/ref_urlencode.ASP
                                    roles:
                                      - record
                                      - detect
                                  
                              #-------------------------------------------
                              # Optional: Detect configuration
                              detect:
                                width:  640 # <---- update for your camera's resolution
                                height:  360 # <---- update for your camera's resolution
                                fps: 5
                                enabled: true
                                stationary:
                                  interval: 20
                                  threshold: 50
                                
                              #---------------------------------------------
                              objects:
                                track:
                                  - person
                                filters:
                                  person:
                                    # Optional: minimum width*height of the bounding box for the detected object (default: 0)
                                    min_area: 5000
                                    # Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
                                    # max_area: 100000
                                    min_score: 0.5
                                    threshold: 0.6
                              
                              #-------------------------------------------
                              # Optional: Record configuration
                              record:
                                enabled: True
                                retain:
                                  days: 7
                                  mode: active_objects #motion
                                events:
                                  pre_capture: 10
                                  post_capture: 10
                                  # Optional: Objects to save recordings for. (default: all tracked objects)
                                  objects:
                                    - person
                                  retain:
                                    default: 14
                                    mode: active_objects
                                    # Optional: Per object retention days
                                    # objects:
                                    #   person: 7
                          
                              #-------------------------------------------
                              # Optional: Configuration for the jpg snapshots written to the clips directory for each event
                              snapshots:
                                enabled: True
                                timestamp: True
                                bounding_box: True
                                crop: False
                                retain:
                                  default: 7
                        

The following illustrates the details of the path string:
Path string

Advanced configuration
Here is a sample code for an advanced config of frigate.yml for cameras with multiple streams:
Link to download the full yml file: Click this link to download frigate.yml file

                          mqtt:
                            host: ip # example, 192.168.x.x
                            user: mqtt-user
                            password: password
                          
                          #not required if using google coral usb stick!
                          detectors:
                            cpu:
                              type: cpu
                              num_threads: 2
                          
                          go2rtc:
                            streams:
                              cam1: 
                                - rtsp://username:password@ip:554/stream1
                              cam1_sub: 
                                - rtsp://username:password@ip:554/stream2
                          
                          cameras:
                            cam1:  # <------ Name the camera
                              rtmp:
                                enabled: False # <-- RTMP should be disabled if your stream is not H264
                          
                              ffmpeg:
                                #output_args:
                                #  record: preset-record-generic-audio-copy
                                #hwaccel_args: -c:v h264_v412m2m
                                inputs:
                                  - path: rtsp://127.0.0.1:8554/cam1
                                    input_args: preset-rtsp-restream
                                    roles:
                                      - record
                                  - path: rtsp://127.0.0.1:8554/cam1_sub # <--- the name here must match the name of the camera_sub in restream
                                    input_args: preset-rtsp-restream 
                                    roles:
                                      - detect
                              live:
                                  stream_name: cam1_sub
                                  
                              #-------------------------------------------
                              # Optional: Detect configuration
                              detect:
                                width:  640 # <---- update for your camera's resolution
                                height:  360 # <---- update for your camera's resolution
                                fps: 5
                                enabled: true
                                stationary:
                                  interval: 20
                                  threshold: 50
                                
                              #---------------------------------------------
                              objects:
                                track:
                                  - person
                                filters:
                                  person:
                                    # Optional: minimum width*height of the bounding box for the detected object (default: 0)
                                    min_area: 5000
                                    # Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
                                    # max_area: 100000
                                    min_score: 0.5
                                    threshold: 0.6
                              
                              #-------------------------------------------
                              # Optional: Record configuration
                              record:
                                enabled: True
                                retain:
                                  days: 7
                                  mode: active_objects #motion
                                events:
                                  pre_capture: 10
                                  post_capture: 10
                                  # Optional: Objects to save recordings for. (default: all tracked objects)
                                  objects:
                                    - person
                                  required_zones:
                                    - zone_0
                                  retain:
                                    default: 14
                                    mode: active_objects
                                    # Optional: Per object retention days
                                    # objects:
                                    #   person: 7
                          
                              #-------------------------------------------
                              # Optional: Configuration for the jpg snapshots written to the clips directory for each event
                              snapshots:
                                enabled: True
                                timestamp: True
                                bounding_box: True
                                crop: False
                                retain:
                                  default: 7
                                required_zones:
                                    - zone_0
                              
                              #motion mask for timestamp
                              motion:
                                  mask:
                                    - 0,0,0,23,228,21,227,0
                          
                              #optional zone to detect person
                              zones:
                                zone_0:
                                  coordinates: 168,360,436,360,434,162,166,147
                                  objects:
                                    - person                          
                        
For more configuration options, refer to the Frigate official documentation here: Frigate Docs

Refer the video linked below for full step-by-step configuration

Refer Part 2 of the video linked below for the full step-by-step automation setup in Home Assistant


Contact me: 
© All Rights Reserved
My channel: