How to Make a Wireless Door Bell With Home Assistant

Wireless doorbells are a great way to add ringing to a home or office without using wires. However, these wireless bells have limited pre-configured MIDI sounds that play when someone presses the button on the transmitter unit.


Although you can toggle between the MIDI sounds and increase or decrease the volume, that’s all you can do with these wireless doorbells. However, today we are going to build a DIY smart wireless doorbell that you can add custom MP3 sounds or music files to play when someone presses the doorbell button. You can also customize the setup and use the bell as a smart speaker.


things you need

Here’s what you need to build and set up a custom DIY smart doorbell.

  • Home Assistant server running on a Raspberry Pi or other supported device.
  • 2 x Wemos D1 Mini or NodeMCU boards.
  • 50mm speaker.
  • A PAM8403 mini 5V digital amplifier board.
  • DuPont or jumper wires. You may also need a soldering iron and tin for soldering connections if you want a permanent connection.
  • Suitcase for assembling all parts. You can 3D print this case.

Step 1: Build a Smart Speaker

First we will build a smart speaker that works with Home Assistant and then use it as a smart bell for this project. You can also use this smart bell to play voice alerts. The steps are as follows:

Read  How to unlock power you're not using, according to one of golf's best teachers | Instruction

  1. Open Home Assistant and install the ESPHome add-on.
  2. Once installed, open ESPHome and click +New device.
  3. click Continue and enter a name, e.g smart speaker.
  4. click Next > Select a specific board and choose Wemo’s D1 and Wemo’s D1 mini. click Next.
  5. Find a smart speaker in the list and click To edit Button.
  6. In your YAML editor window, update the WiFi SSID and password.
  7. Then paste the following code right below captive_portal:
    uart:
    tx_pin: GPIO3
    rx_pin: GPIO1
    baud_rate: 9600
    dfplayer:
    on_finished_playback:
    then:
    logger.log: 'Playback finished event'
    api:
    encryption:
    key: "YourEncryptionKey"
    services:
    - service: dfplayer_next
    then:
    - dfplayer.play_next:
    - service: dfplayer_previous
    then:
    - dfplayer.play_previous:
    - service: dfplayer_play
    variables:
    file: int
    then:
    - dfplayer.play: !lambda 'return file;'
    - service: dfplayer_play_loop
    variables:
    file: int
    loop_: bool
    then:
    - dfplayer.play:
    file: !lambda 'return file;'
    loop: !lambda 'return loop_;'
    - service: dfplayer_play_folder
    variables:
    folder: int
    file: int
    then:
    - dfplayer.play_folder:
    folder: !lambda 'return folder;'
    file: !lambda 'return file;'
    - service: dfplayer_play_loop_folder
    variables:
    folder: int
    then:
    - dfplayer.play_folder:
    folder: !lambda 'return folder;'
    loop: true
    - service: dfplayer_set_device_tf
    then:
    - dfplayer.set_device: TF_CARD
    - service: dfplayer_set_device_usb
    then:
    - dfplayer.set_device: USB
    - service: dfplayer_set_volume
    variables:
    volume: int
    then:
    - dfplayer.set_volume: !lambda 'return volume;'
    - service: dfplayer_set_eq
    variables:
    preset: int
    then:
    - dfplayer.set_eq: !lambda 'return static_cast<dfplayer::EqPreset>(preset);'
    - service: dfplayer_sleep
    then:
    - dfplayer.sleep
    - service: dfplayer_reset
    then:
    - dfplayer.reset
    - service: dfplayer_start
    then:
    - dfplayer.start
    - service: dfplayer_pause
    then:
    - dfplayer.pause
    - service: dfplayer_stop
    then:
    - dfplayer.stop
    - service: dfplayer_random
    then:
    - dfplayer.random
    - service: dfplayer_volume_up
    then:
    - dfplayer.volume_up
    - service: dfplayer_volume_down
    then:
    - dfplayer.volume_down
  8. Substitute yourencryption key in the above code with your existing encryption key. Also remove the code below if it is above the captive_portal: Text – there should only be one API: section In the complete code, otherwise you will get compilation errors.
    api:
    encryption:
    key: "YourEncryptionKey"
  9. click Save on computer and then click To install.
  10. Select the Connect it to this computer option and wait for the firmware to compile.
  11. Once the firmware is compiled, click the Download project Link to download the firmware.
  12. click Open ESPHome Web and connect your D1 mini to the PC with a micro USB cable.
  13. click Connect and select that COM port where D1 mini is connected.
  14. click To install and then click Choose file to select the downloaded firmware.
  15. click To install.
  16. Once the firmware is installed, refer to the following diagram to connect the DFPlayer or your MP3 player module to the D1 mini board.

