/ February 27, 2022/ Articles, ESPHome, Home Assistant/ 0 comments

I time ago i have made a nice solarweather station in a birdhouse Solar Weather Station in Birdhouse | TechJunky | Domotica & Technology

In the mean time, it is evolved into a continuously powered birdhouse. So if the battery is not an issue any more, why not adding another ESP board to watch the bird? That’s what i have done. Build an ESP32 Cam with ESPHome and integrate it into Home Assistant.

First of all i ordered an ESP32 cam. There is an -MB version witch includes an easy to use flashing board. Link on: AliExpress

 

To make it easier to mount the camera and for a larger wide angle lens, i ordered a 75mm 160 degrees lens: AliExpress and just drilled a hole in the wooden bird house and inserted the lens into the hole.

Then create a new ESPHome project and add the following code:

substitutions:
  display_name: BirdhouseCam
  
esphome:
  name: birdhousecam
  platform: ESP32
  board: esp-wrover-kit # esp32dev

logger:
api:
ota:
captive_portal:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pass
  fast_connect : true
  power_save_mode: none

 # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Birdhousecam Fallback Hotspot"
    password: ***********

# Sensors
sensor:
   - platform: wifi_signal
     name: ${display_name} WiFi Signal
     
esp32_camera:
  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
  name: ${display_name} security
# Image settings
  max_framerate: 5 fps
  resolution: SXGA
  jpeg_quality: 20
  contrast: 2
  brightness: 2
  saturation: 2

# Flashlight
output:
  - platform: gpio
    pin: GPIO4
    id: gpio_4

light:
  - platform: binary
    output: gpio_4
    name: ${display_name} light

Then integrate it in Home assisatant adding the ESPHome integration and whatch the bird (if it comming hopefully 😛 )

And even in Home assistant you can add the following lovelace:

- type: picture-entity
    name: Vogelhuisje
    entity: camera.birdhousecam_security
    show_state: false
    hold_action:
      action: call-service
      service: camera.snapshot
      service_data:
        entity_id: camera.birdhousecam_security
        filename: '/config/downloads/camera_snapshots/birdhousecam-{{ now().strftime("%Y-%m-%d-%H%M%S") }}.jpg'
    camera_view: live

When you hold your button it is making a snapshot. You can even use the light switch if your like with the light.birdhousecam_light toggle, but i won’t use it.

Share this Post

Leave a Comment

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
*
*

two × 5 =