ESP8266 with LD2410 - Max command length exceeded; ignoring

Hello to all,

Reaching out for help as i am facing a strange issue after the last ESPHome update with an ESP8266 and an mmWave sensor LD2410. Without changing anything in the yaml i noticed that all my entities are “Unknown” but the chip is actually connected to my rooter and online in the ESPHome Builder. When i checked the ESPHome Builder logs, i can confirm that the signal strenght is fine but i get constant messages: Max command length exceeded; ignoring.

The sensor is sholdered to the 1 and 3 pins (which is not adviced) but on the other hand i set the baud_rate of the logger to 0 as per instructions on the documentation.

Also, this happens with 3 sensor already not just one so this rules out a faulty microcontroller.

Has anyone solved an issue like this? Below is my yaml:

substitutions:
  name: esphome-web-e011f5
  friendly_name: Living Room mmWave

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: '1.0'

esp8266:
  board: esp01_1m

external_components:

  - source: github://pr#14138
    components: [ld2410, ld2450]
    refresh: 1h

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:

# Allow provisioning Wi-Fi via serial

# Allow Over-The-Air updates
ota:
  platform: esphome


wifi:
  # Set up a wifi access point
  ap: {}
  min_auth_mode: WPA2

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp8266.yaml@main
  import_full_config: true

# To have a "next url" for improv serial
web_server:

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

ld2410:
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

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

binary_sensor:
  - platform: ld2410
    has_target:
      name: LR Presence
    has_moving_target:
      name: LR Moving Target
    has_still_target:
      name: LR Still Target

sensor:

  - platform: ld2410
    moving_distance:
      name : LR Moving Distance
    still_distance:
      name: LR Still Distance
    moving_energy:
      name: LR Move Energy
    still_energy:
      name: LR Still Energy
    detection_distance:
      name: LR 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

switch:
  - platform: ld2410
    engineering_mode:
      name: "engineering mode"
    bluetooth:
      name: "control bluetooth"

If you disable engineering mode and set uart
rx_buffer_size: 1024,
does it behave better?

Hi, thanks for taking the time to reply.

Tried this but unfortunately it remains the same. The Engineering mode is off and i added the rx_buffer_size: 1024 under the uart. Like below:

uart:
  tx_pin: 1
  rx_pin: 3
  baud_rate: 256000
  parity: NONE
  stop_bits: 1
  rx_buffer_size: 1024

Also i need to mention that the LD2410 works correctly because when i connect to it over bluetooth i get the readings in the app. There must be something with the communication with esp board.

Maybe this helps someone to propose a solution

Your title says 2410, description 2420 and you use github pr external component instead of native esphome component. Not so clear…

Oh sorry, you are absolutely right. The sensor is indeed an LD2410. I have corrected the description. The external component was added to the code after some research i did for the error on internet and thought that it would fix my problem. In my understanding this PR was applies to both 2410 and 2420. Anyway, it didn’t fix the problem so i will remove it from the yaml file.

Since you are using pr, you likely are aware that component now read all available serial data at once instead of one byte per loop, reducing CPU overhead. And it was tested with esp8266.
So maybe try some minimalistic setup and if you have hiccups, try also with different pins (in case you actually use board different from what you define on your code). Many boards have bad uart on tx/rx pins.

I think that the esp01_1m isn’t a suitable device to use. Better use a esp8266 such as a wemos mini d1 as minimum which has 8 gpio pins.

Thank you both for your comments. The sensor was working for more than a year with no issues what so ever, with the same configuration (except the external PR that was added after the problem occured). I will try to copy paste the yaml code from the ESP website and try again. Will report back