My neighbors took off for the Thanksgiving vacation and the thought occurred to me that if I was intent on robbing their house, I’d ring the doorbell first to make sure nobody was home. Yes, I have motion, door, and occupancy sensors scattered all around the house, but I’d prefer to stop someone at the door than have to deal with calling the police when I may be in a different country or continent.
Our dog, if she doesn’t go with us on a trip, goes to the kennel where she parties down with her other dog buddies. However, if she is at home, every doorbell ring results in a rather vicious series of barks to warn anyone from visiting us, delivering packages, or giving us mail.
Today I spent some time irritating my dog by triggering the doorbell and recording her responses to it. I’ve made these files available for anyone to use, whether you have a vicious sounding dog or not. Get them here.
I used the “config/www” directory under supervised HA and created a “sounds” directory to fetch the mp3s from. This is referenced by media_content_id as ‘http://(your IP address here):8123/local/sounds/soundfile.mp3’.
However you get your automation trigger from the doorbell is up to you. Mine comes in via an input_boolean to filter the actual button from being hit twice within a few seconds. I also have an input_boolean that I throw for vacation that changes which motion sensors are monitored when I’m away along with some climate controls and adjusting the hot water heater down. The media player is a Sonos AMP.
automation:
- alias: Pushbutton Doorbell Vacation Bark
trigger:
platform: state
entity_id: input_boolean.doorbell
to: 'on'
condition:
- condition: state
entity_id: input_boolean.vacation
state: 'on'
action:
- service: media_player.volume_set
data:
volume_level: 0.50
target:
entity_id: media_player.sonos
- delay: '00:00:02'
- service: media_player.play_media
target:
entity_id: media_player.sonos
data_template:
media_content_id: >
{% set bark = ( 'bark-double', 'growl-bark' ) | random %}
{{ 'http://10.10.10.10:8123/local/sounds/' ~ bark ~ '.mp3' }}
media_content_type: 'music'
- delay: '00:00:04'
- service: media_player.play_media
target:
entity_id: media_player.sonos
data_template:
media_content_id: >
{% set bark = ( 'bark', 'lotta-bark' ) | random %}
{{ 'http://10.10.10.10:8123/local/sounds/' ~ bark ~ '.mp3' }}
media_content_type: 'music'
- delay: '00:00:04'
- service: media_player.play_media
target:
entity_id: media_player.sonos
data_template:
media_content_id: >
{% set bark = ( 'bark-growl', 'bark-double2' ) | random %}
{{ 'http://10.10.10.10:8123/local/sounds/' ~ bark ~ '.mp3' }}
media_content_type: 'music'
- delay: '00:00:04'
- service: media_player.volume_set
data:
volume_level: 0.30
target:
entity_id: media_player.sonos
My templates are setup to randomize between two choices, three times, to avoid repetition and thus causing the barks to sound artificial. If a template master knows a more concise way to shuffle the files and play a subset without overlapping, I’d like to see it.