Skip to content

Commit 4768b54

Browse files
committed
Minor changes
1 parent df2bbc3 commit 4768b54

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

source/_posts/2017-02-04-babyphone.markdown

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,28 @@ date: 2017-02-04 00:00:00 +0100
66
date_formatted: "February 4, 2017"
77
author: Pascal Vizeli
88
comments: true
9-
categories: How-To Babyphone
9+
categories: How-To
1010
og_image: /images/blog/2017-02-babyphone/social.png
1111
---
1212

13-
One of the hardest part of being a parent is keeping a constant eye on the baby to make sure that baby is doing well. Thus, it is not surprising that baby monitors are one of the fastest growing baby product category. However, many of the baby monitors available in the market are rather dumb and expect the parents to keep looking at the video stream or listen to the audio. This how-to will help you create a smart baby monitor on a budget and integrate it with Home-Assitant. Instead of relying on the poor quality baby monitor speakers, we use our existing speakers (e.g., Sonos). We can also send notifications (with pictures) to avoid constant monitoring of the feed.
13+
One of the hardest part of being a parent is keeping a constant eye on the baby to make sure that baby is doing well. Thus, it is not surprising that baby monitors are one of the fastest growing baby product category. However, many of the baby monitors available on the market are rather dumb and expect the parents to keep looking at the video stream or listen to the audio. This how-to will help you create a smart baby monitor on a budget and integrate it with Home Assitant. Instead of relying on the poor quality baby monitor speakers, we use our existing speakers (eg. Sonos). We can also send notifications (with pictures) to avoid constant monitoring of the feed.
1414

1515
Obviously, you can use the setup as a general purpose surveillance system to monitor noise in the whole house.
1616

1717
<!--more-->
1818

1919
### {% linkable_title Setup %}
2020

21-
We need an IP-camera that can capture sound in the baby's room. It is also possible to use a Raspberry Pi with a microphone and send the audio to our Home-Assistant with `ffmpeg -f alsa -i hw:1,0 -vn -f rtp rtp://236.0.0.1:2000` over multicast. We can set `input` option on Home-Assistant side to `rtp://236.0.0.1:2000` in same network.
21+
We need an IP camera that can capture sound in the baby's room. It is also possible to use a Raspberry Pi with a microphone and send the audio to Home Assistant with `ffmpeg -f alsa -i hw:1,0 -vn -f rtp rtp://236.0.0.1:2000` over multicast. We can set the `input` option on the Home Assistant side to `rtp://236.0.0.1:2000` in same network.
2222

23-
Next, we attach a ffmpeg noise binary sensor to our IP-camera. The sensor has an output `option` that allows us to send the output to icecast2 server for playing over speakers integrated with Home-Assistant (e.g., Sonos). We can use the binary sensor in our automation. You can ignore the icecast2 setup if you don't want to play the audio after the noise sensor trigger.
23+
Next, we attach a FFmpeg noise binary sensor to our IP camera. The sensor has an output `option` that allows us to send the output to an [icecast2](http://icecast.org/) server for playing over speakers integrated with Home Assistant (eg. Sonos). We can use the binary sensor in our automation. You can ignore the icecast2 setup if you don't want to play the audio after the noise sensor trigger.
2424

2525
<p class='note'>
2626
We change the platform name for binary sensor in 0.38 from `ffmpeg` to `ffmpeg_noise`. Also all service going to component and was rename from `binary_sensor.ffmpeg_xy` to `ffmpeg.xy`.
2727
</p>
2828

29-
On Raspbian Jessie, you can setup [ffmpeg](/components/ffmpeg) and install a [icecast2](http://icecast.org/) server using:
29+
On Raspbian Jessie, you can setup [FFmpeg](/components/ffmpeg) and install a [icecast2](http://icecast.org/) server using:
30+
3031
```bash
3132
$ sudo echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list
3233
$ sudo apt-get update
@@ -35,6 +36,7 @@ $ sudo apt-get install icecast2
3536
```
3637

3738
We setup a icecast mount point for our babyphone and update `/etc/icecast2/icecast.xml`:
39+
3840
```
3941
<mount>
4042
<mount-name>/babyphone.mp3</mount-name>
@@ -45,23 +47,23 @@ We setup a icecast mount point for our babyphone and update `/etc/icecast2/iceca
4547
</mount>
4648
```
4749

48-
Now we can add the noise sensor to Home-Assistant. We can lower the sensitivity of the sensor (so that you are not inundated with notifications for every cough of the baby) to 2 seconds using the `duration` option. The sensor should wait 60 seconds before restoring and it prevent us that a wine break will triggering a new alarm.
50+
Now we can add the noise sensor to Home Assistant. We can lower the sensitivity of the sensor (so that you are not inundated with notifications for every cough of the baby) to 2 seconds using the `duration` option. The sensor should wait 60 seconds before restoring and it prevent us that a wine break will triggering a new alarm.
4951

50-
We can optimize the audio stream for human voice by using a highpass filter with 300Hz and a lowpass filter with 2500Hz. This filters out all non-human sounds such as background noise. We can even add a volume amplifier if the microphone volume is too low (you can remove it from `extra_arguments`). For icecast2 we convert the audio stream to mp3 with samplerate of 16000 (which is the minimum for Sonos speakers). We use `peak` to set the threshold for noise detection, where 0 dB is very loud and -100 dB is low.
52+
We can optimize the audio stream for human voice by using a highpass filter with 300 Hz and a lowpass filter with 2500 Hz. This filters out all non-human sounds such as background noise. We can even add a volume amplifier if the microphone volume is too low (you can remove it from `extra_arguments`). For icecast2 we convert the audio stream to mp3 with samplerate of 16000 (which is the minimum for Sonos speakers). We use `peak` to set the threshold for noise detection, where 0 dB is very loud and -100 dB is low.
5153

5254
```yaml
5355
binary_sensor:
54-
- platform: ffmpeg_noise
55-
input: rtsp://user:pw@my_input/video
56-
extra_arguments: -filter:a highpass=f=300,lowpass=f=2500,volume=volume=2 -codec:a libmp3lame -ar 16000
57-
output: -f mp3 icecast://stream_user:stream_pw@127.0.0.1:8000/babyphone.mp3
58-
initial_state: false
59-
duration: 2
60-
reset: 60
61-
peak: -32
56+
- platform: ffmpeg_noise
57+
input: rtsp://user:pw@my_input/video
58+
extra_arguments: -filter:a highpass=f=300,lowpass=f=2500,volume=volume=2 -codec:a libmp3lame -ar 16000
59+
output: -f mp3 icecast://stream_user:stream_pw@127.0.0.1:8000/babyphone.mp3
60+
initial_state: false
61+
duration: 2
62+
reset: 60
63+
peak: -32
6264
```
6365
64-
We use the option `initial_state` to prevent the ffmpeg process from starting with Home-Assistant and only start it when needed. We use an `input_boolean` to control the state of ffmpeg services using the following automation.
66+
We use the option `initial_state` to prevent the FFmpeg process from starting with Home Assistant and only start it when needed. We use an `input_boolean` to control the state of FFmpeg services using the following automation.
6567

6668
```yaml
6769
input_boolean:

0 commit comments

Comments
 (0)