Nothing happens when physical button is pressed

Hello,

I’m using an ESP32 to create a doorbell. Everything is working, camera, restart, LED light, however when pressing the physical button nothing happens on the HA. The sensor on the HA is constantly “on”.

Any suggestion?

esphome:
  name: "esp32-cam-esphome"

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:

api:

ota:

wifi:
  ssid: !secret "wifi_ssid"
  password: !secret "wifi_password"

esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 10MHz
  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: 800x600
  name: "Camera da Entrada"
  jpeg_quality: 10
  max_framerate: 10 fps
  idle_framerate: 0.1 fps
  vertical_flip: false

switch:
  - platform: gpio
    name: "Doorbell LED"
    pin: 4
  - platform: restart
    name: "Doorbell restart"
    id: restart_switch

binary_sensor:
  - platform: gpio
    pin: GPIO12
    name: "Doorbell"

How is this wired?

Do you have physical pull up or down resistors?

If not you will need to enable this in the pin software configuration instead. See this example (ignore the GPIO number and that it is a reed switch instead of a push-button) for which option to use:

Untitled

Use pull down if your button connects the GPIO to 3.3V.

Use pull up if your button connects the GPIO to ground.

1 Like

Note that GPIO12 is not a good option. See the table lower down on this page: ESP32 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials

You have some other bad GPIO choices for your camera too.

Usually the camera interface is baked into the board and you don’t have a lot of choice.

These cameras are more of a novelty and I wouldn’t suggest building anything you need to be reliable with an esp32 cam. I’ve had over a dozen of these things and they all crap out and fail after a short period. It’s a 2$ camera, what do you expect? You can buy an outdoor camera that’s good for 35$.

It worked, I applied the model of pull-down and the HA is receiving the sensor status.

Thank you tom_I

1 Like

In fact, I set the GPIO12 to GPIO13, but I’m not sure which one to use for the camera.

WARNING GPIO0 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
WARNING GPIO5 is a Strapping PIN and should be avoided.

Do you have any suggestion?

Hardware wise?

I have 8 esp32 cams all running esphome and feeding frigate. No failures (hardware or software wise) and they are installed already for around two years.

Most important for a stable operation is a solid power source - many users fail to provide that and blame the hardware.

But can you control the software stack on these (10 times more expensive) cams?

Yes. See the table in the link I posted above. It tells you which are the best GPIOs to use.

So after 2 years and using 8 of them, you still don’t know what your doing or how to look up a pinout for your board? The esp32 cams are notorious for overhearing and failing and it’s well documented so, I’m having a hard time believing none have failed after 2 years.

You might have to pay more then but, are you building a smart home or a cheap home? You run 8 esp32 cam so that was a rhetorical question obviously.

1 Like

Looks like you still don’t know how to reply to the correct person in 2023…

2 Likes

And yet, you still read it and I’d find a way to deflect that question too. This is the problem with just copying and pasting code or following YouTube videos, you never actually learn or understand anything you’redoing. Using a button, diagnosing why a button isn’t working, whether to pull it high or low based on the gpio you choose or even which gpio you should or should not use, this is all stuff you should know with 2+ years of experience.

And even after you’ve been told that you replied to the wrong person justin continues… Others would be embarrassed…

And you still get them though, don’t you? Didn’t I just point that out to you kid? No comment on your 2 years of experience with nothing to show for it? I’d avoid that too, it’s embarrassing

Play nice please. (That means stop)