LD2410 esphome tips

Looks like you are using a LD2410C which has a different form factor to the LD2410A/B so its range coverage would be different from the chart I posted above. Good to know the LD2410C has different sensitivity based on its orientation so adds more options for case design and mounting depending on the required coverage.

1 Like

is it me or did the LD2410 config of esp home changed so drastically that it broke the old component and configs?

I can’t even open the logs anymore due to the errors in the config:

I have found some new config examples for the number thing and the sensors, but eventhough the config itself is accepted, the compile it not accepting it, so if somebody has a working example with the new number components, that would be great… (or a fix for this old config if that is possible under the old LD2410 component…

Is it me or do people have a problem reading changelogs in this community :smiley:

image

I know, but reading through the docs and looking for examples with the number component still doesn’t work as mentioned in my post…

Do you have a example of your yaml file? I´m in the same boat

My working config on esphome 2023.8.0 (All copied from the docs)


uart:
  id: uart_ld2410
  tx_pin: TX
  rx_pin: RX
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

ld2410:
  uart_id: uart_ld2410

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
1 Like

Docs? Don’t spout that docs crap… :slight_smile:

1 Like

ah that seems to have been my mistake, the docs referring to the number component for the timeout and G values and such, and looking into that it mainly stated things I didn’t need and because of the writing I assumed that it needed to be configured in the yaml as previous, but the new config leaves everything blank and let you set the values in HA in the entity itself. Way easier to config this way then recompile every time, but the docs could have been more clear about this and state a full example…

I copied yours and it now works like a charm again :slight_smile:

I mean, this could have been way more descriptive…

Number
The ld2410 number allows you to control the configuration of your LD2410 Sensor.

Configuration variables:
timeout (Optional, int): Time in seconds during which presence state will stay present after leaving. Defaults to 5s All options from Number.

light_threshold (Optional, int): Sets the light threshold for the light function. Value between 0 and 255 inclusive. Defaults to 128. All options from Number.

max_move_distance_gate (Optional, int): Maximum distance gate for movement detection. Value between 2 and 8 inclusive. Defaults to 8. All options from Number.

max_still_distance_gate (Optional, int): Maximum distance gate for still detection. Value between 2 and 8 inclusive. Defaults to 8. All options from Number.

gX (Optional): Thresholds for the Xth gate (X => 0 to 8).
move_threshold (Required, int): Threshold for the gate for motion detection. Above this level for the considered gate (distance), movement detection will be triggered. Value between 0 and 100 inclusive. See default values below. All options from Number.

still_threshold (Required, int): Threshold for the gate for still detection. Above this level for the considered gate (distance), still detection will be triggered. Value between 0 and 100 inclusive. See default values below. All options from Number.

ld2410_id (Optional, ID): Manually specify the ID for the LD2410 Sensor component if you are using multiple components.

Will you please post you yaml file?

my yaml also includes a ledstrip, so you can ignore that part if you don’t need it (basically what @Holdestmade posted)

esphome:
  name: naambord-esp8266
  friendly_name: Naambord-ESP8266

esp8266:
  board: esp01_1m

external_components:
  source: github://regevbr/esphome@ld2410
  components: [ld2410]

# Enable logging
logger:
  baud_rate: 0

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

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

  manual_ip:
    static_ip: x.x.x.x
    gateway: x.x.x.x
    subnet: x.x.x.x
    dns1: x.x.x.x
    dns2: x.x.x.x

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Naambord-ESP8266"
    password: "ap-pass"

captive_portal:
    
ota:
  password: "ota-pass"

# LED strip
light:
  - platform: neopixelbus
    type: GRB
    variant: WS2812X
    pin: GPIO2
    num_leds: 34
    name: "NeoPixel Light"

# LD2410 sensor
uart:
  id: ld2410_uart
  tx_pin: GPIO1
  rx_pin: GPIO3
  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" 

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
  - platform: gpio
    pin: GPIO1
    name: gpio out pin presence
    device_class: presence

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
1 Like

Dont know why, but new config broke my sensor completely.

  1. It stops reporting any data
  2. When I try to access device through web interface it resets it.
  3. When I try to flash updated firmware it resets it and it stops connecting to wifi, just blinks status led
esphome:
  name: presence-sensor04
  friendly_name: Presence_Sensor04
  on_boot:
    priority: 300
    then:
      lambda: |-
        WiFi.setPhyMode(WIFI_PHY_MODE_11G);
        
esp8266:
  board: esp01_1m

# Enable logging
logger:

external_components:
  source: github://regevbr/esphome@ld2410
  components: [ld2410]

# Enable Home Assistant API
api:
  encryption:
    key: !secret prsensor04_enckey
  services:
    - service: set_ld2410_bluetooth_password
      variables:
        password: string
      then:
        - bluetooth_password.set:
            id: ld2410_comp
            password: !lambda 'return password;'

ota:
  password: !secret wifistereo04_otapass

wifi:
  ssid: !secret wifi_ssid2
  password: !secret wifi_password2

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Presence-Sensor04"
    password: !secret wifistereo01_fallbackpass

captive_portal:
  
web_server:
  port: 80
  version: 2
  include_internal: true
  auth:
    username: !secret mqtt_user
    password: !secret mqtt_password

# Enable HTTP/HTTPS requests
http_request:
  # default ESPHome
  useragent: esphome/$device_name
  # request time out / default 5s
  timeout: 2s
  
status_led:
  pin:
    number: GPIO02
    inverted: true

uart:
  id: ld2410_uart
  tx_pin: GPIO1
  rx_pin: GPIO3
  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

binary_sensor:
  - platform: ld2410
    has_target:
      name: "presence"
    has_moving_target:
      name: "movement"
    has_still_target:
      name: "still"
    out_pin_presence_status:
      name: out pin presence status
  - platform: gpio
    pin: GPIO13
    name: gpio out pin presence
    device_class: presence

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: wifi_signal # Reports the WiFi signal strength/RSSI in dB
    name: "WiFi Signal dB"
    id: wifi_signal_db
    update_interval: 60s
    entity_category: "diagnostic"

  - platform: copy # Reports the WiFi signal strength in %
    source_id: wifi_signal_db
    name: "WiFi Signal Percent"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "Signal %"
    entity_category: "diagnostic"

  - platform: adc
    pin: VCC
    name: "VCC Voltage"
    accuracy_decimals: 3
    filters:
      - multiply: 1.287

Damn

Can you try removing the following from your YAML:

external_components:
  source: github://regevbr/esphome@ld2410
  components: [ld2410]

Hello, is there any side effects to leave engineering mode on for extended periods in ESPHome?

I’m thinking of charting the energy of all gates and doing some funky processing on the data over a month.

Just a short how did you get this software in an english version, all I see and can find is the Chinese which is gibberish to me.

i have the same problem with the last update of LD2410 and Esphome, there is always 3-4% still energy and my sensor is always in “detect” mode…

I try your settings, its better but still the same problem, the “still energy” take a while to enventually go to 0%, what make the “detect” state false.

Is someone has experiment a similar behaviour please?

EDIT : noob am i…just set the timeout to 10s and work great lol

Tried, same, not working.

[13:12:21][W][ota:102]: Last Boot was an unhandled reset, will proceed to safe mode in 7 restarts

Hoping there comes a new video soon on youtube that explains what just happen and what these new setting do

Older versions defaulted to Chinese if the phone language was not English.
The very most recent one fixed that in the sense that the app defaults to English, now.

esp8266 d1mini. all parameters are not available!

Updated to esp 2023.8.0? Have you read the changelog?