esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
411 stars 26 forks source link

Support Hi-Link LD2420 (HLK-LD2420) 24GHz Radar Sensor #2219

Open zimmra opened 1 year ago

zimmra commented 1 year ago

Describe the problem you have/What new integration you would like

Please describe your use case for this integration and alternatives you've tried:

Additional context

max246 commented 1 year ago

I will look into this

descipher commented 1 year ago

Inprogress see: https://github.com/esphome/esphome/pull/4847

max246 commented 1 year ago

Inprogress see: esphome/esphome#4847

To ensure it overrides my PR link, you would need to add this link to your PR description.

AlexKey1971 commented 1 year ago

Hello! Sometimes LD2420 freezes after firmware update on ESP32. It looks like "Moving Distance" always shows 35cm. Just restarting the ESP32 does not help. Only restarting the ESP32 on power helps. The code is standard, from here: https://deploy-preview-2956--esphome.netlify.app/components/sensor/ld2420

descipher commented 1 year ago

It’s not something we can control, the ld2420 can be sent a reset command and this code does that but if it’s locked up then the only recourse is for the ld2420 is to use a watchdog function (unknown based on its docs) or a power cycle. This issue could be something else such as the baud gets changed or the unit is placed in a mode the does not transmit what we are expecting. The reset would be sent but not processed if the baud got changed. Its possible to write code that walks the possible bauds and sends a reset on each but we do not know if this is the issue. You should see a command timeout error when the ld2420 is in an non-responsive state but it requires serial logging to observe.

descipher commented 1 year ago

BTW that netlify link fails as 404.

AlexKey1971 commented 1 year ago

Corrected the link: https://deploy-preview-2956--esphome.netlify.app/components/sensor/ld2420

Mikescotland commented 1 year ago

Same here. Works flawlessly on Esp32, however becomes "frozen" if OTA applied or soft restart of Esp32. Only power cycle helps. Shame, as this sensor is somehow better behaving in my environment than the Ld2410.

descipher commented 1 year ago

I suspect there is an issue with the modules firmware. Please log the firmware version you have if you are observing hanging behaviour.

Mikescotland commented 1 year ago

I have no idea how to check it, tried verbose mode and doesn't return the firmware version. However, I found the workaround which tested since yesterday and seems to resolve the problem. I added the restart switch in the config (platform restart). Once after ota the module locks, restarting esp from restart platform solves the issue. I don't know if esp restart after ota is different than restart via platform, however, haven't had any problems with it since. BTW my module works only with external component github://pr#4847, the one stated in the esphome website with config yaml, I couldn't make it work at all.

descipher commented 1 year ago

The version is logged at setup. Should see it with HA wireless api logging. Otherwise it would need a serial connection on the logging port. I can add it to the web interface as well.

Mikescotland commented 1 year ago

No idea how to retrieve it, unfortunately from the HA

descipher commented 1 year ago

The only code available that works is the PR #4847 that I submitted, it has yet to be reviewed so it is not in any release form yet.

descipher commented 1 year ago

Using HA's ESPhome control panel integration ..

image

image

Logs -> Wireless

image

Mikescotland commented 1 year ago

How did I miss it? I mean not the way to retrieve it, I just simply missed this value when reviewing. Version 1.5.6

descipher commented 1 year ago

The OTA failure issue does not look like a modual lockup because it corrects after an ESP restart. When I observe the lockup it will never correct with any ESP restart. It persists until power is cycled. Thanks for the version info. I believe Hi-Link will be providing firmware update capability via serial and it may already be available in v1.5.6. We need to wait for them to publish the information.

hkrob commented 1 year ago

Same behaviour here..

[10:59:57][C][logger:301]: Logger:
[10:59:57][C][logger:302]:   Level: DEBUG
[10:59:57][C][logger:303]:   Log Baud Rate: 115200
[10:59:57][C][logger:305]:   Hardware UART: UART0
[10:59:57][C][uart.arduino_esp32:124]: UART Bus 1:
[10:59:57][C][uart.arduino_esp32:125]:   TX Pin: GPIO32
[10:59:57][C][uart.arduino_esp32:126]:   RX Pin: GPIO33
[10:59:57][C][uart.arduino_esp32:128]:   RX Buffer Size: 256
[10:59:57][C][uart.arduino_esp32:130]:   Baud Rate: 256000 baud
[10:59:57][C][uart.arduino_esp32:131]:   Data Bits: 8
[10:59:57][C][uart.arduino_esp32:132]:   Parity: NONE
[10:59:57][C][uart.arduino_esp32:133]:   Stop bits: 1
[10:59:57][C][ld2420:012]: LD2420:
[10:59:57][C][ld2420:013]:   Firmware Version :  v1.5.1
hkrob commented 1 year ago

Anyone know where to find the updated firmware?

lboue commented 11 months ago

Anyone know where to find the updated firmware?

descipher commented 10 months ago

Anyone know where to find the updated firmware?

You have to email them to get them. I have found that only v1.5.6 and up work. If you try to update v1.5.4 you will brick it! v1.5.3 and older cannot be updated. They would need to be done via JTAG SW .. event with that .. not for the inexperienced (its complex to say the least).

gkawanami commented 10 months ago

Hi to all!

Problem: Cannot install ESPHome on AtomLite (ESP32) board with LD2420

Set-UP: ESP-Home 2023.10.6 HA 2023.10.3 ESP32 = Atom Lite https://docs.m5stack.com/en/core/atom_lite#Description Sensor = LD2420 https://deploy-preview-2956--esphome.netlify.app/components/sensor/ld2420

Description: When installing this yaml file (code below), file preparation shows the error:

INFO ESPHome 2023.10.6 INFO Reading configuration /config/esphome/presence01.yaml... INFO Updating https://github.com/esphome/esphome.git@pull/4847/head Failed config

Question: Am I using the wrong external component link? What am I doing wrong?

