USe "EN" or "BOOT" button as entity

I’m almost sure that can be possible to use the 2 physical button on my esp32 wroom board as entity used to activate automation, but i don’t know how…
Here is my problem, I’ve created a trigger sensor(ESP32 WROOM card) with a PIR that sees the movement and activates a light(shelly dimmer), but sometime i want to by pass the PIR sensor and keep the light OFF(or ON).
I’ve already made a virtual widget on the phone to toggle the automation, but i would like to have a physical switch too and i wondering to use one of the two button i found on the board.
Can somebody explain me how to use one of them as entity?

You need to find what gpio they are connected to.

And check and understand boot behaviour.

Then set up some gpio binary sensors and add some automations to them.

The only thing i see is the pin “EN”, but i think it has to be connected to an external button.

Acquisisci schermata Web_29-1-2024_84114_it.aliexpress.com

Some notes about the pins on the ESP32:

  • GPIO0 is used to determine the boot mode on startup. It should therefore not be pulled LOW on startup to avoid booting into flash mode. You can, however, still use this as an output pin.

Here is an example, where I used “BOOT” as push-to-talk:

binary_sensor:    
  - platform: gpio
    pin: 
      number: GPIO00
      inverted: true
      mode:
        input: true
        pullup: true
    name: Boot Switch
    internal: true
    on_press:
      - voice_assistant.start:
    on_release:
      - voice_assistant.stop:
2 Likes

I believe EN just cuts power when pulled down.

So you can’t use that for anything except for a hard restart.

Enable (EN) is the 3.3V regulator’s enable pin. It’s pulled up, so connect to ground to disable the 3.3V regulator. This means that you can use this pin connected to a pushbutton to restart your ESP32, for example.

As @koying explained, the “Boot” button, that is connected to GPIO0 can be used as button.
But you have to be careful, the button should not be pressed when switching on the device, otherwise the ESP32 will turn into upload mode.

But not so the EN button. It is connected to the EN pin of the ESP32 chip. (But not with the voltage converter, i.e. the 3.3V are not switched off) It serves as a reset and cannot be used for anything else

2 Likes