My first somewhat crude but working doorbell, based on the new ESPHome camera

I was tinkering with my ESP32-Cam board /w ESPhome 1.12.2 and 0.91 Home Assistant. I made a working doorbell with telegram notification via an automation. Its not perfect but I thought I’d share what I got so far.
You need:
An ESPhome Node with a camera (duh), also I made the trigger/button on the same node.
(I used a board like this )
A whitelisted folder to store the image the camera takes.
Telegrambot set up in home assistant.

I will try to flesh out this post further as needed.

image
(flashing connections for the board I have, the green wire is connected when flashing only)

ESPHome node:

esphome:
  name: doorbellcam
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: 'yourssid'
  password: 'yourpass'
  manual_ip:
    static_ip: x.x.x.x
    gateway: x.x.x.x
    subnet: 255.255.255.0
logger:
api:
ota:
esp32_camera:
  name: doorbellcam
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32
  resolution: 1024x768
  jpeg_quality: 10

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO12
      mode: INPUT_PULLUP
      inverted: True
    name: snap

text_sensor:
  - platform: wifi_info
    ip_address:
      icon: "mdi:ip"
      name: doorbellcam IP
    ssid:
      name: doorbellcam SSID
      icon: "mdi:access-point-network"
    bssid:
      name: doorbellcam BSSID
      icon: "mdi:access-point-network"

sensor:
  - platform: wifi_signal
    name: "WiFi doorbellcam"
    update_interval: 60s

Automation:

- alias: Doorbell
  trigger:
  - platform: state
    entity_id:  binary_sensor.snap
    to: 'on'
  action:
  - service: camera.snapshot
    data:
      entity_id: camera.doorbellcam
      filename: '/myfolder/doorbell.jpg'
  - delay: '00:00:02'
  - service: notify.doorbellbot
    data:
      title: TEST
      message: "Doorbell rung!"
      data:
        photo:
          - file: /myfolder/doorbell.jpg
            caption: Doorbell View

In configuration.yaml:
(in my docker I made the /myfolder relfect the /www folder inside Home Assistant)

homeassistant:
  whitelist_external_dirs:
    - /myfolder
telegram_bot:
  - platform: polling
    api_key: !!! INSERT API KEY HERE !!! 
    allowed_chat_ids:
      - XXXXXXXXXXXX
  
notify:
  - name: doorbellbot
    platform: telegram
    chat_id: xxxxxxx

End result:
image

It is working, however if anyone has improvements I’m all ears :smile:
Its a $10 doorbell!
It could probably use an “anti spam” mechanism, and some of the data I’m supposed to send to telegram doesn’t arrive; the title and message.

The ‘snap’ binary sensor is connected to GPIO12 and when you connect it to ground via a button or the redneck way by touching two wires like i did, it will snap a image. Also the board has a built in flash that is connected to GPIO4, it lights up when you give it power. Not really figured out how to use it in a good way yet, kinda have to use a relay or pwm on it coupled with a lux sensor and have it activate when needed. Personally I’m thinking of just adding some IR leds that light up for the camera when needed.

11 Likes

Just need power supply and a 3d printed case!

Got my esp32 cam going last night. Fun aren’t they!

I’m loving them so far, and so cheap you can make a houseplant monitor for all your plants if you wanted :grin:

wow that’s cool and you are fast… just one question, the text_sensors are relevant here?

No the text sensors, the wifi sensor etc are optional. Only binary sensor kinda is, allthough it could also be on another device or RF button for instance. The notification platform could also be changed. Its maybe more of a proof of concept at this stage :blush:

I use the text sensors to monitor wifi conditions and such for all my nodes.

ok cool. actually inspired by your post, I looked around and found this ESP32 WROVER. it is basically esp32 with camera, pir sensor, oled screen and BME280 sensor, everything put together on the board. I couldn’t find a real ESPhome example for that but each component works with ESP home individually (I am not sure about the OLED screen tho). so in theory should be working. I am ordering from amazon and see if I can make it work.

They are all connected to the i2c bus I guess, so just set i2c to scan: true and find all the needed adresses, add the components individually. ESPHome is quite a breeze to configure and work with compared to many other comparable frameworks.

Wrover boards are quite affordable, bang for bucks with everything on one board. And they are available with a fisheye lens perfect for doorbells

That’s great, one question, I need a button for someone to press it and send the notification?

Well, you could use a motion sensor or something, or a tripwire for that matter :slightly_smiling_face:

I got a illuminated button with a bell symbol from aliexpress for the purpose.

When the button is pressed the camera snaps the image and hands it to the telegram bot that sends it to a user or group of your choice.