YAML File: `external_components:

esphome: name: "mmwave01" friendly_name: "mmwave01"

esp32: board: esp32dev framework: type: arduino

Enable logging

logger:

Enable Home Assistant API

api: encryption: key: "cTy9RiVi61wyb1dnvAQqiPMNTyl5jviJO4lQ/aC7jXc="

ota: password: "20755a16743d40176874c4f8625013a0"

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

Enable fallback hotspot (captive portal) in case wifi connection fails

ap: ssid: "Teste Fallback Hotspot" password: "mtem1GYyg9YP"

captive_portal:

esp32_ble_tracker:

uart: id: ld2420_uart tx_pin: 22 rx_pin: 19 baud_rate: 115200 parity: NONE stop_bits: 1

ld2420: presence_time_window: 30s detection_gate_min: 1 detection_gate_max: 12 g0_move_threshold: 60000 g0_still_threshold: 40000 g1_move_threshold: 30000 g1_still_threshold: 20000 g2_move_threshold: 400 g2_still_threshold: 200 g3_move_threshold: 250 g3_still_threshold: 200 g4_move_threshold: 250 g4_still_threshold: 200 g5_move_threshold: 250 g5_still_threshold: 200 g6_move_threshold: 250 g6_still_threshold: 200 g7_move_threshold: 250 g7_still_threshold: 150 g8_move_threshold: 250 g8_still_threshold: 150 g9_move_threshold: 250 g9_still_threshold: 100 g10_move_threshold: 250 g10_still_threshold: 100 g11_move_threshold: 250 g11_still_threshold: 100 g12_move_threshold: 250 g12_still_threshold: 100 g13_move_threshold: 200 g13_still_threshold: 100 g14_move_threshold: 200 g14_still_threshold: 100 g15_move_threshold: 200 g15_still_threshold: 100

sensor:

binary_sensor:

light:

switch:

Log file is: `INFO ESPHome 2023.10.6 INFO Reading configuration /config/esphome/presence01.yaml... INFO Updating https://github.com/esphome/esphome.git@pull/4847/head Failed config

ld2420: [source /config/esphome/presence01.yaml:45]

descipher commented 10 months ago

@gkawanami There are new features. Check the YAML at the beginning of this PR and the doc link.

dhnsilva commented 10 months ago

@descipher using esp8266 Using de code until:

 text_sensor:
   - platform: ld2420
     fw_version:
       name: LD2420 Firmware

 sensor:
   - platform: ld2420
     moving_distance:
       name : Moving Distance

 binary_sensor:
   - platform: ld2420
     has_target:
       name: Presence

I got this problem:

