Esp32 cam with esphome and intruder alarm

Hi All,

wonder if you can help please, i am trying to set up a generic esp32cam to run on esphome and display store snapshots if there is movement (either from detection from the camera or pirs running through HA,

At the moment i am totally failing to even have the esphome part working.

Would someone be able to walk me through this, please?

I have tried google etc but have got nowhere…

Well first step here is to get already ESP32-CAM works with HA ! Have you been able to falsh it successfully with ESPHome and get video of it in HA ? Then you’ll move to next step for detection !
You’ll find some threads about ESP32-CAM here that should help you and guide you to success and also ESPHome website :wink:

Thanks Vincèn

I have tried working through the instructions.

I have fist used esphome dashboard to create the cam entity and flashed that to the esp32. reset the esp 32 and the following is logged:

[11:08:09][I][application:097]: You're running esphomelib v1.10.1 compiled on Aug 17 2019, 09:48:30
[11:08:09][C][wifi:341]: WiFi:
[11:08:09][C][wifi:240]:   SSID: 'xxxxxxxx'
[11:08:09][C][wifi:241]:   IP Address: 192.168.x.x
[11:08:09][C][wifi:243]:   BSSID: xx:xx:xx:xx
[11:08:09][C][wifi:245]:   Hostname: 'camera'
[11:08:09][C][wifi:250]:   Signal strength: -54 dB ▂▄▆█
[11:08:09][C][wifi:251]:   Channel: 6
[11:08:09][C][wifi:252]:   Subnet: 255.255.255.0
[11:08:09][C][wifi:253]:   Gateway: 192.168.1.1
[11:08:09][C][wifi:254]:   DNS1: 192.168.1.1
[11:08:09][C][wifi:255]:   DNS2: 0.0.0.0
[11:08:09][C][logger:099]: Logger:
[11:08:09][C][logger:100]:   Level: DEBUG
[11:08:09][C][logger:101]:   Log Baud Rate: 115200
[11:08:09][C][api:072]: API Server:
[11:08:09][C][api:073]:   Address: 192.168.x.xx:6053
[11:08:10][C][ota:129]: Over-The-Air Updates:
[11:08:10][C][ota:130]:   Address: 192.168.x.xx:3232
[11:08:10][I][application:114]: Running through first loop()
[11:08:10][I][application:141]: First loop finished successfully!

but is is showing as offline on the dashboard.

the yaml is:

esphomeyaml:
  name: camera
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: 'xxxxxxxx'
  password: 'xxxxxxx'

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

@Jon_Miles Please read documentation on ESPHome website as I suggested you https://esphome.io/components/esp32_camera.html as it contains all explanations to write a correct configuration file for it :wink: The file you showed is just basic setup of ESP without any components in it so for sure you camera can’t work just like that ! Basically now you add to add at your existing config file the part that declares the camera and its configuration and you should get better result then !
Once done and ESP32 reflashed, you’ll just need to add it in HA via Integration menu -> ESPHome -> indicate IP of ESP32 module and then you should be able to access the video stream in HA !

1 Like

I have tried following that - and still failed, should the config replace all the information in the YAML, be added to the end? none of that is mentioned on the page…

Nope it should be added as part you have in your config file for now is just the basic to declare type of ESP, how it connects, ota capabilities but it tells nothing about what it should do or handle !! You should read the esphome website to get a better view of the whole thing :slight_smile:
For info here is my config file for my ESP32-CAM I use on my 3D printer :wink:

esphome:
  name: surveillance_photon_s
  platform: ESP32
  board: esp32dev

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_passwd
  fast_connect: True

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

web_server:

esp32_camera:
  name: 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
  resolution: SXGA
  jpeg_quality: 40
  max_framerate: 4fps
  saturation: 1

switch:
  - platform: gpio
    pin: GPIO4
    name: "Flash"
  - platform: gpio
    pin: GPIO33
    inverted: true
    name: "Status LED"

thanks,

i have read through the website as i was going to migrate all my esp board across for easier management, glad ui havent yet!

and the code is exactly what i did and receive the following error:

INFO Reading configuration...
ERROR Unable to find component esp32_camera
Failed config

esp32_camera: [source config/camera.yaml:27]
  
  Component not found: esp32_camera

which is why I was not sure if that was the correct place.

It’s not if you got such error so please share whole config file you created or it’s impossible to help you just with the error message :wink:

Both

esphomeyaml:
  name: camera
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: 'xxxxxxxx'
  password: 'xxxxxx'
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.64
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

web_server:

esp32_camera:
  name: 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
  resolution: SXGA
  jpeg_quality: 40
  max_framerate: 4fps
  saturation: 1

switch:
  - platform: gpio
    pin: GPIO4
    name: "Flash"
  - platform: gpio
    pin: GPIO33
    inverted: true
    name: "Status LED"

and

esphomeyaml:
  name: camera
  platform: ESP32
  board: esp32dev
wifi:
  ssid: 'xxxxx'
  password: 'xxxxxx'
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.64
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

web_server:

esp32_camera:
  name: 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
  resolution: SXGA
  jpeg_quality: 40
  max_framerate: 4fps
  saturation: 1

switch:
  - platform: gpio
    pin: GPIO4
    name: "Flash"
  - platform: gpio
    pin: GPIO33
    inverted: true
    name: "Status LED"

both fail with the error on validation

Your first line should esphome: not esphomeyaml:

are you sure?

INFO Reading configuration...
ERROR Error while reading config: No esphomeyaml section in config

What version of esphome are you using?

version 1.10.1

Update it.

ok, will do, just need to figure out how in portainer as i am running it as a docker, cant seem to change the image

It is fully explained in the esphome docs. Basically

docker pull esphome/esphome

yes, thats what i have run - but when i first set it up the the guidance was use ottowinter/esphomeyaml:latest not esphome/esphome

so even when running the command it sticks with v 10

Ahhh of course. esphomeyaml changed to esphome. Delete the esphomeyaml and install esphome.

i keep forgetting its not the quickest
======================== [SUCCESS] Took 710.76 seconds ========================

that workds perfectly now, thank you :slight_smile:

2 Likes

:man_facepalming: