ESPHome and HLK-LD2410C errors during flashing

Hi.

I’m trying to flash the nodemcu for using it with HLK-LD2410C, but I cannot prepare the proper YAML file.

esphome:
  name: esphome-web-f1b6f9
  friendly_name: ESPHome Web f1b6f9

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "4sBk/0PU+rrRt4juyEM1a79FXv3cjvOA0vh3gGyNRps="

ota:


wifi:
  ssid: xxxx
  password: xxxx

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-F1B6F9"
    password: "yxc33AZw0gho"

# ESPHome Example configuration entry
uart:
  id: uart_1
  tx_pin: TX
  rx_pin: RX
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

button:
  - platform: restart
    name: Restart_internal
    id: restart_internal
    entity_category: config
    internal: false

ld2410:
  - timeout: 1s
    max_move_distance: 6m
    max_still_distance: 0,75m
    g0_move_threshold: 50
    g0_still_threshold: 0
    g1_move_threshold: 50
    g1_still_threshold: 0
    g2_move_threshold: 40
    g2_still_threshold: 40
    g3_move_threshold: 30
    g3_still_threshold: 40
    g4_move_threshold: 20
    g4_still_threshold: 30
    g5_move_threshold: 15
    g5_still_threshold: 30
    g6_move_threshold: 15
    g6_still_threshold: 20
    g7_move_threshold: 15
    g7_still_threshold: 20
    g8_move_threshold: 15
    g8_still_threshold: 20

sensor:
  - platform: ld2410
    moving_distance:
      name : Moving Distance
    still_distance:
      name: Still Distance
    moving_energy:
      name: Move Energy
    still_energy:
      name: Still Energy
    detection_distance:
      name: Detection Distance

binary_sensor:
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target

platform: ld2410
    name: "esphome-web-f1b6f9"
    id: restart_ld2410
    on_press:
    uart.write: "0xA3 0x00 nullptr 0"
    delay: 3s

Everytime I have an information that the mapping is not allowed in the following part:

platform: ld2410
    name: "esphome-web-f1b6f9"
    id: restart_ld2410
    on_press:
    uart.write: "0xA3 0x00 nullptr 0"
    delay: 3s

I’ve used the online YAML validator and found that there is a bad indentation of a mapping entry, but I also cannot solve that problem…

Could you take a look into my code?

platform: ld2410
    name: "esphome-web-f1b6f9"
    id: restart_ld2410
    on_press:
        uart.write: "0xA3 0x00 nullptr 0"
        delay: 3s

thank you.

there is next result from the log:

INFO ESPHome 2023.8.2
INFO Reading configuration /config/esphome/esphome-web-f1b6f9.yaml...
ERROR Error while reading config: Invalid YAML syntax:

mapping values are not allowed here
  in "/config/esphome/esphome-web-f1b6f9.yaml", line 90, column 9:
        name: "esphome-web-f1b6f9"
            ^

The ESPHome component for the LD2410 has been recently updated and the format of some of the YAML has changed so it may be best for you to follow the config documented here:

Also with your formatting above, the values after platform has been indented 4 spaces. Is that right or should it be:

binary_sensor:
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target

  - platform: ld2410
    name: "esphome-web-f1b6f9"
    id: restart_ld2410
    on_press:
      uart.write: "0xA3 0x00 nullptr 0"
      delay: 3s