INFO Reading configuration /config/radar-01.yaml...
INFO Updating https://github.com/esphome/esphome.git@pull/4847/head
INFO Generating C++ source...
INFO Compiling app...
Processing teste (board: esp01_1m; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- ESPAsyncTCP-esphome @ 1.2.3
|-- ESPAsyncWebServer-esphome @ 2.1.0
|   |-- ESPAsyncTCP-esphome @ 1.2.3
|   |-- Hash @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
|   |-- libsodium @ 1.10018.1
Compiling .pioenvs/teste/src/esphome/components/ld2420/ld2420.cpp.o
Compiling .pioenvs/teste/src/esphome/components/logger/logger.cpp.o
Compiling .pioenvs/teste/src/esphome/components/md5/md5.cpp.o
Compiling .pioenvs/teste/src/esphome/components/mdns/mdns_component.cpp.o
src/esphome/components/ld2420/ld2420.cpp: In member function 'virtual void esphome::ld2420::LD2420Component::dump_config()':
src/esphome/components/ld2420/ld2420.cpp:71:44: error: 'class esphome::ld2420::LD2420Component' has no member named 'gate_timeout_number_'
   71 |   LOG_NUMBER(TAG, "  Gate Timeout:", this->gate_timeout_number_);
      |                                            ^~~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:71:3: error: 'LOG_NUMBER' was not declared in this scope
   71 |   LOG_NUMBER(TAG, "  Gate Timeout:", this->gate_timeout_number_);
      |   ^~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:72:49: error: 'class esphome::ld2420::LD2420Component' has no member named 'max_gate_distance_number_'
   72 |   LOG_NUMBER(TAG, "  Gate Max Distance:", this->max_gate_distance_number_);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:73:49: error: 'class esphome::ld2420::LD2420Component' has no member named 'min_gate_distance_number_'
   73 |   LOG_NUMBER(TAG, "  Gate Min Distance:", this->min_gate_distance_number_);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:74:43: error: 'class esphome::ld2420::LD2420Component' has no member named 'gate_select_number_'
   74 |   LOG_NUMBER(TAG, "  Gate Select:", this->gate_select_number_);
      |                                           ^~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:76:53: error: 'class esphome::ld2420::LD2420Component' has no member named 'gate_move_threshold_numbers_'
   76 |     LOG_NUMBER(TAG, "  Gate Move Threshold:", this->gate_move_threshold_numbers_[gate]);
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:77:55: error: 'class esphome::ld2420::LD2420Component' has no member named 'gate_still_threshold_numbers_'
   77 |     LOG_NUMBER(TAG, "  Gate Still Threshold::", this->gate_still_threshold_numbers_[gate]);
      |                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:79:44: error: 'class esphome::ld2420::LD2420Component' has no member named 'apply_config_button_'; did you mean 'apply_config_action'?
   79 |   LOG_BUTTON(TAG, "  Apply Config:", this->apply_config_button_);
      |                                            ^~~~~~~~~~~~~~~~~~~~
      |                                            apply_config_action
src/esphome/components/ld2420/ld2420.cpp:79:3: error: 'LOG_BUTTON' was not declared in this scope
   79 |   LOG_BUTTON(TAG, "  Apply Config:", this->apply_config_button_);
      |   ^~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:80:44: error: 'class esphome::ld2420::LD2420Component' has no member named 'revert_config_button_'; did you mean 'revert_config_action'?
   80 |   LOG_BUTTON(TAG, "  Revert Edits:", this->revert_config_button_);
      |                                            ^~~~~~~~~~~~~~~~~~~~~
      |                                            revert_config_action
src/esphome/components/ld2420/ld2420.cpp:81:45: error: 'class esphome::ld2420::LD2420Component' has no member named 'factory_reset_button_'; did you mean 'factory_reset_action'?
   81 |   LOG_BUTTON(TAG, "  Factory Reset:", this->factory_reset_button_);
      |                                             ^~~~~~~~~~~~~~~~~~~~~
      |                                             factory_reset_action
src/esphome/components/ld2420/ld2420.cpp:82:46: error: 'class esphome::ld2420::LD2420Component' has no member named 'restart_module_button_'; did you mean 'restart_module_action'?
   82 |   LOG_BUTTON(TAG, "  Restart Module:", this->restart_module_button_);
      |                                              ^~~~~~~~~~~~~~~~~~~~~~
      |                                              restart_module_action
src/esphome/components/ld2420/ld2420.cpp:84:45: error: 'class esphome::ld2420::LD2420Component' has no member named 'operating_selector_'
   84 |   LOG_SELECT(TAG, "  Operating Mode", this->operating_selector_);
      |                                             ^~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:84:3: error: 'LOG_SELECT' was not declared in this scope; did you mean 'LOG_SECRET'?
   84 |   LOG_SELECT(TAG, "  Operating Mode", this->operating_selector_);
      |   ^~~~~~~~~~
      |   LOG_SECRET
src/esphome/components/ld2420/ld2420.cpp: In member function 'virtual void esphome::ld2420::LD2420Component::setup()':
src/esphome/components/ld2420/ld2420.cpp:136:11: error: 'class esphome::ld2420::LD2420Component' has no member named 'operating_selector_'
  136 |     this->operating_selector_->publish_state(OP_SIMPLE_MODE_STRING);
      |           ^~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:141:11: error: 'class esphome::ld2420::LD2420Component' has no member named 'operating_selector_'
  141 |     this->operating_selector_->publish_state(OP_NORMAL_MODE_STRING);
      |           ^~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp: In member function 'void esphome::ld2420::LD2420Component::factory_reset_action()':
src/esphome/components/ld2420/ld2420.cpp:186:9: error: 'class esphome::ld2420::LD2420Component' has no member named 'gate_timeout_number_'
  186 |   this->gate_timeout_number_->state = FACTORY_TIMEOUT;
      |         ^~~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:187:9: error: 'class esphome::ld2420::LD2420Component' has no member named 'min_gate_distance_number_'
  187 |   this->min_gate_distance_number_->state = FACTORY_MIN_GATE;
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:188:9: error: 'class esphome::ld2420::LD2420Component' has no member named 'max_gate_distance_number_'
  188 |   this->max_gate_distance_number_->state = FACTORY_MAX_GATE;
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp: In member function 'void esphome::ld2420::LD2420Component::set_operating_mode(const string&)':
src/esphome/components/ld2420/ld2420.cpp:289:11: error: 'class esphome::ld2420::LD2420Component' has no member named 'operating_selector_'
  289 |     this->operating_selector_->publish_state(state);
      |           ^~~~~~~~~~~~~~~~~~~
src/esphome/components/ld2420/ld2420.cpp:308:11: error: 'class esphome::ld2420::LD2420Component' has no member named 'operating_selector_'
  308 |     this->operating_selector_->publish_state(OP_SIMPLE_MODE_STRING);
      |           ^~~~~~~~~~~~~~~~~~~
Compiling .pioenvs/teste/src/esphome/components/mdns/mdns_esp32.cpp.o
Compiling .pioenvs/teste/src/esphome/components/mdns/mdns_esp8266.cpp.o
Compiling .pioenvs/teste/src/esphome/components/mdns/mdns_rp2040.cpp.o
Compiling .pioenvs/teste/src/esphome/components/network/util.cpp.o
*** [.pioenvs/teste/src/esphome/components/ld2420/ld2420.cpp.o] Error 1
========================= [FAILED] Took 22.16 seconds =========================

If I put complete:

text_sensor:
  - platform: ld2420
    fw_version:
      name: LD2420 Firmware

sensor:
  - platform: ld2420
    moving_distance:
      name : Moving Distance

binary_sensor:
  - platform: ld2420
    has_target:
      name: Presence

select:
  - platform: ld2420
    operating_mode:
      name: Operating Mode

number:
  - platform: ld2420
    timeout:
      name: Detection Presence Timeout
    min_gate_distance:
      name: Detection Gate Minimum
    max_gate_distance:
      name: Detection Gate Maximum
    gate_select:
      name: Select Gate to Set
    still_threshold:
      name: Set Still Threshold Value
    move_threshold:
      name: Set Move Threshold Value

button:
  - platform: ld2420
    apply_config:
      name: Apply Config
    factory_reset:
      name: Factory Reset
    restart_module:
      name: Restart Module
    revert_config:
      name: Undo Edits

I got this error:

INFO Reading configuration /config/radar-01.yaml...
INFO Updating https://github.com/esphome/esphome.git@pull/4847/head
ERROR Unable to load component ld2420.select:
Traceback (most recent call last):
  File "/esphome/esphome/loader.py", line 162, in _lookup_module
    module = importlib.import_module(f"esphome.components.{domain}")
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/.esphome/external_components/9cb05fac/esphome/components/ld2420/select/__init__.py", line 18, in <module>
    cv.Required(CONF_OPERATING_MODE): select.select_schema(
AttributeError: module 'esphome.components.select' has no attribute 'select_schema'
ERROR Unable to load component ld2420.number:
Traceback (most recent call last):
  File "/esphome/esphome/loader.py", line 162, in _lookup_module
    module = importlib.import_module(f"esphome.components.{domain}")
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/.esphome/external_components/9cb05fac/esphome/components/ld2420/number/__init__.py", line 46, in <module>
    cv.Inclusive(CONF_PRESENCE_TIMEOUT, TIMEOUT_GROUP): number.number_schema(
AttributeError: module 'esphome.components.number' has no attribute 'number_schema'
ERROR Unable to load component ld2420.button:

Are there any incompatibilities with the 8266? Can you help me?

:(

descipher commented 10 months ago

@dhnsilva you need to add the following for now.

number:
  - platform: ld2420
    presence_timeout:
      name: Detection Presence Timeout
    min_gate_distance:
      name: Detection Gate Minimum
    max_gate_distance:
      name: Detection Gate Maximum
    gate_select:
      name: Select Gate to Set
    still_threshold:
      name: Set Still Threshold Value
    move_threshold:
      name: Set Move Threshold Value

select:
  - platform: ld2420
    operating_mode:
      name: Operating Mode
dhnsilva commented 10 months ago

@dhnsilva you need to add the following for now.

number:
  - platform: ld2420
    presence_timeout:
      name: Detection Presence Timeout
    min_gate_distance:
      name: Detection Gate Minimum
    max_gate_distance:
      name: Detection Gate Maximum
    gate_select:
      name: Select Gate to Set
    still_threshold:
      name: Set Still Threshold Value
    move_threshold:
      name: Set Move Threshold Value

select:
  - platform: ld2420
    operating_mode:
      name: Operating Mode

adding this I got this error:

image

I'm almost giving up

descipher commented 10 months ago

This will compile -

# The LD2420 has 16 sense gates 0-15 and each gate detects 0.7 meters 15th gate = 9m
ld2420:

text_sensor:
  - platform: ld2420
    fw_version:
      name: LD2420 Firmware

sensor:
  - platform: ld2420
    moving_distance:
      name : Moving Distance

binary_sensor:
  - platform: ld2420
    has_target:
      name: Presence

switch:
  - platform: restart
    name: Restart ESPHome Node

select:
  - platform: ld2420
    operating_mode:
      name: (s) Operating Mode

number:
  - platform: ld2420
    presence_timeout:
      name: (n) Detection Presence Timeout
    min_gate_distance:
      name: (n) Detection Gate Minimum
    max_gate_distance:
      name: (n) Detection Gate Maximum
    gate_select:
      name: (n) Select Gate to Set
    still_threshold:
      name: (n) Set Still Threshold Value
    move_threshold:
      name: (n) Set Move Threshold Value

button:
  - platform: ld2420
    apply_config:
      name: (b) Apply Config
    factory_reset:
      name: (b) Factory Reset
    restart_module:
      name: (b) Restart Module
    revert_config:
      name: (b) Undo Edits
dhnsilva commented 10 months ago

It Is incredible!

when I put only text_sensor, sensor, binary_sensor, switch, like this:

image

It starts to compiling, but obviously don't finishes.

image

If I put the complete code like yours (With select, number and button), the compile appears with a a error on the beginning, like this....

image

I have 5 ESP8266 and 5 LD2420 and I would like to use it so much!

descipher commented 10 months ago

This part is required.


select:
  - platform: ld2420
    operating_mode:
      name: Operating Mode
dhnsilva commented 10 months ago

yes... is with select entry also! Identic with

select:
  - platform: ld2420
    operating_mode:
      name: Operating Mode

Or

select:
  - platform: ld2420
    operating_mode:
      name: (s) Operating Mode

The error is the same! image

descipher commented 10 months ago

@dhnsilva Ok, I can test an ESP8266 what specific device do you have defined in the YAML.

descipher commented 10 months ago

@dhnsilva It does compile for me using an ESP8266, What version of ESPHome are you running? Try running a clean.

dhnsilva commented 10 months ago

ESPHome version is 2023.2.4

When I compile clean its works like a charm! My Hardware ia a simple ESP8266 and a LD2420 exactly as presented on ESPHome Website

This is the complete YAML

external_components:
  - source: github://pr#4847
    components: [ ld2420 ]
    refresh: 0s

esphome:
  name: teste
  friendly_name: teste

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "l9ZIvhkMLXDdCmi3uwkNhDH7zct7EnBT9DYI/c7YT4I="

ota:
  password: "8b517df9e56d0cfbc37da48853f36ff8"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Teste Fallback Hotspot"
    password: "vBQ9D01aHfWA"

captive_portal:

uart:
  id: ld2420_uart
  tx_pin: 1
  rx_pin: 3
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

# The LD2420 has 16 sense gates 0-15 and each gate detects 0.7 meters 15th gate = 9m
ld2420:

text_sensor:
  - platform: ld2420
    fw_version:
      name: LD2420 Firmware

sensor:
  - platform: ld2420
    moving_distance:
      name : Moving Distance

binary_sensor:
  - platform: ld2420
    has_target:
      name: Presence

switch:
  - platform: restart
    name: Restart ESPHome Node

select:
  - platform: ld2420
    operating_mode:
      name: (s) Operating Mode

number:
  - platform: ld2420
    presence_timeout:
      name: (n) Detection Presence Timeout
    min_gate_distance:
      name: (n) Detection Gate Minimum
    max_gate_distance:
      name: (n) Detection Gate Maximum
    gate_select:
      name: (n) Select Gate to Set
    still_threshold:
      name: (n) Set Still Threshold Value
    move_threshold:
      name: (n) Set Move Threshold Value

button:
  - platform: ld2420
    apply_config:
      name: (b) Apply Config
    factory_reset:
      name: (b) Factory Reset
    restart_module:
      name: (b) Restart Module
    revert_config:
      name: (b) Undo Edits

Resuming: Compiling ESP8266 alone, works perfectaly. Compiling ESP8266 using LD2420: The YAML partially compiles when excluded select, number and button parts... The YAML fail in beginning when I use a complete YAML like this

Thank you very much for your time dispensed with me!

dhnsilva commented 10 months ago

Other info: I am tried

select:
  - platform: ld2420
    operating_mode:
      name: (s) Operating Mode

and

select:
  - platform: ld2420
    operating_mode:
      name: Operating Mode
descipher commented 10 months ago

@dhnsilva ESPHome version is 2023.2.4, that's 8 months old. Try updating.

We are currently running: INFO ESPHome 2023.10.6 INFO Reading configuration /config/esphome/test.yaml... INFO Updating https://github.com/esphome/esphome.git@pull/4847/head

Is this an older ld2420? with fw v1.5.3 and up the baud rate is 115200

Also that module will not work with logging at the same time. either remove logger or disable logging

dhnsilva commented 10 months ago

@descipher It works!!!!!! the problem was the version of ESPHome as you said!

Iam using a docker version of EspHome and the link used was out of date. The update was enough to get ir working! One more time! Thanks!

descipher commented 10 months ago

Awesome .. thanks for the update. There are some things I need to edit in the code. Specifically I missed some #ifdef USE_NUMBER and the USE_TEXT .. normally you will be able to use just the parts you need outside of the required select:

vb7445 commented 8 months ago

ESPHome 2023.12.5 Home Assistant OS, core-2023.12.4 LD2420, version 1.5.9

I'm using the standard yaml for the LD2420. The functionality seems to be there, i.e. Calibration works sending data to the log. However, I'm not getting proper detections. In other words, it's not detecting movement. I've tried various thresholds, calibrations and factory resets. I tried a couple different devices but got the same results. I'm wondering if there's some trick to setting this up or should it run right out of the box so to say?`

esphome:
  name: "ehproto"
  friendly_name: ehproto

esp8266:
  board: esp01_1m

# Logging serial output disabled to use LD2420, baud_rate: 0
logger:
   level: DEBUG
   baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: "grcIxcAUbEMUVVk5z2DbeUAh8BUdkJRFgoVLX62Eu0I="

ota:

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
      channel: 11
  manual_ip: 
    static_ip: 192.168.1.60
    gateway: 192.168.1.1
    subnet: 255.255.255.0
  power_save_mode: none
  output_power: 20dB
  fast_connect: True
  reboot_timeout: 5min

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

captive_portal:

uart:
  id: ld2420_uart
  tx_pin: 1
  rx_pin: 3
  baud_rate:  115200
  # parity: NONE
  # stop_bits: 1

# The LD2420 has 16 sense gates 0-15 and each gate detects 0.7 meters 15th gate = 9m
ld2420:

text_sensor:
  - platform: ld2420
    fw_version:
      name: LD2420 Firmware

binary_sensor:
  - platform: ld2420
    has_target:
      name: Presence

select:
  - platform: ld2420
    operating_mode:
      name: Operating Mode

number:
  - platform: ld2420
    presence_timeout:
      name: Detection Presence Timeout
    min_gate_distance:
      name: Detection Gate Minimum
    max_gate_distance:
      name: Detection Gate Maximum
    gate_select:
      name: Select Gate to Set
    still_threshold:
      name: Set Still Threshold Value
    move_threshold:
      name: Set Move Threshold Value

button:
  - platform: ld2420
    apply_config:
      name: Apply Config
    factory_reset:
      name: Factory Reset
    restart_module:
      name: Restart Module
    revert_config:
      name: Undo Edits

sensor:
  - platform: adc
    pin: A0
    name: "Battery Voltage"
    update_interval: 3min
    accuracy_decimals: 2
    filters:
      - multiply: 1
      - calibrate_linear:
         method: least_squares
         datapoints:
          # Map 0.0 (from sensor) to 1.0 (true value)
          - 0.0 -> 0.0
          - 0.83 -> 3.87
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 3min
  - platform: ld2420
    moving_distance:
      name : Moving Distance
descipher commented 8 months ago

@vb7445 Does it report the firmware correctly? Is the device in an enclosure?

vb7445 commented 8 months ago

@descipher I don't have it in an enclosure but open on the bench. The proto board it's on is being held in a vise which is pointing the LD2420 out into the room as it's detailed in the documentation for wall mounting. Yes, it does report the firmware as v1.5.9. I see that in Home Assistant based on the text sensor in the config file:

text_sensor:
  - platform: ld2420
    fw_version:
      name: LD2420 Firmware

ld2420 protoboard

descipher commented 8 months ago

Since you're actually using a D1 mini your config could be changed.

Don't use the Tx Rx pins for the uart, Use the following edits.


logger:

esp8266:
  board: d1_mini

uart:
  id: ld2420_uart
  tx_pin: GPIO5
  rx_pin: GPIO4
  baud_rate: 115200
  parity: NONE
  stop_bits: 1
vb7445 commented 8 months ago

@descipher Very good, those settings work. Thanks. I connected the LD2420 OT1 pin3 to GPIO4 and LD2420 RX pin4 to GPIO5. Also had to run a Calibration as the Factory settings didn't work for my setup.

I was of the understanding that the I2C bus on the D1 use pins GPIO4 & 5 which I was going to use with a LHT20 sensor, so I'll need to better understand these GPIO pins on a D1. I admit I get confused with ESP device pinouts together with DEV Kit pinouts and what can be used with what.

descipher commented 8 months ago

@vb7445 You're welcome. Yes those are the I2C hardware pins, I would suggest using an esp32 D1 board which have advanced peripheral pin mapping capability for the use case you're dialoging. You will be glad you have the extra memory with an esp32 vs a esp8266.

miguellandre commented 8 months ago

I'm using the default yaml for the LD2420. However, I am not getting detections, it appears unknown. I have tried factory resets. I tried a few different codes, but always the same results. Is there anything else I can do to configure it? I also leave the logs to see if there is anything wrong.

my code add logs:

` esphome: name: ld2024teste friendly_name: ld2024teste

esp8266: board: esp01_1m

Logging serial output disabled to use LD2420, baud_rate: 0

logger: level: DEBUG baud_rate: 0

Enable Home Assistant API

api: encryption: key: "Hq/6Kpni97Izlk+86/7lpSiXMwLQo9kZbx5NOnk25Vo="

ota: password: "56a07268de888f5188cdf357943d44cc"

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

captive_portal:

uart: id: ld2420_uart tx_pin: 1 rx_pin: 3 baud_rate: 115200 parity: NONE stop_bits: 1

ld2420:

text_sensor:

binary_sensor:

select:

number:

button:

sensor:

Logs:

INFO ESPHome 2023.12.5 INFO Reading configuration /config/esphome/ld2024teste.yaml... INFO Starting log output from 192.168.1.48 using esphome API INFO Successfully connected to ld2024teste @ 192.168.1.48 in 0.003s INFO Successful handshake with ld2024teste @ 192.168.1.48 in 2.616s [14:50:35][I][app:102]: ESPHome version 2023.12.5 compiled on Jan 14 2024, 14:48:21

[14:50:35][C][wifi:405]: Local MAC: 40:91:51:4F:89:F2 [14:50:35][C][wifi:410]: SSID: [redacted] [14:50:35][C][wifi:411]: IP Address: 192.168.1.48 [14:50:35][C][wifi:412]: BSSID: [redacted]

[14:50:35][C][wifi:416]: Signal strength: -68 dB ▂▄▆█ [14:50:35][C][wifi:420]: Channel: 6 [14:50:35][C][wifi:421]: Subnet: 255.255.255.0 [14:50:35][C][wifi:422]: Gateway: 192.168.1.1 [14:50:35][C][wifi:423]: DNS1: 192.168.1.1 [14:50:35][C][wifi:424]: DNS2: 0.0.0.0

[14:50:35][C][logger:444]: Level: DEBUG [14:50:35][C][logger:445]: Log Baud Rate: 0 [14:50:35][C][logger:447]: Hardware UART: UART0 [14:50:35][C][uart.arduino_esp8266:102]: UART Bus: [14:50:35][C][uart.arduino_esp8266:103]: TX Pin: GPIO1 [14:50:35][C][uart.arduino_esp8266:104]: RX Pin: GPIO3 [14:50:35][C][uart.arduino_esp8266:106]: RX Buffer Size: 256 [14:50:35][C][uart.arduino_esp8266:108]: Baud Rate: 115200 baud [14:50:35][C][uart.arduino_esp8266:109]: Data Bits: 8 [14:50:35][C][uart.arduino_esp8266:110]: Parity: NONE [14:50:35][C][uart.arduino_esp8266:111]: Stop bits: 1 [14:50:35][C][uart.arduino_esp8266:113]: Using hardware serial interface.

[14:50:35][C][ld2420:069]: Firmware Version : v0.0.0 [14:50:35][C][ld2420:070]: LD2420 Number: [14:50:35][C][ld2420:072]: ld2420 Gate Timeout: 'Detection Presence Timeout' [14:50:35][C][ld2420:072]: ld2420 Icon: 'mdi:timelapse' [14:50:35][C][ld2420:072]: ld2420 Unit of Measurement: 's' [14:50:35][C][ld2420:073]: ld2420 Gate Max Distance: 'Detection Gate Maximum' [14:50:35][C][ld2420:073]: ld2420 Icon: 'mdi:motion-sensor' [14:50:35][C][ld2420:073]: ld2420 Device Class: 'distance' [14:50:35][C][ld2420:074]: ld2420 Gate Min Distance: 'Detection Gate Minimum' [14:50:35][C][ld2420:074]: ld2420 Icon: 'mdi:motion-sensor' [14:50:35][C][ld2420:074]: ld2420 Device Class: 'distance' [14:50:35][C][ld2420:075]: ld2420 Gate Select: 'Select Gate to Set' [14:50:35][C][ld2420:075]: ld2420 Icon: 'mdi:motion-sensor' [14:50:35][C][ld2420:075]: ld2420 Device Class: 'distance' [14:50:35][C][ld2420:077]: ld2420 Gate Move Threshold: 'Set Move Threshold Value' [14:50:35][C][ld2420:077]: ld2420 Icon: 'mdi:motion-sensor' [14:50:35][C][ld2420:078]: ld2420 Gate Still Threshold:: 'Set Still Threshold Value' [14:50:35][C][ld2420:078]: ld2420 Icon: 'mdi:motion-sensor' [14:50:35][C][ld2420:082]: ld2420 Apply Config: 'Apply Config' [14:50:35][C][ld2420:082]: ld2420 Icon: 'mdi:restart-alert' [14:50:35][C][ld2420:083]: ld2420 Revert Edits: 'Undo Edits' [14:50:35][C][ld2420:083]: ld2420 Icon: 'mdi:restart' [14:50:35][C][ld2420:084]: ld2420 Factory Reset: 'Factory Reset' [14:50:35][C][ld2420:084]: ld2420 Icon: 'mdi:database' [14:50:35][C][ld2420:085]: ld2420 Restart Module: 'Restart Module' [14:50:35][C][ld2420:085]: ld2420 Icon: 'mdi:database' [14:50:35][C][ld2420:087]: LD2420 Select: [14:50:35][C][ld2420:088]: ld2420 Operating Mode 'Operating Mode' [14:50:35][W][ld2420:090]: LD2420 Firmware Version v0.0.0 and older are only supported in Simple Mode [14:50:35][C][LD2420.text_sensor:011]: LD2420 TextSensor:

[14:50:35][C][LD2420.binary_sensor:011]: LD2420 BinarySensor:

[14:50:35][C][LD2420.binary_sensor:012]: Device Class: 'occupancy' [14:50:35][C][LD2420.sensor:011]: LD2420 Sensor:

[14:50:35][C][LD2420.sensor:012]: Device Class: 'distance' [14:50:35][C][LD2420.sensor:012]: State Class: '' [14:50:35][C][LD2420.sensor:012]: Unit of Measurement: 'cm' [14:50:35][C][LD2420.sensor:012]: Accuracy Decimals: 0 [14:50:35][C][captive_portal:088]: Captive Portal:

[14:50:35][C][mdns:116]: Hostname: ld2024teste [14:50:35][C][ota:097]: Over-The-Air Updates: [14:50:35][C][ota:098]: Address: ld2024teste.local:8266 [14:50:35][C][ota:101]: Using Password. [14:50:35][C][api:139]: API Server: [14:50:35][C][api:140]: Address: ld2024teste.local:6053 [14:50:35][C][api:142]: Using noise encryption: YES

descipher commented 8 months ago

@miguellandre There are a number of things you need to rule out.

1) Is the module running at 256000 or 115200 early modules were 256000 e.g. v1.5.2 or lower. 2) Are the serial lines connected correctly? Don't assume someone else's config works as is. LD Tx to ESP Rx LD Rx to ESP Tx image If the firmware is unknown then do all the possible firmware pin maps. 3) Simplify the config to only the required elements. 4) esp_01m have variations in capability is yours capable? 5) Logging? Try removing the logging component all together.

