When I bought my Ezviz doorbell a few years ago I expected it to play a notification on my Google Home Mini too, since it said compatible with Google Home. But it never worked, it would just tell me it found the device but I couldn't do anything with it. Now I finally bothered to find a way to receive doorbell button notifications, I can use the go-chromecast CLI tool to play a sound on my Google Home Mini or Nest Audio devices.
Simply install go-chromecast following the instructions from the github page, and then add the command to load a sound file to the script from before:

#!/bin/bash
FREQ=30         # max every 30 secs
LASTSENT=0
CAST_IP="192.168.1.26"
CAST_SOUND="/usr/share/sounds/Kopete_User_is_Online.ogg"
tail -fn0 /var/log/named/queries.log | while read; do
        if [[ "$REPLY" =~ .*"ali-alarm-eu.oss-eu-central-1.aliyuncs.com"|"alarm.eu.s3.amazonaws.com".* ]]; then
                NOW=$(date +%s)
                if [ $NOW -gt $((LASTSENT+FREQ)) ]; then
                        /path/to/go-chromecast -a $CAST_IP load $CAST_SOUND 2>&1 &> /dev/null &
                        echo "BUTTON PRESSED" | mail -s "Doorbell pressed" adam
                        LASTSENT=$NOW
                else
                        echo "Button pressed, but not sending mail"
                fi
        fi
done

It seems to work best when supplying the IP address of your device rather than the uuid. If you want to cast to multiple devices at the same time then you can just copy and paste the go-chromecast line for each IP address since it runs in the background anyway, so there wouldn't be any additional delay.
The only downsides to playing a doorbell notification this way is that the Google Home speaker will play the "device connected" sound just before the actual doorbell sound, and if you are listening to music on the speaker then that will be stopped.

Previous Post Next Post