LD2410 esphome tips

Hi guys, need some help. I’ve been looking into this for many days.

I updated my ESPHome to the latest version and discovered that my LD2410 sensor is not working.
I connected the LD2410 to a D1 Mini ESP32.

I also noticed that I keep getting the following warning:

No matter which option I choose, it still does not resolve the issue.

Things I have tried:

  • Deleted the device from the ESPHome integration.
  • Reinstalled ESP32 with a different name.
  • Reinstalled ESP32 with a suffix.
  • Installed a brand new D1 Mini ESP32 + LD2410.
  • Removed “mac_address” in yaml
    None of these worked.

Currently, I am encountering:

  1. Device conflict warning.
esphome:
  name: esp-kitchen-sensor
  friendly_name: esp-kitchen-sensor

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "VFQMy3XLCJ+FaqtUd62lyiGNv6S8ZuSSKmOWkvpxl80="

ota:
  - platform: esphome
    password: "80555ccf888ceeb91cf912eae43bf72a"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Kitchen-Sensor"
    password: "O1QxLemD4aTA"

i2c:
  sda: 21
  scl: 22
  scan: true
  id: bus_a
 
uart:
  id: ld2410_uart
  tx_pin: RX
  rx_pin: TX
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

ld2410:
  uart_id: ld2410_uart

number:
  - platform: ld2410
    timeout:
      name: Timeout
    light_threshold:
      name: Light Threshold
    max_move_distance_gate:
      name: Max Move Distance Gate
    max_still_distance_gate:
      name: Max Still Distance Gate
    g0:
      move_threshold:
        name: g0 move threshold
      still_threshold:
        name: g0 still threshold
    g1:
      move_threshold:
        name: g1 move threshold
      still_threshold:
        name: g1 still threshold
    g2:
      move_threshold:
        name: g2 move threshold
      still_threshold:
        name: g2 still threshold
    g3:
      move_threshold:
        name: g3 move threshold
      still_threshold:
        name: g3 still threshold
    g4:
      move_threshold:
        name: g4 move threshold
      still_threshold:
        name: g4 still threshold
    g5:
      move_threshold:
        name: g5 move threshold
      still_threshold:
        name: g5 still threshold
    g6:
      move_threshold:
        name: g6 move threshold
      still_threshold:
        name: g6 still threshold
    g7:
      move_threshold:
        name: g7 move threshold
      still_threshold:
        name: g7 still threshold
    g8:
      move_threshold:
        name: g8 move threshold
      still_threshold:
        name: g8 still threshold

select:
  - platform: ld2410
    distance_resolution:
      name: Distance Resolution
    baud_rate:
      name: Baud Rate
    light_function:
      name: Light Function
    out_pin_level:
      name: Out Pin Level

sensor:
  - platform: ld2410
    light:
      name: Light
    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
    g0:
      move_energy:
        name: g0 move energy
      still_energy:
        name: g0 still energy
    g1:
      move_energy:
        name: g1 move energy
      still_energy:
        name: g1 still energy
    g2:
      move_energy:
        name: g2 move energy
      still_energy:
        name: g2 still energy
    g3:
      move_energy:
        name: g3 move energy
      still_energy:
        name: g3 still energy
    g4:
      move_energy:
        name: g4 move energy
      still_energy:
        name: g4 still energy
    g5:
      move_energy:
        name: g5 move energy
      still_energy:
        name: g5 still energy
    g6:
      move_energy:
        name: g6 move energy
      still_energy:
        name: g6 still energy
    g7:
      move_energy:
        name: g7 move energy
      still_energy:
        name: g7 still energy
    g8:
      move_energy:
        name: g8 move energy
      still_energy:
        name: g8 still energy

binary_sensor:
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target
    out_pin_presence_status:
      name: Out Pin Presence Status

switch:
  - platform: ld2410
    engineering_mode:
      name: Engineering Mode
    bluetooth:
      name: Control Bluetooth

