ESPHome under Home Assistant and LD2410C

Good evening,

I use the ESPHome add-on in Home Assistant. I click +ADD DEVICE and use ESPHOME WEB to install the basic configuration to my ESP32 Dev Kit C V4. I add it to my Wi-Fi and everything appears to be fine. I ping the IP address and open its web interface.
When I attempt to add a LD2410C, I add the LD2410 content from the ESPHome website to the bottom of the basic configuration YAML file, SAVE it and INSTALL it. This fails after INFO Starting log output from 192.168.13.142 using esphome API because it cannot connect to that IP address. The only recovery is to start the installation again.
When I reinstall the basic configuration, I find that the basic configuration YAML file does not have anything configured for api: - especially no encryption or key details.
Also, despite being accessible through an IP Address, it does not having anything configured for wifi: despite having saved the Wi-Fi SSID and Password into a secrets.yaml file. Instead it appears to Allow provisioning Wi-Fi via serial through improv_serial. I am unclear how this works.
I suspect that the latest installation through ESPHOME WEB is providing a misconfigured YAML file. Can anyone assist with this, please?

Here is a copy of the basic YAML file (where xxxxxx are the last characters of the MAC Address):

substitutions:
  name: "esphome-web-xxxxxx"
  friendly_name: esphome-web-xxxxxx

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: dev

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

Why don’t you include the ld2410 and flash it via usb?

Thank you for your quick response but I regret that I’m not sure that I understand what you are suggesting. The LD2410C has just four wires Vcc, GND, TX, and RX. These are wired to pins on the ESP32, which itself is initially connected to the USB but ought to be updated OTA because it will be located elsewhere. Regardless of that, I cannot think how to include the configuration for the LD2410C and then flash the ESP32 via the USB. I’d appreciate your guidance if I am misunderstanding something.

Many thanks
Joe.

Just rewrite the yaml like this

substitutions:
  name: "esphome-web-xxxxxx"
  friendly_name: esphome-web-xxxxxx

esphome:
  name: ${name}
  friendly_name: ${friendly_name}

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:

api:

ota:
- platform: esphome

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

and complete the LD2410 configuration.
Upload via USB HA and then you can OTA

Hi pepe59,

Thanks for your response. I’ll give that a try this evening and get back to you with the result. I must say, at this point, that what you have written looks good but for the absence of any encryption: and key: entry for the api:

Thanks again,
Joe

Hi @pepe59. I’ve marked your suggestion as the Solution - well, because it is.

Many thanks for your assistance - it was prompt and correct.

Best regards
Joe.