Noise/Sound Detection

I’m trying to create noise detection system that I can leave plugged in remotely, connected over wifi to detect when noise is over a certain threshold. Just a simple yes, no, unavailable flag is all I need. I don’t care about the dB level or anything specific.

To do this at the moment I am using an old android phone with IPWebcam installed and running over IP to my homeassistant server and added as a ffmpeg_noise custom platform into the configuration. When noise is detected it sends a notification to my phone.

configuration.yaml

ffmpeg:
  
binary_sensor:
  - platform: ffmpeg_noise
    name: "Pixel5a"
    input: http://192.168.1.22:8080/audio.wav
    extra_arguments: -nostats
    peak: -40

#restarts ffmpeg if "unvailable"
- switch:
  - turn_on:
    - target:
        entity_id:
        - automation.restart_ffmpeg_noise_if_unavailable_new
      action: automation.turn_on
    - target:
        entity_id:
        - automation.restart_ffmpeg_noise_if_unavailable_new
      action: automation.trigger
    turn_off:
    - target:
        entity_id:
        - automation.restart_ffmpeg_noise_if_unavailable_new
      action: automation.turn_off
    default_entity_id: switch.ffmpeg_auto_restart
    name: FFmpeg Auto Restart
    state: '{{ is_state(''automation.restart_ffmpeg_noise_if_unavailable_new'', ''on'')
      }}'

I use it for when I’m in my office or gaming at night to ensure that I don’t miss it if one of my kids makes a noise (2.5 and 4 years old, so old enough to not need a proper baby monitor setup anymore, but young enough that I want to hear if they’re upset)

The problem with my current setup is that it is incredibly flakey and I assume by nature of using ffmpeg fairly “heavy”. It often becomes unavailable, or just disconnects without flagging, or gets stuck detected or clear. I’ve basically totally lost faith in it and just want to make a better system. I just had a play with the IPWebcam integration but it doesn’t seem to be exposing the sound sensor and seems to be a bit flakey as well with unavailable indications popping up.

From what I see online and from Gemini, it’s pushing me towards ESPHome and a microphone. Is this a workable solution, or is there something easier? Something standalone from Tuya/Aliexpress for example? Or just a better integration? ONVIF integration appears to expose a lot of sensors, will try that when I get home as well.

1 Like

The simplest thing to make would be an ESPHome device triggered by a GPIO input attached to something like this:

https://www.aliexpress.com/item/32607737910.html

Adjustable threshold on the device - - although it would be nicer if you could adjust the threshold from HA. Devices with Modbus / TTL outputs are available but considerably more expensive and harder to code.

1 Like

Thanks for the suggestion! Looks like exactly what im after.

In the meantime I did get my ipcamera working a bit better. The integration does expose a sound sensor when you configure the app correctly and it seems a lot more consistent and controllable than my older ffmpeg solution.