Birgie's Barking Burglar Bell

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.

9 Likes

On a related note, causing a xiaomi hub to bark like a dog sets our own dogs off, hilariously as they search for the interloper. Xiaomi Gateway (Aqara) - Home Assistant

2 Likes

Awesome idea and implementation!
Great many thanks for this, much appreciated.

Such a great idea and thanks for sharing. @pashdown, are you able to share how you use the vacation boolean please?

I use the vacation boolean because HomeKit doesn’t have a “armed_vacation” for the alarm. It appears as a switch in HomeKit. That is the sole purpose. If you don’t use HomeKit, you could probably just get away with:

  condition:
    - condition: state
      entity_id: alarm_control_panel.home
      state: armed_vacation

Google send me here.This is exactly what I was looking for! Kind of sad that I’m way to stupid to make this work in any way. :sob:

If anybody knows a step by step tutorial for dummies for something like this, would they be so kind to please let me know? :pray:

P.S. such a pretty doggo! :heart_eyes:

The code is given above. Let us know what parts you need help with.

I should add that “armed_vacation” has since been added to the alarm_control_panel entity, and I’ve moved away from the additional input_boolean to determine whether the house in vacation mode. Here’s a condition example:

  condition:
    - condition: state
      entity_id: alarm_control_panel.home
      state: armed_vacation