This post may contain affiliate links. Please see our disclaimer for more info.

UPDATE: The Wansview K3 camera that I use is no longer available on Amazon at the time of this writing AND I’ve learned that newer firmwares do not support local RTSP – blah! I instead am providing links to the Wansview K2 – the 720p version of the camera. Any camera will work as long as it has RTSP (local access) support. Many newer brands (such as the K5) only offer cloud only support meaning it will not work just locally with Home Assistant.

I’ve recently become a parent, and it’s pretty epic. I highly recommend. It does come with its challenges however. Logistics and priorities were completely flipped up in the air. One of the challenges was finding an effective and secure baby monitor so that we could keep an eye on the little guy without busting the bank. Baby stuff can get expensive quick – I was looking to avoid spending $200 for a proprietary limited device. Plus many of those devices use RF so you only have a limited range and depending on interference, even more limited.

With this setup, you’ll be notified and be able to keep an eye on the kid wherever you have internet access. Your neighbor parents will look at your setup in awe.

Using Home Assistant as the base, I was able to research the details I needed to get started. This post proved to be extremely helpful – I’m using much of this in my setup.

Good parenting disclaimer: If you’ve used Home Assistant long enough, you’ll know that it can fail – most likely due to user error (in my experience!). It’s not just HA, any device/system can fail. With any automation that has critical consequences if not operating right, make sure your conscious of how its running. Do I trust this setup to tell me if my kid is crying after waking up from a nap? Yes! But if I notice he’s napping longer than normal, I do a quick check on the live feed every now and then. We all have different levels of parent paranoia!

Project goals

Accurate sensor when the baby is crying (making noise). However we don’t want false alarms when regular background noise is picked up (these camera mics can pick up a lot of noise!)

Video feed of the baby

Notifications on my phone and wife’s phone that we’re able to turn off/on independently (if one of us is not home for example)

Ingredients

Equipment

Setting up WiFi Cameras these days is pretty simple. It’s just a matter of informing the device of your WiFi name and password. I recommend using a static IP for your cameras – it will save you a bunch of time and makes keeping things organized much easier. I make all my devices static from within my router by assigning IPs to MAC addresses. If you’re having trouble getting your specific camera working with HA, do some googling of your model and HA. Chances are someone has already figured it out.

You don’t need a fancy camera for this setup by any means – I’m rocking a Wansview K3 that I paid $30 bucks for. I can’t find it anymore on Amazon – another option is the K2 Camera 720p. Do not buy the K5 – it’s not compatible with RTSP. As long as you can find a camera with the standard IP camera protocol, RTSP, you’ll likely be able to integrate with HA.

Integration

This part is a little more complicated – there are a lot of components involved here. Luckily it’s not anything too complicated – just a lot of parts to fit together. I’ll walk through each part and provide the necessary config code. I highly recommend doing some trial an error as you get each component setup to confirm it’s working as intended before moving onto the next piece. This way, if there is an issue, you can limit your potential problem scope areas.

Camera

Follow the steps on HA Camera integration . You might need to do some trial and error to figure out what config options work best for you. At a minimum, you’ll need to add the still image parameter and the stream source parameter. Additionally, I found that in order to get the streaming to work correctly, I needed to put in the user and password twice – once as arguments and again within the RTSP stream source link – see my config below. The below works for my Wansview K3 Camera which also has the same protocols as the K2 camera.

camera: - platform: generic name: Nursery stream_source: rtsp://[username]:[password]@192.168.1.199/live/ch0 still_image_url: http://192.168.1.199/mjpeg/snap.cgi?chn=0 username: [username] password: [password] authentication: digest

FFMEPG

This is the brains of this whole operation. FFmpeg is a light yet powerful video processing tool. This tool does the actual scanning of the camera’s audio source and triggers when the audio meets a certain pattern (specified by us – details in the FFmpeg Binary Sensor section below). You can even use FFmpeg to process the video stream too to check for motion and other things, however any type of video processing is a heavy lift on the processor. A raspberry pi isn’t the best option for this. Luckily, audio processing only takes up about 5% CPU load on average based on my findings with my raspberry pi 3.

Don’t let this powerful tool put you at unease; getting this working with HA is a breeze.

If you are using HASSIO, FFmpeg is actually already installed. Enable it by just including ffmpeg: in your config. To integrate with other installations of HA, see the HA docs here.

ffmpeg:

FFMPEG Noise Binary Sensor

I’ve written a lot about binary sensors – I use them for many of my projects. They are simple and effective. We are lucky enough to have a FFmpeg noise binary sensor already built into HA. This means that once FFmpeg is triggered via a camera audio feed, it’ll flip this binary sensor which we can then use to trigger the rest of our automations. This saves us a TON of trouble so that we don’t have to create our own sensor from scratch.

Enable this by adding the below to your configuration.yaml. This includes the audio frequency specifications for what FFmpeg should focus in on (baby crying vs car going by). I grabbed this from this post, and found that I didn’t need to tweak the settings at all.

binary_sensor: - platform: ffmpeg_noise input: rtsp://[username]:[password]@192.168.1.199/live/ch0 extra_arguments: -filter:a highpass=f=300,lowpass=f=2500,volume=volume=2 -codec:a libmp3lame -ar 16000 initial_state: false duration: 2 reset: 60 peak: -32