# button:
#   - platform: ld2410
#     factory_reset:
#       name: Factory Reset
#     restart:
#       name: Restart
#     query_params:
#       name: Query Params

text_sensor:
  - platform: ld2410
    version:
      name: Firmware Version
    mac_address:
      name: MAC

esphome:
  name: esphome-web-00c0fb
  friendly_name: kitchen-presence-sensor
  min_version: 2025.5.0
  name_add_mac_suffix: false

esp32:
  board: esp32dev
  framework:
    type: arduino


# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "f8EyhkX4wnkBdyow+UvISs4HsBfIQejiAPWtFJ6FKK4="

ota:
  - platform: esphome
    password: "a202973e7827b10cb56cdb6fb04e23fb"

wifi:
  networks:
  - ssid: !secret wifi_ssid1
    password: !secret wifi_password1
  - ssid: !secret wifi_ssid2
    password: !secret wifi_password2


  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Kitchen-Presence"
    password: "hmi6yVt2WYJR"

captive_portal:
    
light:
  - platform: binary
    name: "Blue Status Light"
    output: light_output
    id: led_light
    restore_mode: ALWAYS_OFF
 
output:
  - platform: gpio
    pin: GPIO2
    id: light_output
 
i2c:
  sda: 21
  scl: 22
  scan: true
  id: bus_a
 
uart:
  id: ld2410_uart
  tx_pin: RX
  rx_pin: TX
  baud_rate: 256000
  parity: NONE
  stop_bits: 1
 
ld2410:
  uart_id: ld2410_uart
  throttle: 1500ms
  id: ld2410_comp
 
select:
  - platform: ld2410
    distance_resolution:
      name: distance resolution
    baud_rate:
      name: baud rate
    light_function:
      name: light function
    out_pin_level:
      name: out pin level
 
# button:
#   - platform: ld2410
#     factory_reset:
#       name: "factory reset"
#     restart:
#       name: "restart"
#     query_params:
#       name: query params
 
number:
  - platform: ld2410
    timeout:
      name: timeout
    max_move_distance_gate:
      name: max move distance gate
    max_still_distance_gate:
      name: max still distance gate
    g0:
      move_threshold:
        name: g0 move threshold
      still_threshold:
        name: g0 still threshold
    g1:
      move_threshold:
        name: g1 move threshold
      still_threshold:
        name: g1 still threshold
    g2:
      move_threshold:
        name: g2 move threshold
      still_threshold:
        name: g2 still threshold
    g3:
      move_threshold:
        name: g3 move threshold
      still_threshold:
        name: g3 still threshold
    g4:
      move_threshold:
        name: g4 move threshold
      still_threshold:
        name: g4 still threshold
    g5:
      move_threshold:
        name: g5 move threshold
      still_threshold:
        name: g5 still threshold
    g6:
      move_threshold:
        name: g6 move threshold
      still_threshold:
        name: g6 still threshold
    g7:
      move_threshold:
        name: g7 move threshold
      still_threshold:
        name: g7 still threshold
    g8:
      move_threshold:
        name: g8 move threshold
      still_threshold:
        name: g8 still threshold
    light_threshold:
      name: light threshold
 
text_sensor:
  - platform: ld2410
    version:
      name: "presenece sensor version"
    mac_address:
      name: "presenece sensor mac address"
 
switch:
  - platform: ld2410
    engineering_mode:
      name: "engineering mode"
    bluetooth:
      name: control Bluetooth
 