Huymee commented 7 months ago

I'm using the default yaml for the LD2420. However, I am not getting detections, it appears unknown. I have tried factory resets. I tried a few different codes, but always the same results. Is there anything else I can do to configure it? I also leave the logs to see if there is anything wrong.

my code add logs:

` esphome: name: ld2024teste friendly_name: ld2024teste

esp8266: board: esp01_1m

Logging serial output disabled to use LD2420, baud_rate: 0

logger: level: DEBUG baud_rate: 0

Enable Home Assistant API

api: encryption: key: "Hq/6Kpni97Izlk+86/7lpSiXMwLQo9kZbx5NOnk25Vo="

ota: password: "56a07268de888f5188cdf357943d44cc"

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

captive_portal:

uart: id: ld2420_uart tx_pin: 1 rx_pin: 3 baud_rate: 115200 parity: NONE stop_bits: 1

ld2420:

text_sensor:

  • platform: ld2420 fw_version: name: LD2420 Firmware

binary_sensor:

  • platform: ld2420 has_target: name: Presence

select:

  • platform: ld2420 operating_mode: name: Operating Mode

number:

  • platform: ld2420 presence_timeout: name: Detection Presence Timeout min_gate_distance: name: Detection Gate Minimum max_gate_distance: name: Detection Gate Maximum gate_select: name: Select Gate to Set still_threshold: name: Set Still Threshold Value move_threshold: name: Set Move Threshold Value

button:

  • platform: ld2420 apply_config: name: Apply Config factory_reset: name: Factory Reset restart_module: name: Restart Module revert_config: name: Undo Edits

sensor:

  • platform: ld2420 moving_distance: name : Moving Distance`

