ESPHome: Connect and Query DS18B20 to ESP32

Boot the ESP32 first only with the one_wire config and note down the hardware address from the DS18B20. Then add the second part of the yaml (see below) to monitor the DS18B20.

YAML
esphome:
  name: esp-temp
  friendly_name: esp-temp

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxx"

ota:
  - platform: esphome
    password: "xxxxxxxxxx"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Temp Fallback Hotspot"
    password: "xxxxxxxxxx"

captive_portal:

# <<<<<<<<< add thsi part to get the hardware adress from the DS18B20 >>>>>>>>>

one_wire:
 - id: bus_one
   platform: gpio
   pin:
    number: 4
    mode:
      input: true
      pullup: true

# <<<<<<<<< add this part after the first boot >>>>>>>>>
sensor:
  - platform: dallas_temp
    address: 0xe200000039xxxxxx
    name: "temp1"
    unit_of_measurement: "°C"
    icon: "mdi:thermometer"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 2
  - platform: dallas_temp
    address: 0xf400000035xxxxxx
    name: "temp2"
    unit_of_measurement: "°C"
    icon: "mdi:thermometer"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 2
  - platform: dallas_temp
    address: 0x6600000034xxxxxx
    name: "temp3"
    unit_of_measurement: "°C"
    icon: "mdi:thermometer"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 2
  - platform: dallas_temp
    address: 0xf000000034xxxxxx
    name: "temp4"
    unit_of_measurement: "°C"
    icon: "mdi:thermometer"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 2
  - platform: dallas_temp
    address: 0x5100000035xxxxxx
    name: "temp5"
    unit_of_measurement: "°C"
    icon: "mdi:thermometer"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 2