By default, the DFPlayer module can drive two 3W speakers, which you can connect to the SPK_1 and SPK_2 pins as shown in the diagram. The other terminal of both speakers is connected to the GND terminal between the two speaker terminals of the DFPlayer module.

Tip: For a louder and fuller sound from your 50mm or larger 3W speaker, make sure you install an amplifier module such as a PAM8403 between the speaker and the DFPlayer.

Step 2: Create a Smart Switch

Take another D1 miniboard and follow these steps to build a smart switch.

  1. Go to home assistant > ESPHomeclick New device, and then create a new project named bell switch. Be sure to choose Wemo’s D1 and Wemo’s D1 mini Blackboard.
  2. Click on that To edit under the bell-switch project and paste the following code directly below it captive_portal:
    switch:
    - platform: gpio
    pin: D2
    id: relay
    name: "Bell"
    icon: "mdi:bell"
    on_turn_on:
    - delay: 200ms
    - switch.turn_off: relay
  3. Also, update the WiFi SSID and password.
  4. click Save on computer and then click To install.
  5. click Connect it to this computer and then download the firmware.
  6. click Open ESPHome Web and use the web installer to flash the firmware on this D1 mini board.
  7. Once the firmware is installed you can solder two wires to this D1 mini board as shown in the diagram below and then connect those two wires to any mechanical ringer switch.
  8. Connect power and test the switch. You can see the output in the bell switch logs.

Step 3: Add MP3 files

You can connect a microSD card to your PC and copy ringtones to the card. You can also add any song or dialogue from a movie that you want to play when someone presses your doorbell switch.

Make sure they are all MP3 files and renamed with numbers like 1, 2, 3, etc. Example: 1.mp3 or 2.mp3. You can also use any free text to speech mp3 converter sites to create your custom sounds for this smart bell. Once the MP3 sounds have been copied, connect the microSD card to the DFPlayer.

At this stage, you can turn on the smart speaker and smart ringer switch. You can use any 5V adapter and micro USB cable to power both devices. You can test the module by touching any one ok or ADKey Pin the DFPlayer to the Dimensions. You will hear the MP3 files playing.

Step 4: Create Automation

Automation allows you to trigger or play the MP3 you want when someone presses the smart doorbell button. Follow these steps:

  1. In the Home Assistant, navigate to settings > Automations & Scenes.
  2. click create automation and click Start with a blank automation.
  3. click Add trigger > device and then search Bell jar.
  4. Choose Bell jar in Device and select it Turn on the ringer possibility from the Deduction drop-down list.
  5. Under Actionsclick Add action.
  6. Choose Call for service.
  7. Search for ESPHome: smart_speaker_dfplayer_play and select it.
  8. In which file In the field, enter the MP3 file number you want to play. You can change this number at any time to change the ringtone.
  9. Your automation should look like this:
  10. press the Save on computer button and then give this automation any name with a description (optional).
  11. click Save on computer.

Now when you press the smart ringer switch, the automation will be triggered and the sound will play on the smart ringer we created.

In addition, TTS to MP3 allows you to create notification tones, e.g. B. “Tank is full. Turn off engine” or “High power consumption detected” and create an automation to play these tones whenever such events occur or based on sensor readings. You can also follow our detailed tutorials to build a smart water level sensor and smart energy monitor for Home Assistant.

Smart bells for smart homes

The smart bell we developed can also be used as a smart speaker with your Home Assistant server to play notifications. You can also add DFPlayer controls on your Home Assistant dashboard to play, pause, volume up/down etc. Just add an entity card on the Home Assistant dashboard and search for the DFPlayer controls to add them .

Leave a Comment

Your email address will not be published. Required fields are marked *