TillFleisch / ESPHome-HLK-LD2450

ESPHome support for the HI-Link HLK-LD2450 millimeter wave sensor (external component) with support for custom zones using convex polygons.
MIT License
105 stars 19 forks source link

Is it possible to use multiple sensors? #3

Closed Aaroneisele55 closed 9 months ago

Aaroneisele55 commented 9 months ago

Hello, I am trying to use two LD2450 sensors on the same ESP32. I correctly configured the UARTs, and the section for the LD2450s in my code looks like this:

external_components:
  - source: github://TillFleisch/ESPHome-HLK-LD2450@main

uart:
  - id: uart_bus_internal
    rx_pin: 
      number: GPIO25
      mode:
        input: true
        pullup: true
    tx_pin: 
      number: GPIO22
      mode:
        input: true
        pullup: true
    baud_rate: 256000
    parity: NONE
    stop_bits: 1
    data_bits: 8
  - id: uart_bus_external
    rx_pin: 
      number: GPIO19
      mode:
        input: true
        pullup: true
    tx_pin: 
      number: GPIO18
      mode:
        input: true
        pullup: true
    baud_rate: 256000
    parity: NONE
    stop_bits: 1
    data_bits: 8

LD2450:
  - id: ld2410_internal
    uart_id: uart_bus_internal
    targets:
      - target:
          debug: true
          x_position:
            id: t1_xpos
          y_position:
            id: t1_ypos
          speed:
            id: t1_speed
          distance_resolution:
            id: t1_res
          angle:
            id: t1_angle
          distance:
            id: t1_distance
  - id: ld2410_external
    uart_id: uart_bus_external
    targets:
      - target:
          debug: true
          x_position:
            id: t1_xpos
          y_position:
            id: t1_ypos
          speed:
            id: t1_speed
          distance_resolution:
            id: t1_res
          angle:
            id: t1_angle
          distance:
            id: t1_distance

When I try to compile it, the error message is as follows:

INFO ESPHome 2023.12.9
INFO Reading configuration /config/esphome/mmwavetest-d1mini32-02.yaml...
Failed config

LD2450: [source <unicode string>:67]

  expected a dictionary.
  - id: ld2410_internal
    uart_id: uart_bus_internal
    targets: 
      - target: 
          debug: True
          x_position: 
            id: t1_xpos
          y_position: 
            id: t1_ypos
          speed: 
            id: t1_speed
          distance_resolution: 
            id: t1_res
          angle: 
            id: t1_angle
          distance: 
            id: t1_distance
  - id: ld2410_external
    uart_id: uart_bus_external
    targets: 
      - target: 
          debug: True
          x_position: 
            id: t1_xpos
          y_position: 
            id: t1_ypos
          speed: 
            id: t1_speed
          distance_resolution: 
            id: t1_res
          angle: 
            id: t1_angle
          distance: 
            id: t1_distance

Is it possible to use two LD2450 sensors on the same ESP32? If yes, how would the code look like?

Best regards Aaron

PeeVv commented 9 months ago

I was just about to post the same message. I too want to use a single ESP32 with multiple (at least two) sensors, but I get the same "expected a dictionary".