Doorbell with media player function

I’m looking for a doorbell that allows me to send media/TTS to the built in speaker so, for example, I can send a canned to the doorbell response asking them to leave the package from a push notification if I see a delivery driver at the door.

So far I’ve only seen the UniFi doorbells/cameras support this. Are there any others?

I’ve made a shell script that can do this on the AD410 Amcrest that I can call from HA. Works okay.

#!/bin/bash
TEXT="$1"
LOG=ttslog
LOG=/config/ttslog
echo "TEXT: $TEXT" > $LOG

FILE=`curl -v -X POST \
 -H "Authorization: Bearer xxxxxxx" \
 -H "Content-Type: application/json" \
 -d "{\"message\": \"$TEXT\", \"platform\": \"google_cloud\"}" \
 https://ha.xxxx.xxxx:18123/api/tts_get_url | awk -F/ '{print $6}' |awk -F\" '{print $1}'` >> $LOG 2>&1
echo CURLRC=$? >> $LOG

echo
echo FILE:$FILE >> $LOG
echo
ffmpeg -y -i "/config/tts/$FILE" -c:a pcm_alaw -ac 1 -ar 8000 -sample_fmt s16 /config/audio_test.al >> $LOG 2>&1
echo FFMPEGRC=$? >> $LOG
echo

#  --digest 
curl -vvv --user 'admin:xxxxxxV' \
  --limit-rate 8K \
  --expect100-timeout 3 \
  --connect-timeout 5 \
  --no-keepalive \
  --max-time 7 \
  -F "[email protected]/config/audio_test.al;type=Audio/G.711A" \
  -H "Content-Type: Audio/G.711A" \
  -H "content-length: 9999999" \
  "http://10.100.1.143/cgi-bin/audio.cgi?action=postAudio&httptype=singlepart&channel=1" >> $LOG 2>&1
echo DOORRC=$? >> $LOG
exit 0
shell_command:
  doorbelltts: >-
    /config/ttsplay "{{ states('input_text.tts_door_text') }}"

It would be easier if the gstreamer integration was available in HA.

That plays audio on the doorbell?

Yes. I set the content of an input text and it will play it. It’s hacky but it works. If HA ever fixes gstreamer, it would work easier than doing it like this.

In theory, you can play any mp3 audio if you modify the script to convert it using ffmpeg to the right input codec like above. I will say that I don’t believe the length of the audio can be very long… YMMV

1 Like

I finally got the script to run with no errors on my setup, but the doorbell keeps returning the following:

  • We are completely uploaded and fine

100 9695 0 0 100 9695 0 8183 0:00:01 0:00:01 --:–:-- 8188* Empty reply from server

100 9695 0 0 100 9695 0 8180 0:00:01 0:00:01 --:–:-- 8188

  • Closing connection 0
    curl: (52) Empty reply from server

Any idea why I keep getting an empty reply from the server?

It must have been something to do with the vlan settings, but it is working now. I still get curl: (28) Operation timed out, but the sound does play on the doorbell.