Input Boolean (Switch)

Input_boolean sounds fancy, but these are all just digital switches in the HA interface. These allow us to turn automations off and on from the front end. For this use case, we use these to 1) enable the baby monitoring and 2) tell the automation which devices to send the notifications to.

input_boolean: baby_monitor_mom: name: Baby Monitor Mom initial: off baby_monitor_dad: name: Baby Monitor Dad initial: off

Notifications

This is the essential part to make this all worthwhile: getting notified when the little one needs some love.

The beauty of this setup is that you can be anywhere with internet connectivity and get notifications that the baby is screaming.

No need to worry about RF range and be pinned to a 30 foot radius around the baby’s room. My wife and I are able to enjoy a late evening in the backyard while still keeping an eye on the little one.

I’m using iOS notifications provided by the HA iOS companion. I’m able to get a fast notification that includes a picture of the room from the camera on my phone and watch. This way I’m able to quickly see if the baby is actually crying or just made a mid-sleep noise – it happens a lot!

There is no additional code needed for this if you are using the mobile_app platform. See HA for details on how to set up. Otherwise set your own platform up. Once complete, you’ll have a notify service that you’ll use to send messages to devices.

Notification Groups

While not 100% necessary for this project, using notification groups will make your automations much easier. They essentially just let you create aliases (or groups) and all the entities in that group will get notified. I use this for 2 purposes:

Create a parents group that notifies myself and my wife Create wrapper groups for devices so I don’t need to change all my automations/setup if my device name changes. For example, the new HA iPhone companion (in beta as of this writing) uses whatever I named my iPhone as the device ID. Right now my iPhone is named iPhoneX. But someday it’ll be iPhone12 or 30 (who knows!). I created a group that takes my device ID as an entity and named the group ad_iphone, which I use in all my automations. Then when my device name changes, I just need to update the group and not all the automations.

notify: - name: parents platform: group services: - service: adiphone - service: ios_lbiphone - name: adiphone platform: group services: - service: mobile_app_ad_iphonex

Stream

This is a somewhat new component that allows you to stream video through Home Assistant to HA itself or other devices. I use this to stream my camera’s feed to HA’s front end. This can be extremely handy as you can setup your automations to check if you’re watching ChromeCast for example and if so, stream the video to the TV. While this component isn’t required to receive notifications – it’s nice to see a live feed of the kid.

Setup for this was a little trial and error for my cameras. I needed to update the camera’s RTSP URL (See the camera section above) to include my username and password.

stream:

Automation

Getting things automated right took a bit of thought Let’s revisit our goals and come up with the following automation specific goals:

Accurate trigger to start the notification process (FFmpeg noise binary sensor does this for us) when the camera picks up audio

Provide an image (or video) in my notification

Ability to turn the notifications off and on independently for multiple devices

The below code (automations.yaml) and Node Red setup will accomplish the above. I use Node Red for all my automations but I had my old YAML lying around to share. Download my Node Red flow here.

Node Red Flow

# turn on bb monitor if either mom or dad switch is on - id: babyMonitorOn alias: bb Monitor On trigger: - platform: state entity_id: input_boolean.baby_monitor_mom from: "off" to: "on" - platform: state entity_id: input_boolean.baby_monitor_dad from: "off" to: "on" action: service: ffmpeg.start entity_id: binary_sensor.ffmpeg_noise condition: - condition: state entity_id: binary_sensor.ffmpeg_noise state: unavailable # mom's switch turned off, check if dad's is still on # if so, leave it on. If not, turn it off - id: babyMonitorOffMom alias: bb Monitor Off Mom trigger: - platform: state entity_id: input_boolean.baby_monitor_mom from: "on" to: "off" action: service: ffmpeg.stop entity_id: binary_sensor.ffmpeg_noise condition: - condition: state entity_id: input_boolean.baby_monitor_dad state: "off" # dad's switch turned off, check if mom's is still on # if so, leave it on. If not, turn it off - id: babyMonitorOffDad alias: bb Monitor Off Dad trigger: - platform: state entity_id: input_boolean.baby_monitor_dad from: "on" to: "off" action: service: ffmpeg.stop entity_id: binary_sensor.ffmpeg_noise condition: - condition: state entity_id: input_boolean.baby_monitor_mom state: "off" # baby triggered alarm! Notify Mom - id: babyMonitorMom alias: Baby monitor notify mom trigger: platform: state entity_id: binary_sensor.ffmpeg_noise from: "off" to: "on" action: service: notify.ios_lbiphone data: title: Baby Alert! message: bb be noisy... condition: - condition: state entity_id: input_boolean.baby_monitor_mom state: "on" # baby triggered alarm! Notify Dad - id: babyMonitorDad alias: Baby monitor notify dad trigger: platform: state entity_id: binary_sensor.ffmpeg_noise from: "off" to: "on" action: service: notify.ios_adiphone data: title: Baby Alert! message: bb be noisy... condition: - condition: state entity_id: input_boolean.baby_monitor_dad state: "on"

And there you have it! After setting this up you’ll officially be parent 2.0 and impress all your neighbors!