Doorbell with Raspberry pi

I made a simple doorbell using one input pin of the raspberry pi. When the doorbell gets pressed the following happens:

  • an amplifier gets enabled
  • a sound is played via mpd over the amplifier
  • some lights in the house will flash so deaf people will notice it too
  • sends a message via pushbullet to my phone
  • after 15 seconds the amplifier will be disabled again to save power

The door switch is connected to GPIO-22 with a pullup resistor and a 100nF capacitor to ground for preventing false triggers and debouncing.
The enable-pin of the amplifier is connected to GPIO-16. It is not a very strong amplifier, but if anyone is interested I can share the schematics and pcb-layout (I build it myself).

For mpd you have to make a playlist with the sound you want to play. I have now a rooster (haan in my native language). Of course you are free to play any sound yu want.

Relevant part of configuration.yaml file:

media_player doorbel:
  - platform: mpd
    host: 127.0.0.1

notify:
  - name: mypushbullet
    platform: pushbullet
    api_key: !secret pbapi

switch: !include switch.yaml
binary_sensor: !include binsensor.yaml
automation: !include automations.yaml

in switch.yaml

- platform: rpi_gpio
  ports:
    16: Enable Amp

in binsensor.yaml

- platform: rpi_gpio
  ports:
    22: Deurbel
  pull_mode: UP
  invert_logic: true

Automation section

- alias: Deurbel ingedrukt
  trigger:
  - entity_id: binary_sensor.deurbel
    from: 'off'
    platform: state
    to: 'on'
  action:
  - service: switch.turn_on
    entity_id: switch.enable_amp
  - service: light.turn_on
    data:
      entity_id:
      - light.Bureau_Paul
      - light.Eetkamer_Tafel
      - light.woonkamer
      - light.koof
      flash: long
  - service: media_player.volume_set
    data:
      entity_id: media_player.main
      volume_level: 0.99
  - service: media_player.play_media
    data:
      entity_id: media_player.mpd
      media_content_id: haan
      media_content_type: playlist
  - service: notify.mypushbullet
    data_template:
       message: "Er is iemand aan de deur!"
  - delay: 00:00:15
  - service: switch.turn_off
    entity_id: switch.enable_amp

Next step is to program different sounds for different times of the day.

Hi Paul, I am basically trying to achieve the same setup that you designed, except I don’t need the flashing lights. I do however need a 12Vdc trigger signal to my amp. Would you be so kind to share your schematics and design please? I would like to see if I can use or modify it for my setup.
Thanks & regards,
Steps

The enable signal is directly connecetd to the GPIO and thus using 3.3V levels. I am using a small transistor (BC547) and pull up resistor (R3) to invert the signal and level shift it to 5V. Also do not forget R4 to limit the base current.
doorbel_sch
I hope this helps.

Great, thank you Paul!