[Solved] Ffmpeg_noise Unavailable in Hass.io

Hi,

I am having issues trying to setup the Baby monitor from here: https://www.home-assistant.io/blog/2017/02/03/babyphone/. The entity id created by the binary_sensor has the state Unavailable.
My setup is as following:

  • RPI4 with HassIo (Home Assistant version 0.104.2)
  • Ubuntu personal machine with USB microphone to produce the noise (here I am creating the ffmpeg server also)

Home assistant configuration.yaml has the following config:

ffmpeg:
  ffmpeg_bin: /usr/bin/ffmpeg

binary_sensor:
  - platform: ffmpeg_noise
    input: rtp://236.0.0.1:2000
    initial_state: false
    duration: 2
    reset: 60
    peak: -32

I am starting the server on my Ubuntu machine using:
ffmpeg -re -f alsa -i hw:1,0 -acodec mp3 -ab 128k -ac 2 -f rtp rtp://236.0.0.1:2000

I am testing the stream (from within the Home Assistant docker container) using this:
ffmpeg -i rtp://236.0.0.1:2000 -vn test.mp3

There is no problem in creating the mp3 file with received sound.
Am I missing something in HA configuration, or shall i open an issue in HA github?

I think you need to set initial_state: true

initial_state
(boolean)(Optional)
Start ffmpeg with home-assistant.

Default value:
true

1 Like

Great, this was the problem.
Thank you very much!

Good to hear.

I’ve got 2 of these sensors set up and they have been working somewhat reliably. I ended up creating a script and button to restart the FFmpeg sensor.

As of today, one of my sensors is no longer working. Nothing has changed that I’m aware of. The RTSP feed is the same, the configuration in YAML is the same. However, one of them works and the other one starts, goes CLEAR, shows DETECTED, then becomes UNAVAILABLE.

I’ve added the initial_state: true line as outlined above, but that didn’t appear to fix it. And the one that IS working does not have the initial_state line.

UPDATE - literally rebooting the camera seemed to solve the issue. :frowning:

1 Like