ESP32: Expected boot time

Hi everyone,

I am using ESP32 D1 Mini with ESPHome configuration. What is the expected boot time for the board to be fully initialized? I put a simple code to turn on a buzzer from the ‘on_boot’ handler, and it goes off 10-12 seconds after connecting the board to a power supply. Is there any way to speed up the booting?

esphome:
  name: package-alarm-v11
  friendly_name: package-alarm-v1.1
  on_boot:
    priority: -100
    then:
      - output.turn_on: buzzer
      - output.set_level:
          id: buzzer
          level: 0.5
      - output.ledc.set_frequency:
          id: buzzer
          frequency: "2000Hz"          
      - delay: 1s
      - output.turn_off: buzzer

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  level: none

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_key_v11

ota:
  password: !secret ota_password

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: !secret ap_ssid_v11
    password: !secret ap_password_v11

captive_portal:

output:
  - platform: ledc
    pin: 33
    id: buzzer

Attach it to your computer/server and have a look into the logs. So you know what is taking time.

Some of my devices have problems connecting to my WIFI and have to reauthorize multiple times. You can speed this up by setting fast_connect:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true

This will skip scanning for the network, but for me this also helps with the authorization issues.

You could also skip the DHCP process by setting the IP address: manual_ip, but only make this if you know what you are doing.

You can read more about the configuration here: WiFi Component — ESPHome

Please keep in mind that setting additional options can solve problems, but can also cause new issues.

2 Likes

Thanks for your help! By doing this and printing more verbose logs, I was able to identify the culprit of the “startup delay”. The problem was irrelevant to the WiFi connection. One of my scripts was triggered twice: by the sensor and the “on_boot” handler. The logs had a warning: “Script … is already running”. Since the default mode is “single”, it didn’t run correctly. I was able to hear only a beep instead of a siren. By changing it to “restart”, the script started working as expected.