Logs:

INFO ESPHome 2023.12.5 INFO Reading configuration /config/esphome/ld2024teste.yaml... INFO Starting log output from 192.168.1.48 using esphome API INFO Successfully connected to ld2024teste @ 192.168.1.48 in 0.003s INFO Successful handshake with ld2024teste @ 192.168.1.48 in 2.616s [14:50:35][I][app:102]: ESPHome version 2023.12.5 compiled on Jan 14 2024, 14:48:21 [14:50:35][C][wifi:573]: WiFi: [14:50:35][C][wifi:405]: Local MAC: 40:91:51:4F:89:F2 [14:50:35][C][wifi:410]: SSID: [redacted] [14:50:35][C][wifi:411]: IP Address: 192.168.1.48 [14:50:35][C][wifi:412]: BSSID: [redacted] [14:50:35][C][wifi:414]: Hostname: 'ld2024teste' [14:50:35][C][wifi:416]: Signal strength: -68 dB ▂▄▆█ [14:50:35][C][wifi:420]: Channel: 6 [14:50:35][C][wifi:421]: Subnet: 255.255.255.0 [14:50:35][C][wifi:422]: Gateway: 192.168.1.1 [14:50:35][C][wifi:423]: DNS1: 192.168.1.1 [14:50:35][C][wifi:424]: DNS2: 0.0.0.0 [14:50:35][C][logger:443]: Logger: [14:50:35][C][logger:444]: Level: DEBUG [14:50:35][C][logger:445]: Log Baud Rate: 0 [14:50:35][C][logger:447]: Hardware UART: UART0 [14:50:35][C][uart.arduino_esp8266:102]: UART Bus: [14:50:35][C][uart.arduino_esp8266:103]: TX Pin: GPIO1 [14:50:35][C][uart.arduino_esp8266:104]: RX Pin: GPIO3 [14:50:35][C][uart.arduino_esp8266:106]: RX Buffer Size: 256 [14:50:35][C][uart.arduino_esp8266:108]: Baud Rate: 115200 baud [14:50:35][C][uart.arduino_esp8266:109]: Data Bits: 8 [14:50:35][C][uart.arduino_esp8266:110]: Parity: NONE [14:50:35][C][uart.arduino_esp8266:111]: Stop bits: 1 [14:50:35][C][uart.arduino_esp8266:113]: Using hardware serial interface. [14:50:35][C][ld2420:068]: LD2420: [14:50:35][C][ld2420:069]: Firmware Version : v0.0.0 [14:50:35][C][ld2420:070]: LD2420 Number: [14:50:35][C][ld2420:072]: ld2420 Gate Timeout: 'Detection Presence Timeout' [14:50:35][C][ld2420:072]: ld2420 Icon: 'mdi:timelapse' [14:50:35][C][ld2420:072]: ld2420 Unit of Measurement: 's' [14:50:35][C][ld2420:073]: ld2420 Gate Max Distance: 'Detection Gate Maximum' [14:50:35][C][ld2420:073]: ld2420 Icon: 'mdi:motion-sensor' [14:50:35][C][ld2420:073]: ld2420 Device Class: 'distance' [14:50:35][C][ld2420:074]: ld2420 Gate Min Distance: 'Detection Gate Minimum' [14:50:35][C][ld2420:074]: ld2420 Icon: 'mdi:motion-sensor' [14:50:35][C][ld2420:074]: ld2420 Device Class: 'distance' [14:50:35][C][ld2420:075]: ld2420 Gate Select: 'Select Gate to Set' [14:50:35][C][ld2420:075]: ld2420 Icon: 'mdi:motion-sensor' [14:50:35][C][ld2420:075]: ld2420 Device Class: 'distance' [14:50:35][C][ld2420:077]: ld2420 Gate Move Threshold: 'Set Move Threshold Value' [14:50:35][C][ld2420:077]: ld2420 Icon: 'mdi:motion-sensor' [14:50:35][C][ld2420:078]: ld2420 Gate Still Threshold:: 'Set Still Threshold Value' [14:50:35][C][ld2420:078]: ld2420 Icon: 'mdi:motion-sensor' [14:50:35][C][ld2420:082]: ld2420 Apply Config: 'Apply Config' [14:50:35][C][ld2420:082]: ld2420 Icon: 'mdi:restart-alert' [14:50:35][C][ld2420:083]: ld2420 Revert Edits: 'Undo Edits' [14:50:35][C][ld2420:083]: ld2420 Icon: 'mdi:restart' [14:50:35][C][ld2420:084]: ld2420 Factory Reset: 'Factory Reset' [14:50:35][C][ld2420:084]: ld2420 Icon: 'mdi:database' [14:50:35][C][ld2420:085]: ld2420 Restart Module: 'Restart Module' [14:50:35][C][ld2420:085]: ld2420 Icon: 'mdi:database' [14:50:35][C][ld2420:087]: LD2420 Select: [14:50:35][C][ld2420:088]: ld2420 Operating Mode 'Operating Mode' [14:50:35][W][ld2420:090]: LD2420 Firmware Version v0.0.0 and older are only supported in Simple Mode [14:50:35][C][LD2420.text_sensor:011]: LD2420 TextSensor: [14:50:35][C][LD2420.text_sensor:012]: Firmware 'LD2420 Firmware' [14:50:35][C][LD2420.text_sensor:012]: Icon: 'mdi:chip' [14:50:35][C][LD2420.binary_sensor:011]: LD2420 BinarySensor: [14:50:35][C][LD2420.binary_sensor:012]: Presence 'Presence' [14:50:35][C][LD2420.binary_sensor:012]: Device Class: 'occupancy' [14:50:35][C][LD2420.sensor:011]: LD2420 Sensor: [14:50:35][C][LD2420.sensor:012]: Distance 'Moving Distance' [14:50:35][C][LD2420.sensor:012]: Device Class: 'distance' [14:50:35][C][LD2420.sensor:012]: State Class: '' [14:50:35][C][LD2420.sensor:012]: Unit of Measurement: 'cm' [14:50:35][C][LD2420.sensor:012]: Accuracy Decimals: 0 [14:50:35][C][captive_portal:088]: Captive Portal: [14:50:35][C][mdns:115]: mDNS: [14:50:35][C][mdns:116]: Hostname: ld2024teste [14:50:35][C][ota:097]: Over-The-Air Updates: [14:50:35][C][ota:098]: Address: ld2024teste.local:8266 [14:50:35][C][ota:101]: Using Password. [14:50:35][C][api:139]: API Server: [14:50:35][C][api:140]: Address: ld2024teste.local:6053 [14:50:35][C][api:142]: Using noise encryption: YES

