Table of Contents

Smart Doorbell

https://ctipub-my.sharepoint.com/:f:/g/personal/anca_stefania_joita_stud_etti_upb_ro/Eil_rcCbGEJNv6RcUUN76CQB0I_8cZqo5OiXMO-z2rRlTw?e=bwdUxs

Overview

The motivation of this project is to implement a device that improves an usual doorbell.

When a visitor at the door presses the doorbell button, the device will send a notification the owner's phone with a link to the video streaming page where the owner can see the person at the door from anywhere in the world.

The owner can choose to answer the visitor with a few pre-recorded voice responses which are played through the doorbell, such as “Someone is coming at the door”, “No one can come at the door”, “Someone is coming to the door in 5 minutes”.

For the hardware part, an ESP32-CAM module is used for sending the live video stream. For transmitting the pre-recorded responses, I will use a DF-Player mini with a microSD card and a speaker.

The doorbell is controlled through Home Assistant, along with ESPHome.

Hardware description and implementation

For creating the doorbell, I used the following components:

Hardware configuration

Software description and implementation

In order for the Doorbell to work as expected, the software configuration created is shown in the figure below:

Software configuration

Home Assistant

I successfully configured Home Assistant with Nabu Casa Cloud, ensuring accessibility and control of the Smart Doorbell from the web browser and mobile phone as well. In this project, Home Assistant is used for receiving the notification with the live camera stream whenever someone presses the doorbell and to answer the doorbell with the desired response.

 Home Assistant Dashboard Web Browser

 Home Assistant Dashboard Mobile Phone

Automations

 Home Assistant Automations

The automations shown in the image contribute to the proper functionality of the device:

  
handle_doorbell_press:
    sequence:
      - service: esphome.doorbell_dfplayer_play
        data:
          file: 4
      - service: esphome.doorbell_switch_turn_on
      - service: notify.notify
        data:
          message: "Check the livestream"
          title: "Someone is at the door!"
          data:
            entity_id: camera.doorbell_camera
            clickAction: "lovelace/camera-view"
      - delay: '00:00:05'
      - service: notify.mobile_app_Stefania
        data:
          message: "Choose a response:"
          data:
            actions:
              - action: 'someone_is_coming'
                title: 'Someone is coming'
              - action: 'no_one_can_come'
                title: 'No one is coming'
              - action: 'will_come_in_5_minutes'
                title: 'Will come in 5 minutes

 Doorbell Button Pressed Notification

 Doorbell Choose Answer Notification

 play_someone_is_coming:
    sequence:
      - service: esphome.doorbell_dfplayer_play
        data:
          file: 3
      - delay: '00:00:05'
      - service: esphome.doorbell_switch_turn_off
  play_no_one_can_come:
    sequence:
      - service: esphome.doorbell_dfplayer_play
        data:
          file: 1
      - delay: '00:00:05'
      - service: esphome.doorbell_switch_turn_off
  play_will_come_in_5_minutes:
    sequence:
      - service: esphome.doorbell_dfplayer_play
        data:
          file: 2
      - delay: '00:00:05'
      - service: esphome.doorbell_switch_turn_off

ESPHome

In the ESPHome platform I configured the firmware that connects Home Assistant to the ESP32-CAM board. I defined the components connected to the ESP32-CAM board: LED, push button, DFPlayer and OV2640 camera. Also, the communication with Home Assistant is implemented through the api services component of ESPHome. Here I defined the service of playing the audio responses through DFPlayer and the LED light control.

api:
  services:
    - 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_set_volume
      variables:
        volume: int
      then:
        - dfplayer.set_volume: !lambda 'return volume;'
    - service: dfplayer_stop
      then:
        - dfplayer.stop
    - service: switch_turn_off
      then:
        - switch.turn_off: ledlight
    - service: switch_turn_on
      then:
        - switch.turn_on: ledlight

Challenges

For me, the whole project creation was a journey. I had planned other way of implementation, using MQTT, but that didn't go as expected, so I used in the end ESPHome platform.

One major challenge was connecting the Home Assistant to the device. i spent a lot of time on this, trying to connect through MQTT and then through ESPHome, but in the end everything is set.

Another significant challenge was to define the hardware part. I ordered most of the components all at once but then every few days I was realising I needed other component. I successfully completed the hardware part in time.

Conclusion

The project aims to enhance a traditional doorbell by integrating smart features using ESP32-CAM and DF-Player Mini modules.

The Smart doorbell is a very useful device and easy to use both for the visitor and for the owner of it, providing an innovative way of communication in the event that no one is home or the owner is busy.

The entire system is orchestrated through Home Assistant and ESPHome, offering a convenient and secure solution for doorbell interaction from anywhere in the world.

Bibliography