feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

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

Open zimmra opened this issue 1 year ago • 112 comments

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

  • Similar to the LD2410 Module, the LD2420 is a 24GHz Radar Sensor

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

  • Use LD2420 in place of LD2410

Additional context

  • Protocol information can be found at https://github.com/soubhik-khan/HLK-LD2420
  • https://www.hlktech.net/index.php?id=1150

zimmra avatar May 02 '23 17:05 zimmra

I will look into this

max246 avatar May 13 '23 00:05 max246

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

descipher avatar May 29 '23 15:05 descipher

Inprogress see: esphome/esphome#4847

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

max246 avatar May 29 '23 16:05 max246

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

AlexKey1971 avatar Jul 13 '23 14:07 AlexKey1971

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 avatar Jul 13 '23 14:07 descipher

BTW that netlify link fails as 404.

descipher avatar Jul 13 '23 15:07 descipher

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

AlexKey1971 avatar Jul 13 '23 15:07 AlexKey1971

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.

Mikescotland avatar Aug 09 '23 17:08 Mikescotland

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

descipher avatar Aug 10 '23 13:08 descipher

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.

Mikescotland avatar Aug 10 '23 14:08 Mikescotland

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.

descipher avatar Aug 10 '23 14:08 descipher

No idea how to retrieve it, unfortunately from the HA

Mikescotland avatar Aug 10 '23 14:08 Mikescotland

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 avatar Aug 10 '23 14:08 descipher

Using HA's ESPhome control panel integration ..

image

image

Logs -> Wireless

image

descipher avatar Aug 10 '23 15:08 descipher

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

Mikescotland avatar Aug 10 '23 15:08 Mikescotland

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.

descipher avatar Aug 10 '23 15:08 descipher

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 avatar Aug 18 '23 03:08 hkrob

Anyone know where to find the updated firmware?

hkrob avatar Sep 02 '23 04:09 hkrob

Anyone know where to find the updated firmware?

lboue avatar Oct 15 '23 11:10 lboue

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).

descipher avatar Oct 20 '23 20:10 descipher

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:

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

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:

  • platform: ld2420 moving_distance: name : Distancia do Movimento

binary_sensor:

  • platform: ld2420 has_target: name: Presenca

  • platform: gpio pin: number: 26 mode: INPUT_PULLUP name: "Interruptor mmwave" device_class: light #on_press:

    - homeassistant.service:

    service: light.turn_off

    data:

    entity_id: light.escritorio_mesa

    #on_release:

    - homeassistant.service:

    service: light.turn_on

    data:

    entity_id: light.escritorio_mesa

  • platform: gpio pin: number: 39 inverted: false name: Botão on_press: then: - light.toggle: status_led

light:

  • platform: fastled_clockless chipset: WS2812B pin: 27 num_leds: 1 rgb_order: GRB id: status_led name: Luz effects:
    • random:
    • flicker:
    • addressable_rainbow:

switch:

  • platform: restart name: Restart`

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]

[presence_time_window] is an invalid option for [0]. Please check the indentation.
presence_time_window: 30s

[detection_gate_min] is an invalid option for [0]. Please check the indentation.
detection_gate_min: 1

[detection_gate_max] is an invalid option for [0]. Please check the indentation.
detection_gate_max: 12

[g0_move_threshold] is an invalid option for [0]. Please check the indentation.
g0_move_threshold: 60000

[g0_still_threshold] is an invalid option for [0]. Please check the indentation.
g0_still_threshold: 40000

[g1_move_threshold] is an invalid option for [0]. Please check the indentation.
g1_move_threshold: 30000

[g1_still_threshold] is an invalid option for [0]. Please check the indentation.
g1_still_threshold: 20000

[g2_move_threshold] is an invalid option for [0]. Please check the indentation.
g2_move_threshold: 400

[g2_still_threshold] is an invalid option for [0]. Please check the indentation.
g2_still_threshold: 200

[g3_move_threshold] is an invalid option for [0]. Please check the indentation.
g3_move_threshold: 250

[g3_still_threshold] is an invalid option for [0]. Please check the indentation.
g3_still_threshold: 200

[g4_move_threshold] is an invalid option for [0]. Please check the indentation.
g4_move_threshold: 250

[g4_still_threshold] is an invalid option for [0]. Please check the indentation.
g4_still_threshold: 200

[g5_move_threshold] is an invalid option for [0]. Please check the indentation.
g5_move_threshold: 250

[g5_still_threshold] is an invalid option for [0]. Please check the indentation.
g5_still_threshold: 200

[g6_move_threshold] is an invalid option for [0]. Please check the indentation.
g6_move_threshold: 250

[g6_still_threshold] is an invalid option for [0]. Please check the indentation.
g6_still_threshold: 200

[g7_move_threshold] is an invalid option for [0]. Please check the indentation.
g7_move_threshold: 250

[g7_still_threshold] is an invalid option for [0]. Please check the indentation.
g7_still_threshold: 150

[g8_move_threshold] is an invalid option for [0]. Please check the indentation.
g8_move_threshold: 250

[g8_still_threshold] is an invalid option for [0]. Please check the indentation.
g8_still_threshold: 150

[g9_move_threshold] is an invalid option for [0]. Please check the indentation.
g9_move_threshold: 250

[g9_still_threshold] is an invalid option for [0]. Please check the indentation.
g9_still_threshold: 100

[g10_move_threshold] is an invalid option for [0]. Please check the indentation.
g10_move_threshold: 250

[g10_still_threshold] is an invalid option for [0]. Please check the indentation.
g10_still_threshold: 100

[g11_move_threshold] is an invalid option for [0]. Please check the indentation.
g11_move_threshold: 250

[g11_still_threshold] is an invalid option for [0]. Please check the indentation.
g11_still_threshold: 100

[g12_move_threshold] is an invalid option for [0]. Please check the indentation.
g12_move_threshold: 250

[g12_still_threshold] is an invalid option for [0]. Please check the indentation.
g12_still_threshold: 100

[g13_move_threshold] is an invalid option for [0]. Please check the indentation.
g13_move_threshold: 200

[g13_still_threshold] is an invalid option for [0]. Please check the indentation.
g13_still_threshold: 100

[g14_move_threshold] is an invalid option for [0]. Please check the indentation.
g14_move_threshold: 200

[g14_still_threshold] is an invalid option for [0]. Please check the indentation.
g14_still_threshold: 100

[g15_move_threshold] is an invalid option for [0]. Please check the indentation.
g15_move_threshold: 200

[g15_still_threshold] is an invalid option for [0]. Please check the indentation.
g15_still_threshold: 100`

gkawanami avatar Nov 05 '23 12:11 gkawanami

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

descipher avatar Nov 05 '23 13:11 descipher

@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?

:(

dhnsilva avatar Nov 06 '23 19:11 dhnsilva

@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

descipher avatar Nov 06 '23 20:11 descipher

@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

dhnsilva avatar Nov 07 '23 21:11 dhnsilva

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

descipher avatar Nov 08 '23 00:11 descipher

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!

dhnsilva avatar Nov 08 '23 10:11 dhnsilva

This part is required.

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

descipher avatar Nov 08 '23 13:11 descipher

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

dhnsilva avatar Nov 08 '23 19:11 dhnsilva

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

descipher avatar Nov 08 '23 19:11 descipher