U can try this:

uart:
  #id: ld2420_uart  
  tx_pin: GPIO5
  rx_pin: GPIO4
  baud_rate: 115200
  parity: NONE
  stop_bits: 1
descipher commented 7 months ago

If it's an actual ESP01 module those pins are not accessible without precision soldering and magnet wire, only 1 and 3 can be accessed. The ESP01 is not recommended for this reason.

Huymee commented 7 months ago

If it's an actual ESP01 module those pins are not accessible without precision soldering and magnet wire, only 1 and 3 can be accessed. The ESP01 is not recommended for this reason.

It's works on ESP01 with GPIO1 & GPIO3 but LD2420 needs to be powered on first before ESP01. Other ESP are also.

itestoni commented 7 months ago

Same here. Works flawlessly on Esp32, however becomes "frozen" if OTA applied or soft restart of Esp32. Only power cycle helps. Shame, as this sensor is somehow better behaving in my environment than the Ld2410.

Same as me. I have d1-mini esp8266 connected. I don't know if the issue is after reboot but sometimes it gets frozen reporting always 35cm. My FW is 1.5.9 and default configuration. I use it with ESPHome. I suspect could be a power supply issue. To the same power supply (5V/700mA) I have connected also another module with esp32. Possibly there could be some spike/drop on the voltage. I have added on LD2420 3.3V/gnd input a 100uF electrolytic cap (the one I had available at home). Let's see if it works.

