One of the first frustrations you will come across when using ESP32 devices is the initial set up, installation, and boot can vary from device to device.

I will add more detail as I get more time. However generally, the order to think about things when you are getting started is:

  1. Plug the device into your computer via USB
  2. If your device connects and disconnects repeatedly, hold both RST and BOOT buttons and let go of the RST button before the BOOT button
  3. Head to web.esphome.io and follow the instructions to connect to your device
  4. TIP: If you are unsure which device is your ESP device, disconnect, reconnect, and identify which COM port disappeared and reappeared
  5. Click 'prepare for first use' and follow instructions. Ignore any errors re WiFi.
  6. Move to ESPHome and add a new device. It's easiest to name your device and pick from the list to confirm your chipset
  7. Click Edit and prepare your YAML download it using Factory Format. OTA will not work until your device is connected to your network.
  8. Move back to web.esphome.io and reconnect your device if necessary
  9. Click 'install' and install your compiled YAML
  10. Reboot

Once connected to WiFi and showing in ESPHome, installations and updates can be done 'Over the Air'. See below for example YAML required for OTA to work on initial install.

Basic YAML

Ideally, you want a template YAML which you will use every time you set up an ESP32 device on HomeAssistant. An example is provided below, including example secrets to ensure your WiFi credentials are shared amongst all ESPHome devices.

IMPORTANT NOTE: Copy your template code into the existing YAML by editing the YAML in ESPHome, and pasting your template code above or below. This allows you to copy your OTA password over to the template, before deleting the original code. This is important to be able to do over the air updates after initial setup.

Example Basic YAML to connect to WiFi and allow OTA updates after initial setup


esphome:
  name: nameyourdevice              # Short Name - no spaces or capital letters
  friendly_name: Name Your Device   # Full Name

esp32:
  board: esp32-c3-devkitm-1         # Change to your board e.g. esp32-s3-devkitm-1
  framework:
    type: esp-idf                   # Typically esp-idf but can be arduino depending on project

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !sectrets api_key          # See example secrets code below

ota:
  - platform: esphome
    password: "Your OTA Password"   # ENTER YOUR OTA PASSWORD FROM ORIGINAL CODE, THEN DELETE THE ORIGINAL CODE.

wifi:
  ssid: !secret wifi_ssid           # See example secrets code below
  password: !secret wifi_password   # See example secrets code below    
  ap:                               # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "YourSSID"                # Set fallback ssid of device. If wifi fails to connect, use this to connect and update credentials
    password: "YourPassword"        # Set fallback pass of device. If wifi fails to connect, use this to connect and update credentials

captive_portal:
        

Example Secrets YAML to store common credentials across all ESPHome devices


wifi_ssid: "YOUR SSID"              # Your Wi-Fi SSID 
wifi_password: "YOUR PASSWORD"      # Your Wi-Fi password
api_key: "YOUR API KEY"             # Your API key
        

I hope this helps getting started. As previously mentioned there is more nuance on a per-device basis. I will add more detail as time progresses.