LD2410 esphome tips

I had it working prior to updating this morning however since I have updated it no longer connects. I tried removing the Integration and it gets discovered but when I hit submit it fails from not connecting.

So the first ld 2410 failed don’t know why, now tried to compile an ESP32, then it gives me “You’re using the same serial port for logging and the UART component. Please disable logging over the serial port by setting logger->baud_rate to 0.”

What is this?
Took the sample code from the Esphome site and just named TX and RX. I do not understand what the problem can be

Look here and you will understand

Please tell me when you sit next to him for 5 minutes is it “detected” all the time or after a few seconds it says “clear” and at the first movement it says “detected” and then “clear”?
I mean, these 5 minutes you’re standing in front of it output is 3.3 volts the whole time?

In my tests it should still indicate “detected”. It depends a lot from the settings. Remember that you can set the levels above which your sensor will detect presence, and this can be set up for each “range” separately (also separately for movement and for still presence).
I did such play connecting sensor to app and sitting still or moving with different setting - on the app you can see the sensor behaviour quite well.
Also from my experience with the right setup the sensor can sense you breathing - thus if you sit still and breathe you will be detected :slight_smile: I manage few times to force myself to really sit still and tried to minimise/“stop” breathing - this makes sensor detecting less movement energy and may lead to “clear” status - but I believe it is also possible to eliminate by changing sensitivity.
I have installed it in my toilet 2 month ago and it works very well when “sitting” there longer :wink:
Looking forward for summer when some flies or small bugs will be in hose and potentially will trigger the sensor…

1 Like

If I understand the settings correctly, the lower the number (0-100), the smaller the detection. The value 0 means that it does not detect in the zone that is set this way?

Sensibility setting in the app is defining the level at which (or above which) the sensor detects presence (or stillness). So the lower the number the higher sensitivity. It defined the level of detected energy to trigger the presence. So 100 will make sensor not detecting anything.

Thanks for clarifying and correcting me that I understood it the other way around.

Logging also uses serial port, so you need to switch off local logging by

# Enable logging
logger:
  baud_rate: 0

I have 4 presence detection with Wemos D1 mini base on the custom_component and its working great.

I see that EspHome 2023.2.0 have now LD2410 native component, so i copy the new config example in a new device page but i get theses errors :

INFO Reading configuration /config/esphome/capteur-presence-sejournew.yaml...
Failed config

ld2410: [source /config/esphome/capteur-presence-sejournew.yaml:41]
  
  Component ld2410 cannot be loaded via YAML (no CONFIG_SCHEMA).
  timeout: 150s
  max_move_distance: 6m
  max_still_distance: 0.75m
  g0_move_threshold: 10
  g0_still_threshold: 20
  g1_move_threshold: 10
  g1_still_threshold: 20
  g2_move_threshold: 20
  g2_still_threshold: 21
  g3_move_threshold: 30
  g3_still_threshold: 31
  g4_move_threshold: 40
  g4_still_threshold: 41
  g5_move_threshold: 50
  g5_still_threshold: 51
  g6_move_threshold: 60
  g6_still_threshold: 61
  g7_move_threshold: 70
  g7_still_threshold: 71
  g8_move_threshold: 80
  g8_still_threshold: 81
binary_sensor.ld2410: [source /config/esphome/capteur-presence-sejournew.yaml:69]
  
  Platform not found: 'binary_sensor.ld2410'.
  platform: ld2410
  has_target: 
    name: Presence
  has_moving_target: 
    name: Moving Target
  has_still_target: 
    name: Still Target
sensor.ld2410: [source /config/esphome/capteur-presence-sejournew.yaml:78]
  
  Platform not found: 'sensor.ld2410'.
  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

should i remove the custom_component to make the native work? i dont think so…

Example YAML snippet

esphome:
  name: capteur-presence-sejournew
  friendly_name: capteur-presence-sejournew

esp8266:
  board: d1_mini

# Enable logging
logger:
  level: WARN
  baud_rate: 0
  
# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

ota:
  password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pwd
  manual_ip:
    static_ip: 192.168.1.88
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 192.168.1.1
  fast_connect: on
  power_save_mode: none

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

ld2410:
  timeout: 150s
  max_move_distance : 6m
  max_still_distance: 0.75m
  g0_move_threshold: 10
  g0_still_threshold: 20
  g1_move_threshold: 10
  g1_still_threshold: 20
  g2_move_threshold: 20
  g2_still_threshold: 21
  g3_move_threshold: 30
  g3_still_threshold: 31
  g4_move_threshold: 40
  g4_still_threshold: 41
  g5_move_threshold: 50
  g5_still_threshold: 51
  g6_move_threshold: 60
  g6_still_threshold: 61
  g7_move_threshold: 70
  g7_still_threshold: 71
  g8_move_threshold: 80
  g8_still_threshold: 81

status_led:
  pin:
    number: GPIO2 #ESP8266 OnBroad LED
    inverted: false
      
binary_sensor:
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target
  - platform: gpio
    pin: D1
    name: "Sejour occupancy"
    id: sejour_occupancy
    device_class: occupancy
    on_press:
      then:
        - light.turn_on:
            id: led_presence_sejour
            brightness: 25%
            red: 100%
            green: 0%
            blue: 0%
    on_release:
      then:
        - light.turn_on:
            id: led_presence_sejour
            brightness: 25%
            red: 0%
            green: 100%
            blue: 0%

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


light:
  - platform: neopixelbus
    type: GRB
    variant: WS2812x
    pin: D2
    num_leds: 1
    name: "Led Presence Sejour"
    id: led_presence_sejour
    effects:
      - strobe:
      - addressable_rainbow:
      - addressable_scan:
      - addressable_twinkle:
      - addressable_random_twinkle:
      - addressable_fireworks:
      - addressable_flicker:

seems the ld2410 is not recognize…update problem of esphome?

the app still in chinese even if i switch to “english” down of the website…

The reason Was to change TX and RX, now the sensor works, but the presence state goes not to Unoccupied, this sensor is complicated to setting up

Set the sensor to the default values according to the table and start tuning the zones from there. It’s easier to work with than using the code from the documentation.

1 Like

I find it easiest to work with application (either mobile or laptop) - after few minutes the idea of distance/energy sensor setting looks clear.

App for Windows and iOS is in English.

I think that if some values are set in the application and they are different in the yaml esp, then when compiling or updating the modules, these values will be overwritten according to the yaml code.

Yes that really helped, entered the things from the table and immediately the presence went to unoccupied where I left the room. Thanks for the tip, the other way around I can not imagine that this Beispielyaml works for anyone, the presence does not go at all on unoccupied.Hope that some read this before they paste the example yaml Copy

It might help to set the sensor in the app via BT according to your own environment and then transfer the settings table to the yaml code rather than constantly compiling with new values and testing.

ok…i am under Android

And for those having problems with ld2410 component in EspHome 2023.2.1, add this to your node did the trick :

external_components:
  - source: github://esphome/esphome@dev
    components: [ ld2410 ]

i dont understand why i am the only one who having trouble with LD2410 component in the last EspHome 2023.2.1 or 2023.2.2 of today, same problem…

I use the “standard” AddOn : EspHome, not “Beta” or “Dev” version, and it seems that LD2410 is, for the moment, only on the Dev version of the EspHome AddOn, that why the component LD2410 is not found on the basic version of EspHome :smile:

I’m not using any DEV or Beta only the stable version of ESPhome and the sensor works fine just adding the yaml configuration nothing more.
ESPhome 2023.2.2