Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iothings:proiecte:2023:smart_doorbell [2024/01/15 17:03]
anca_stefania.joita
iothings:proiecte:2023:smart_doorbell [2024/01/15 22:33] (current)
anca_stefania.joita [Smart Doorbell]
Line 4: Line 4:
   * Master: ACES   * Master: ACES
   * Source code, demo and PPT:    * Source code, demo and PPT: 
 +[[https://​ctipub-my.sharepoint.com/:​f:/​g/​personal/​anca_stefania_joita_stud_etti_upb_ro/​Eil_rcCbGEJNv6RcUUN76CQB0I_8cZqo5OiXMO-z2rRlTw?​e=bwdUxs]]
 ===== Overview ===== ===== Overview =====
 The motivation of this project is to implement a device that improves an usual doorbell. ​ The motivation of this project is to implement a device that improves an usual doorbell. ​
Line 30: Line 31:
 ===== Software description and implementation ===== ===== Software description and implementation =====
  
-In order for the Doorbell to work as expected, the software configuration ​consists ​in:+In order for the Doorbell to work as expected, the software configuration ​created is shown in the figure below:
   * [[https://​www.home-assistant.io/​|Home Assistant]] - Open-source platform used for automating the application by controlling it remotely through the phone application   * [[https://​www.home-assistant.io/​|Home Assistant]] - Open-source platform used for automating the application by controlling it remotely through the phone application
   * [[https://​esphome.io/​|ESPHome]] - Open-source platform used for creating the firmware of the application and automating the entire behaviour of the Smart Doorbell   * [[https://​esphome.io/​|ESPHome]] - Open-source platform used for creating the firmware of the application and automating the entire behaviour of the Smart Doorbell
   * WSL2 - Hyper-V virtual machine for configuring the Home Assistant Core   * WSL2 - Hyper-V virtual machine for configuring the Home Assistant Core
 {{ :​iothings:​proiecte:​2023:​smart_doorbell_software_configuration.png?​600 |Software configuration}} {{ :​iothings:​proiecte:​2023:​smart_doorbell_software_configuration.png?​600 |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.
 +
 +{{ :​iothings:​proiecte:​2023:​smart_doorbell_hass_web_browser.png?​300 | Home Assistant Dashboard Web Browser}}
 +
 +{{ :​iothings:​proiecte:​2023:​smart_doorbell_mobile_app_dashboard_2.jpg?​300 | Home Assistant Dashboard Mobile Phone}}
 +=== Automations ===
 +
 +{{ :​iothings:​proiecte:​2023:​smart_doorbell_hass_scene.png?​600 | Home Assistant Automations}}
 +
 +The automations shown in the image contribute to the proper functionality of the device:
 +  * **Doorbell Notification** - When a visitor presses the doorbell button, the LED turns on, a ding-dong sound will be played on the DFPlayer and the owner will receive two notifications:​
 +     * Firstly, a notification that someone is at the door, with a camera live stream.
 +     * After 5 seconds, another notification is sent, where the owner can choose to answer the door in three different ways, by just pressing the button:
 +         * No one is coming to the door
 +         * Someone is coming to the door
 +         * Will come to the door in 5 minutes
 +<​code>  ​
 +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
 +</​code>​
 +
 +{{ :​iothings:​proiecte:​2023:​smart_doorbell_notification_1.jpg?​400 | Doorbell Button Pressed Notification}}
 +
 +{{ :​iothings:​proiecte:​2023:​smart_doorbell_notification_2.jpg?​400 | Doorbell Choose Answer Notification}}
 +  * **Doorbell Response** - No one can come, Someone is coming, Will come in 5 minutes
 +      * When the owner chooses a response, the action is sent to the doorbell and the corresponding pre-recorded voice respone is played, letting the visitor know the answer easily.
 +<​code>​
 + ​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
 +</​code>​
 +
 +
 +==== 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.
 +<​code>​
 +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
 +</​code>​
 +===== 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=====
 +  * ESPHome Wiki
 +  * https://​esphome.io/​components/​
 +
 +  * Home Assistant Documentation
 +  * https://​www.home-assistant.io/​docs/​
 +
 +  * Video Doorbell
 +  * https://​github.com/​ronschaeffer/​video_doorbell_voice_response
 +
 +
 +
 +
 +
  
  
    
  
iothings/proiecte/2023/smart_doorbell.1705331022.txt.gz · Last modified: 2024/01/15 17:03 by anca_stefania.joita
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0