Huymee commented 7 months ago

当你使用ESP01的时候可以配置以下信息,将日志串口切换到别的pin,然后就可是正确输出LD2420的固件版本了

# Enable logging
logger:
  hardware_uart: UART1
itestoni commented 7 months ago

当你使用ESP01的时候可以配置以下信息,将日志串口切换到别的pin,然后就可是正确输出LD2420的固件版本了

# Enable logging
logger:
  hardware_uart: UART1

Hi, FW version is 1.5.9, here following ESPHome log. Anyway, putting a capacitor on 3v3 didn't help.

[16:51:24][C][logger:440]: Level: DEBUG [16:51:24][C][logger:441]: Log Baud Rate: 115200 [16:51:24][C][logger:443]: Hardware UART: UART0 [16:51:24][C][uart.arduino_esp8266:102]: UART Bus: [16:51:24][C][uart.arduino_esp8266:103]: TX Pin: GPIO4 [16:51:24][C][uart.arduino_esp8266:104]: RX Pin: GPIO5 [16:51:24][C][uart.arduino_esp8266:106]: RX Buffer Size: 256 [16:51:24][C][uart.arduino_esp8266:108]: Baud Rate: 115200 baud [16:51:24][C][uart.arduino_esp8266:109]: Data Bits: 8 [16:51:24][C][uart.arduino_esp8266:110]: Parity: NONE [16:51:24][C][uart.arduino_esp8266:111]: Stop bits: 1 [16:51:24][C][uart.arduino_esp8266:115]: Using software serial

[16:51:24][C][ld2420:069]: Firmware Version : v1.5.9 [16:51:24][C][ld2420:070]: LD2420 Number: [16:51:24][C][ld2420:072]: ld2420 Gate Timeout: 'Timeout di rilevazione presenza' [16:51:24][C][ld2420:072]: ld2420 Icon: 'mdi:timelapse' [16:51:24][C][ld2420:072]: ld2420 Unit of Measurement: 's' [16:51:24][C][ld2420:073]: ld2420 Gate Max Distance: 'Distanza massima gate' [16:51:24][C][ld2420:073]: ld2420 Icon: 'mdi:motion-sensor' [16:51:24][C][ld2420:073]: ld2420 Device Class: 'distance' [16:51:24][C][ld2420:074]: ld2420 Gate Min Distance: 'Distanza minima gate'