So, this is more of a story than anything. A couple days ago my neighbor’s house was destroyed in a fire. A pet was lost, as was everything inside the house, but thankfully the tenants survived. I’ve been pretty shaken about the event because I slept through the whole thing despite having a super smart home. I never assumed I would have missed something as major as that happening right in front of my house.
I checked my security footage and saw the whole thing – what a hero my neighbors were and the time it took for the fire department to arrive. I realized just how a couple of minutes’ warning could have saved a dog and a lot of property. Now I can’t do anything about what happened, but I can be better prepared. I’d like to be a better neighbor. (By the way, I did give the family some money and clothes and offered to help as much as I can. I just feel bad and I have enough anxiety to always want to solve a problem.)
I decided to adapt the “Smart Baby Monitor” guide to listen for loud noises during the night from the audio of my security camera. I read a lot of reddit posts and forum comments to tweak the arguments a bit for what I want to do.
So to my configuration.yaml file, I just put:
binary_sensor:
- platform: ffmpeg_noise
name: "Front Noise Sensor"
input: -rtsp_transport tcp -i rtsp://IP_ADDRESS_OF_CAMERA_USING_LOWEST_QUALITY_FEED
extra_arguments: -filter:a highpass=f=300,lowpass=f=2500,volume=volume=2 -codec:a libmp3lame -ar 16000 -nostats
initial_state: true
duration: 1
reset: 15
peak: -15
Then I built an automation:
alias: Noise light
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.front_noise_sensor
to: 'on'
for:
hours: 0
minutes: 0
seconds: 45
condition: []
action:
- wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.front_noise_sensor
to: 'off'
for:
hours: 0
minutes: 0
seconds: 20
- type: turn_off
device_id: e0654715edf53b5f0137ddc2c80653e1
entity_id: light.turtle_level_light_color_on_off
domain: light
mode: single
Right now I’m running it 24/7 to see how often the automation triggers, but so far I’m really pleased with the results. I’m adjusting the “peak” value to make it detect significanlty loud noise and ignore loud cars. My goal is to replace the automation with an alexa_media action to make an announcement on my echos and send critical notifications to my phone during times I’m sleeping.
Anyway, I wanted to share this because I see there are a lot of posts talking about trouble with ffmpeg_noise but also because I think this might be helpful if you’re like me and can sleep through a literal explosion.