I have had issues with birds on our patio. They poop on our furniture and attack our windows (they see their reflection and think it’s another bird). I didn’t want to have bird spikes on our furniture or a fake owl, or any other standard bird control devices, so I used HA with Frigate.
Frigate uses the Amcrest 8MP camera to look for birds. When it sees one it flashes the patio lights and plays an audio track of gunshots to scare the birds away. It also sends me a notification with a snapshot of the bird, I will likely remove the notifications in the future, but it’s been helpful right now as I debug it and adjust the sensitivity.
This automation has a huge WAF!
The system in action
Frigate detecting the bird
Here are my settings
Frigate.yaml
record:
enabled: true
retain:
days: 0
events:
max_seconds: 300
retain:
default: 10
mode: motion
motion:
# Optional: Minimum size in pixels in the resized motion image that counts as motion (default: 30)
# Increasing this value will prevent smaller areas of motion from being detected. Decreasing will
# make motion detection more sensitive to smaller moving objects.
# As a rule of thumb:
# - 15 - high sensitivity
# - 30 - medium sensitivity
# - 50 - low sensitivity
contour_area: 17
cameras:
patio:
ffmpeg:
inputs:
- path: rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0
roles:
- detect
detect:
width: 3840
height: 2160
objects:
track:
- person
- bird
filters:
bird:
# Optional: minimum score for the object to initiate tracking
min_score: 0.1
# Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive
threshold: 0.2
mask:
# Masks near the patio door so it won't detect bugs as birds
- 0,2160,0,0,709,0,986,2160
# Masks the window
- 822,771,1475,664,1472,34,763,124
person:
mask:
# Masks the dining room window
- 845,944,1489,783,1450,28,735,124
# Masks the backyard to prevent detection of someone in the yard
- 3419,1009,3682,0,2667,0,2585,562
motion:
mask:
# Masks the top area of the patio to block the Reserve sign from being seen as a person
- 3572,337,3584,262,2963,29,2845,0,2629,29
snapshots:
enabled: true
timestamp: false
bounding_box: true
retain:
default: 3
Automation:
- id: '1650462395368'
alias: Patio - Scare Birds
description: ''
trigger:
- platform: state
entity_id: binary_sensor.patio_bird_motion
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.patio_person_motion
state: 'off'
for:
hours: 0
minutes: 1
seconds: 0
action:
- service: camera.snapshot
data:
filename: /config/www/patiobird.jpg
target:
entity_id: camera.patio_bird
- service: media_player.volume_set
data:
volume_level: 1
target:
entity_id:
- media_player.chromecastultra8115
- media_player.patio_google_home
- service: media_player.play_media
data:
media_content_id: https://MYURL.com/local/gunshots.mp3
media_content_type: Music
target:
entity_id:
- media_player.chromecastultra8115
- media_player.patio_google_home
- service: notify.mobile_app_brad_s_s21_ultra
data:
message: Bird spotted on patio at {{ now().strftime('%I:%M %p') }}
data:
image: https://MYURL.com/local/patiobird.jpg
- service: script.turn_on
data: {}
target:
entity_id: script.patio_lights_flash
- service: media_player.volume_set
data:
volume_level: 0.5
target:
entity_id:
- media_player.chromecastultra8115
- media_player.patio_google_home
mode: single
Light flash script (There may be a better way to do this)
patio_lights_flash:
alias: Patio Lights - Flash
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: light.patio_can_lights
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_off
data: {}
target:
entity_id: light.patio_can_lights
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_on
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: light.patio_can_lights
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_off
data: {}
target:
entity_id: light.patio_can_lights
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_on
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: light.patio_can_lights
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_off
data: {}
target:
entity_id: light.patio_can_lights
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_on
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: light.patio_can_lights
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_off
data: {}
target:
entity_id: light.patio_can_lights
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_on
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: light.patio_can_lights
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_off
data: {}
target:
entity_id: light.patio_can_lights
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_on
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: light.patio_can_lights
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: switch.patio_wall_lights
- service: light.turn_off
data: {}
target:
entity_id: light.patio_can_lights
mode: single