sensor:
  - platform: ld2410
    moving_distance:
      name: "Moving distance (cm)"
    still_distance:
      name: "Still Distance (cm)"
    moving_energy:
      name: "Move Energy (%)"
    still_energy:
      name: "Still Energy (%)"
    detection_distance:
      name: "Distance Detection (cm)"
    g0:
      move_energy:
        name: g0 move energy
      still_energy:
        name: g0 still energy
    g1:
      move_energy:
        name: g1 move energy
      still_energy:
        name: g1 still energy
    g2:
      move_energy:
        name: g2 move energy
      still_energy:
        name: g2 still energy
    g3:
      move_energy:
        name: g3 move energy
      still_energy:
        name: g3 still energy
    g4:
      move_energy:
        name: g4 move energy
      still_energy:
        name: g4 still energy
    g5:
      move_energy:
        name: g5 move energy
      still_energy:
        name: g5 still energy
    g6:
      move_energy:
        name: g6 move energy
      still_energy:
        name: g6 still energy
    g7:
      move_energy:
        name: g7 move energy
      still_energy:
        name: g7 still energy
    g8:
      move_energy:
        name: g8 move energy
      still_energy:
        name: g8 still energy
    light:
      name: light
 
  - platform: bh1750
    name: "Illuminance"
    address: 0x23
    update_interval: 30s
 
binary_sensor:
 
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target
  1. ESPHome integration device does not have any entities published from ESP32 to HA.
    image

  2. LD2410 appears to be working fine, as I can access the logs wirelessly and see data updating in the logs.

Any clues, tips, or help?

At a guess you’ll have to switch from arduino to IDF ala. I would imagine it’s ran out of memory. If you do a log view over usb you may find it’s in a constant boot loop.

  board: esp32dev
  framework:
    type: esp-idf

I just setup move and still thresholds and want to save it some how,
what options do I have? Ideally I want to save thresholds to yaml.
But this way doesn’t work.

There is a example to work from on Esphome’s LD2410 info page: LD2410 Sensor — ESPHome

  - platform: ld2410
    light:
      name: light
    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
    g0:
      move_energy:
        name: g0 move energy
      still_energy:
        name: g0 still energy
    g1:
      move_energy:
        name: g1 move energy
      still_energy:
        name: g1 still energy
    g2:
      move_energy:
        name: g2 move energy
      still_energy:
        name: g2 still energy
    g3:
      move_energy:
        name: g3 move energy
      still_energy:
        name: g3 still energy
    g4:
      move_energy:
        name: g4 move energy
      still_energy:
        name: g4 still energy
    g5:
      move_energy:
        name: g5 move energy
      still_energy:
        name: g5 still energy
    g6:
      move_energy:
        name: g6 move energy
      still_energy:
        name: g6 still energy
    g7:
      move_energy:
        name: g7 move energy
      still_energy:
        name: g7 still energy
    g8:
      move_energy:
        name: g8 move energy
      still_energy:
        name: g8 still energy ```

I mean to save thresholds values to avoid it setting up again in case of factory reset or new setup new board

They are meant as inputs, I think the values are stored in the sensor itself. When I moved one to a new esp, the settings remained intact. If you really need to have the values in yaml, you can create a script to set the values.

1 Like

I’ve got a recent LD2410C connected to a Qt Py and an 8266 and both have the same issue: none of the settings take effect when set through HA / ESPHome. I have to use the Android app via Bluetooth. Once I make that connection from the app, the settings show up properly in HA. Before that, changing max gates, toggling eng mode, etc are not persistent. So it’s not a communication issue. I can read the motion / presence output of the sensor just fine over the serial port and over bluetooth. The LD2410C has the latest firmware.

Maybe the TX pin not connected properly? To read you only need RX pin.

I think one of my LD2410C is defective. They all have the same firmware but this one responds differently.

Can anyone tell me whether the individual gate movement values can be read in a lambda ?

e.g. set and id for the g0 move energy

 g0:
      move_energy:
        internal: true
        name: g0 move energy
        id: g0MoveEnergy

and read

ESP_LOGD("CUSTOM"," G0 move %d", id(g0MoveEnergy).state);

However the value that is logged is not the sensor value

It always seems to be -2147483648

same for

ESP_LOGD("CUSTOM"," G0 move %d", id(g0MoveEnergy));

both times it looks like the value is simply a pointer to a data struct or pointer to function.

:frowning: