LD2410 esphome tips

Hey, I just ordered a couple of these? Where can I get the code/instructions for tihs? (Above graphs for easier setup)

Thanks

As i am getting issue with these sensors being slow especially that i have installed in stairs. I changed my logger from info to enable. After doing so i am getting these errors in logs. Does anyone know about these errors(in red)?


I have created another version of the Movement and Still Energy Charts, this time using the Plotly Graph Card available in HACS and this makes it even easier to setup as you don’t need to create any Template sensors. You just need to install the Plotly Graph Card from HACS and use the following card YAML:

Movement Energy Chart:

type: custom:plotly-graph
title: Movement Energy
refresh_interval: 1
hours_to_show: current_day
layout:
  height: 350
  margin:
    l: 50
    r: 50
    t: 50
    b: 50
  showlegend: true
  legend:
    x: 0.3
    'y': -0.3
  xaxis:
    dtick: 1
    type: number
    fixedrange: true
    range:
      - 0
      - 8
  yaxis:
    dtick: 10
    fixedrange: true
    range:
      - 0
      - 100
entities:
  - entity: ''
    name: Threshold
    mode: lines
    line:
      shape: spline
      width: 2
      color: FB239F
    x:
      - 0
      - 1
      - 2
      - 3
      - 4
      - 5
      - 6
      - 7
      - 8
    'y':
      - $ex hass.states["number.g0_move_threshold"].state
      - $ex hass.states["number.g1_move_threshold"].state
      - $ex hass.states["number.g2_move_threshold"].state
      - $ex hass.states["number.g3_move_threshold"].state
      - $ex hass.states["number.g4_move_threshold"].state
      - $ex hass.states["number.g5_move_threshold"].state
      - $ex hass.states["number.g6_move_threshold"].state
      - $ex hass.states["number.g7_move_threshold"].state
      - $ex hass.states["number.g8_move_threshold"].state
  - entity: ''
    name: Energy
    mode: lines
    line:
      shape: spline
      width: 2
      color: blue
    x:
      - 0
      - 1
      - 2
      - 3
      - 4
      - 5
      - 6
      - 7
      - 8
    'y':
      - $ex hass.states["sensor.g0_move_energy"].state
      - $ex hass.states["sensor.g1_move_energy"].state
      - $ex hass.states["sensor.g2_move_energy"].state
      - $ex hass.states["sensor.g3_move_energy"].state
      - $ex hass.states["sensor.g4_move_energy"].state
      - $ex hass.states["sensor.g5_move_energy"].state
      - $ex hass.states["sensor.g6_move_energy"].state
      - $ex hass.states["sensor.g7_move_energy"].state
      - $ex hass.states["sensor.g8_move_energy"].state
raw_plotly_config: true

Still Energy Chart:

type: custom:plotly-graph
title: Still Energy
refresh_interval: 1
hours_to_show: current_day
layout:
  height: 350
  margin:
    l: 50
    r: 50
    t: 50
    b: 50
  showlegend: true
  legend:
    x: 0.3
    'y': -0.3
  xaxis:
    dtick: 1
    type: number
    fixedrange: true
    range:
      - 0
      - 8
  yaxis:
    dtick: 10
    fixedrange: true
    range:
      - 0
      - 100
entities:
  - entity: ''
    name: Threshold
    mode: lines
    line:
      shape: spline
      width: 2
      color: FB239F
    x:
      - 0
      - 1
      - 2
      - 3
      - 4
      - 5
      - 6
      - 7
      - 8
    'y':
      - $ex hass.states["number.g0_still_threshold"].state
      - $ex hass.states["number.g1_still_threshold"].state
      - $ex hass.states["number.g2_still_threshold"].state
      - $ex hass.states["number.g3_still_threshold"].state
      - $ex hass.states["number.g4_still_threshold"].state
      - $ex hass.states["number.g5_still_threshold"].state
      - $ex hass.states["number.g6_still_threshold"].state
      - $ex hass.states["number.g7_still_threshold"].state
      - $ex hass.states["number.g8_still_threshold"].state
  - entity: ''
    name: Energy
    mode: lines
    line:
      shape: spline
      width: 2
      color: blue
    x:
      - 0
      - 1
      - 2
      - 3
      - 4
      - 5
      - 6
      - 7
      - 8
    'y':
      - $ex hass.states["sensor.g0_still_energy"].state
      - $ex hass.states["sensor.g1_still_energy"].state
      - $ex hass.states["sensor.g2_still_energy"].state
      - $ex hass.states["sensor.g3_still_energy"].state
      - $ex hass.states["sensor.g4_still_energy"].state
      - $ex hass.states["sensor.g5_still_energy"].state
      - $ex hass.states["sensor.g6_still_energy"].state
      - $ex hass.states["sensor.g7_still_energy"].state
      - $ex hass.states["sensor.g8_still_energy"].state
raw_plotly_config: true

LD2410-Energy-Chart-Plotly

7 Likes

Sure

You need to install Bar card from HACS

Here’s the code, you will also need to change it to your entities’ names!

Move energy graph

type: custom:bar-card
title: Move Energy
direction: up
columns: 9
height: 150px
width: 100%
positions:
  icon: 'off'
  indicator: 'off'
  value: none
entities:
  - entity: sensor.g1_move_energy
    target: '50'
    limit_value: true
    complementary: true
    name: '0.75'
  - entity: sensor.g2_move_energy
    target: '40'
    limit_value: true
    complementary: true
    name: '1.5'
  - entity: sensor.g3_move_energy
    target: '30'
    limit_value: true
    complementary: true
    name: '2.25'
  - entity: sensor.g4_move_energy
    target: '20'
    limit_value: true
    complementary: true
    name: '3'
  - entity: sensor.g5_move_energy
    target: '15'
    limit_value: true
    complementary: true
    name: '3.75'
  - entity: sensor.g6_move_energy
    target: '15'
    limit_value: true
    complementary: true
    name: '4.5'
  - entity: sensor.g7_move_energy
    target: '15'
    limit_value: true
    complementary: true
    name: '5.25'
  - entity: sensor.g8_move_energy
    target: '15'
    limit_value: true
    complementary: true
    name: '6'

Still energy graph

type: custom:bar-card
title: Still Energy
direction: up
columns: 8
height: 150px
width: 100%
positions:
  icon: 'off'
  name: none
  indicator: 'off'
  value: none
entities:
  - entity: sensor.g1_still_energy
    target: '0'
    limit_value: true
    complementary: true
  - entity: sensor.g2_still_energy
    target: '15'
    limit_value: true
    complementary: true
  - entity: sensor.g3_still_energy
    target: '15'
    limit_value: true
    complementary: true
  - entity: sensor.g4_still_energy
    target: '15'
    limit_value: true
    complementary: true
  - entity: sensor.g5_still_energy
    target: '30'
    limit_value: true
    complementary: true
  - entity: sensor.g6_still_energy
    target: '20'
    limit_value: true
    complementary: true
  - entity: sensor.g7_still_energy
    target: '20'
    limit_value: true
    complementary: true
  - entity: sensor.g8_still_energy
    target: '20'
    limit_value: true
    complementary: true

Rest of the panel

type: vertical-stack
cards:
  - type: horizontal-stack
    cards:
      - type: entities
        entities:
          - entity: switch.engineering_mode
            name: Eng Mode
        show_header_toggle: false
      - type: entities
        entities:
          - entity: switch.control_bluetooth
            name: BT
        show_header_toggle: false
  - type: vertical-stack
    cards:
      - type: entities
        entities:
          - entity: number.timeout
            name: timeout
          - entity: number.max_move_distance_gate
            name: max move distance gate
          - entity: number.max_still_distance_gate
            name: max still distance gate
      - type: horizontal-stack
        cards:
          - type: entity
            entity: sensor.distance_detection_cm
            name: distance
          - type: entity
            entity: sensor.moving_distance_cm
            name: move
          - type: entity
            entity: sensor.still_distance_cm
            name: still
  - type: horizontal-stack
    cards:
      - type: entity
        entity: sensor.move_energy
        name: move energy
      - type: entity
        entity: sensor.still_energy
        name: still energy
  - type: horizontal-stack
    cards:
      - type: entity
        entity: binary_sensor.presence
        name: presence
        state_color: true
      - type: entity
        entity: binary_sensor.movement
        name: movement
        state_color: true
      - type: entity
        entity: binary_sensor.still
        name: still
        state_color: true
  - type: conditional
    conditions:
      - entity: switch.engineering_mode
        state: 'on'
    card:
      type: vertical-stack
      cards:
        - type: horizontal-stack
          cards:
            - type: entity
              entity: sensor.g1_move_energy
              name: g1
              icon: ' '
            - type: entity
              entity: number.g1_move_threshold
              name: ' '
              icon: ' '
            - type: entity
              entity: sensor.g1_still_energy
              name: ' '
              icon: ' '
            - type: entity
              entity: number.g1_still_threshold
              name: ' '
              icon: ' '
        - type: horizontal-stack
          cards:
            - type: entity
              entity: sensor.g2_move_energy
              name: g2
              icon: ' '
            - type: entity
              entity: number.g2_move_threshold
              name: ' '
              icon: ' '
            - type: entity
              entity: sensor.g2_still_energy
              name: ' '
              icon: ' '
            - type: entity
              entity: number.g2_still_threshold
              name: ' '
              icon: ' '
        - type: horizontal-stack
          cards:
            - type: entity
              entity: sensor.g3_move_energy
              name: g3
              icon: ' '
            - type: entity
              entity: number.g3_move_threshold
              name: ' '
              icon: ' '
            - type: entity
              entity: sensor.g3_still_energy
              name: ' '
              icon: ' '
            - type: entity
              entity: number.g3_still_threshold
              name: ' '
              icon: ' '
        - type: horizontal-stack
          cards:
            - type: entity
              entity: sensor.g4_move_energy
              name: g4
              icon: ' '
            - type: entity
              entity: number.g4_move_threshold
              name: ' '
              icon: ' '
            - type: entity
              entity: sensor.g4_still_energy
              name: ' '
              icon: ' '
            - type: entity
              entity: number.g4_still_threshold
              name: ' '
              icon: ' '
        - type: horizontal-stack
          cards:
            - type: entity
              entity: sensor.g5_move_energy
              name: g5
              icon: ' '
            - type: entity
              entity: number.g5_move_threshold
              name: ' '
              icon: ' '
            - type: entity
              entity: sensor.g5_still_energy
              name: ' '
              icon: ' '
            - type: entity
              entity: number.g5_still_threshold
              name: ' '
              icon: ' '
        - type: horizontal-stack
          cards:
            - type: entity
              entity: sensor.g6_move_energy
              name: g6
              icon: ' '
            - type: entity
              entity: number.g6_move_threshold
              name: ' '
              icon: ' '
            - type: entity
              entity: sensor.g6_still_energy
              name: ' '
              icon: ' '
            - type: entity
              entity: number.g6_still_threshold
              name: ' '
              icon: ' '
        - type: horizontal-stack
          cards:
            - type: entity
              entity: sensor.g7_move_energy
              name: g7
              icon: ' '
            - type: entity
              entity: number.g7_move_threshold
              name: ' '
              icon: ' '
            - type: entity
              entity: sensor.g7_still_energy
              name: ' '
              icon: ' '
            - type: entity
              entity: number.g7_still_threshold
              name: ' '
              icon: ' '
        - type: horizontal-stack
          cards:
            - type: entity
              entity: sensor.g8_move_energy
              name: g8
              icon: ' '
            - type: entity
              entity: number.g8_move_threshold
              name: ' '
              icon: ' '
            - type: entity
              entity: sensor.g8_still_energy
              name: ' '
              icon: ' '
            - type: entity
              entity: number.g8_still_threshold
              name: ' '
              icon: ' '

1 Like

Software repo?

Hardware repo?

(This is an open source community)

1 Like

Cross posting. I’ve modelled up a case for the ESP32 C3 Mini and LD2410C.

I have arranged them side by side using Layout Card.

2_3333

Here is the code:

type: custom:layout-card
layout_type: custom:grid-layout
cards:
  - type: custom:layout-card
    layout_type: custom:grid-layout
    layout:
      margin: 30px -70px 120px 0px
    cards:
      - type: grid
        title: Garage
        cards:
          - type: custom:plotly-graph
            title: Movement Energy
            refresh_interval: 1
            hours_to_show: current_day
            layout:
              height: 250
              margin:
                l: 40
                r: 20
                t: 10
                b: 0
              showlegend: true
              legend:
                x: 0.3
                'y': -0.4
              xaxis:
                dtick: 1
                type: number
                fixedrange: true
                range:
                  - 0
                  - 8
              yaxis:
                dtick: 10
                fixedrange: true
                range:
                  - 0
                  - 100
            entities:
              - entity: ''
                name: Threshold
                mode: lines
                line:
                  shape: spline
                  width: 2
                  color: FB239F
                x:
                  - 0
                  - 1
                  - 2
                  - 3
                  - 4
                  - 5
                  - 6
                  - 7
                  - 8
                'y':
                  - $ex hass.states["number.alarm_gf_g0_move_threshold"].state
                  - $ex hass.states["number.alarm_gf_g1_move_threshold"].state
                  - $ex hass.states["number.alarm_gf_g2_move_threshold"].state
                  - $ex hass.states["number.alarm_gf_g3_move_threshold"].state
                  - $ex hass.states["number.alarm_gf_g4_move_threshold"].state
                  - $ex hass.states["number.alarm_gf_g5_move_threshold"].state
                  - $ex hass.states["number.alarm_gf_g6_move_threshold"].state
                  - $ex hass.states["number.alarm_gf_g7_move_threshold"].state
                  - $ex hass.states["number.alarm_gf_g8_move_threshold"].state
              - entity: ''
                name: Energy
                mode: lines
                line:
                  shape: spline
                  width: 2
                  color: blue
                x:
                  - 0
                  - 1
                  - 2
                  - 3
                  - 4
                  - 5
                  - 6
                  - 7
                  - 8
                'y':
                  - $ex hass.states["sensor.alarm_gf_g0_move_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g1_move_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g2_move_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g3_move_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g4_move_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g5_move_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g6_move_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g7_move_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g8_move_energy"].state
            raw_plotly_config: true
          - type: custom:plotly-graph
            title: Still Energy
            refresh_interval: 1
            hours_to_show: current_day
            layout:
              height: 250
              margin:
                l: 40
                r: 20
                t: 10
                b: 0
              showlegend: true
              legend:
                x: 0.3
                'y': -0.4
              xaxis:
                dtick: 1
                type: number
                fixedrange: true
                range:
                  - 0
                  - 8
              yaxis:
                dtick: 10
                fixedrange: true
                range:
                  - 0
                  - 100
            entities:
              - entity: ''
                name: Threshold
                mode: lines
                line:
                  shape: spline
                  width: 2
                  color: FB239F
                x:
                  - 0
                  - 1
                  - 2
                  - 3
                  - 4
                  - 5
                  - 6
                  - 7
                  - 8
                'y':
                  - $ex hass.states["number.alarm_gf_g0_still_threshold"].state
                  - $ex hass.states["number.alarm_gf_g1_still_threshold"].state
                  - $ex hass.states["number.alarm_gf_g2_still_threshold"].state
                  - $ex hass.states["number.alarm_gf_g3_still_threshold"].state
                  - $ex hass.states["number.alarm_gf_g4_still_threshold"].state
                  - $ex hass.states["number.alarm_gf_g5_still_threshold"].state
                  - $ex hass.states["number.alarm_gf_g6_still_threshold"].state
                  - $ex hass.states["number.alarm_gf_g7_still_threshold"].state
                  - $ex hass.states["number.alarm_gf_g8_still_threshold"].state
              - entity: ''
                name: Energy
                mode: lines
                line:
                  shape: spline
                  width: 2
                  color: blue
                x:
                  - 0
                  - 1
                  - 2
                  - 3
                  - 4
                  - 5
                  - 6
                  - 7
                  - 8
                'y':
                  - $ex hass.states["sensor.alarm_gf_g0_still_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g1_still_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g2_still_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g3_still_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g4_still_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g5_still_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g6_still_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g7_still_energy"].state
                  - $ex hass.states["sensor.alarm_gf_g8_still_energy"].state
            raw_plotly_config: true
layout:
  grid-template-columns: 130% 130%
  grid-template-rows: 20%
  margin: '-55px -5px -150px -5px'

3 Likes

I would suggest only using the Plotly graphs for configuration on a separate dashboard so its not loaded normally. It does a refresh every second so it would be consuming a fair amount of resources as it is a close to real time graph.

1 Like

Sorry i spoke soon. Plotly graph was lagging only because i set up refresh_interval to 0.1 instead of 1.

1 Like

Thanks for this @jcastro

I’ve adapted your work to use custom:config-template-card, so I can template the Target values.
This way, when I change the threshold values at the MMW sensor, it will reflect to the limit at the bar

type: custom:config-template-card
variables:
  g0MT: states['number.mw_hallway_g0_move_threshold'].state
  g1MT: states['number.mw_hallway_g1_move_threshold'].state
  g2MT: states['number.mw_hallway_g2_move_threshold'].state
  g3MT: states['number.mw_hallway_g3_move_threshold'].state
  g4MT: states['number.mw_hallway_g4_move_threshold'].state
  g5MT: states['number.mw_hallway_g5_move_threshold'].state
  g6MT: states['number.mw_hallway_g6_move_threshold'].state
  g7MT: states['number.mw_hallway_g7_move_threshold'].state
  g8MT: states['number.mw_hallway_g8_move_threshold'].state
entities:
  - sensor.mw_hallway_g0_move_energy
  - sensor.mw_hallway_g1_move_energy
  - sensor.mw_hallway_g2_move_energy
  - sensor.mw_hallway_g3_move_energy
  - sensor.mw_hallway_g4_move_energy
  - sensor.mw_hallway_g5_move_energy
  - sensor.mw_hallway_g6_move_energy
  - sensor.mw_hallway_g7_move_energy
  - sensor.mw_hallway_g8_move_energy
  - number.mw_hallway_g0_move_threshold
  - number.mw_hallway_g1_move_threshold
  - number.mw_hallway_g2_move_threshold
  - number.mw_hallway_g3_move_threshold
  - number.mw_hallway_g4_move_threshold
  - number.mw_hallway_g5_move_threshold
  - number.mw_hallway_g6_move_threshold
  - number.mw_hallway_g7_move_threshold
  - number.mw_hallway_g8_move_threshold
card:
  type: custom:bar-card
  title: Corridor Move Energy
  direction: up
  columns: 9
  height: 150px
  width: 100%
  positions:
    icon: 'off'
    indicator: 'off'
    value: none
  entities:
    - entity: sensor.mw_hallway_g0_move_energy
      target: ${g0MT}
      limit_value: true
      complementary: true
      name: g0
    - entity: sensor.mw_hallway_g1_move_energy
      target: ${g1MT}
      limit_value: true
      complementary: true
      name: g1
    - entity: sensor.mw_hallway_g3_move_energy
      target: ${g2MT}
      limit_value: true
      complementary: true
      name: g2
    - entity: sensor.mw_hallway_g3_move_energy
      target: ${g3MT}
      limit_value: true
      complementary: true
      name: g3
    - entity: sensor.mw_hallway_g4_move_energy
      target: ${g4MT}
      limit_value: true
      complementary: true
      name: g4
    - entity: sensor.mw_hallway_g5_move_energy
      target: ${g5MT}
      limit_value: true
      complementary: true
      name: g5
    - entity: sensor.mw_hallway_g6_move_energy
      target: ${g6MT}
      limit_value: true
      complementary: true
      name: g6
    - entity: sensor.mw_hallway_g7_move_energy
      target: ${g7MT}
      limit_value: true
      complementary: true
      name: g7
    - entity: sensor.mw_hallway_g8_move_energy
      target: ${g8MT}
      limit_value: true
      complementary: true
      name: g8
5 Likes

Ohhh this is nice! I actually was looking at a way to do this. Thanks for sharing!

Been looking for this info! Thanks man! Knowing 100 is no detect really helps! Phew…lol

I was in the process of setting up another LD2410 sensor and happened to see this post regarding the ble and non ble vers.

BLE version: HLK-LD2410B
Non BLE version: HLK-LD2410-V1.3

Below is my sensor. I have the BLE antenna; however, the label imprint says I have the non ble version.
Also, what pin for a esp8266 d1 mini board to use for the output?

How’s the WiFi signal on this ESP32 board?

I haven’t had any issues but I also have extremely dense wifi coverage so YMMV.

1 Like

Here’s a comparison between the C3 and an S2 Mini.

C3:

S2:

Got it, thanks for sharing!

Thanks @koldogut for your insight on Espresense with ld2410.

May I ask any of you with experience with Espesense with ld2410… one question about “output” pin on ld2410? You get “moving” or “motionless” or both?
I get only moving… like PIR sensor then… :frowning_face:

Thank you!

PS: I’m not keen on sensors so I beg your pardon for such noob question…wiring - I connected power and ground to esp32 and then out pin to GPIO2, then selected in GUI of Espresense under GPIO (and radar sensor) pin - > 2 and Pullup. Is there any other way to get motion / occupied into Espresense and HA?
I tried to decypher this line in docs since I’m not keen on electronics…

To use these devices with ESPresense, we connect the power and ground and the ‘Occupied’ pin with a high value of occupied and a low value of unoccupied.

Can someone help me with this …‘Occupied’ pin with a high value of occupied and a low value of unoccupied?

EDIT: is it possible to select 2 pins in GUI of Espresense?

Hi All,

I am getting following error, tried everything but not able to figure out why it keeps failing. Any help will be appreciated. Thank you:

Wrote 972912 bytes (634945 compressed) at 0x00010000 in 14.5 seconds (effective 536.6 kbit/s)...
Hash of data verified.
Compressed 17440 bytes to 12128...
Wrote 17440 bytes (12128 compressed) at 0x00001000 in 0.4 seconds (effective 355.6 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 144...
Wrote 3072 bytes (144 compressed) at 0x00008000 in 0.0 seconds (effective 1056.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 1647.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB1 with baud rate 115200
[09:47:38][I][logger:268]: Log initialized
[09:47:38][C][ota:473]: There have been 0 suspected unsuccessful boot attempts.
[09:47:38][D][esp32.preferences:114]: Saving 1 preferences to flash...
[09:47:38][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[09:47:38][I][app:029]: Running through setup()...
[09:47:38][C][uart.arduino_esp32:077]: Setting up UART...
[09:47:38][C][ld2410:081]: Setting up LD2410...
[09:47:39][D][select:015]: 'Baud Rate': Sending state 256000 (index 6)
[09:47:39][C][ld2410:083]: Mac Address : 
[09:47:39][C][ld2410:084]: Firmware Version : 
[09:47:39][C][ld2410:085]: LD2410 setup complete.
[09:47:39][C][wifi:038]: Setting up WiFi...
[09:47:39][C][wifi:051]: Starting WiFi...
[09:47:39][C][wifi:052]:   Local MAC: B0:A7:32:28:6E:A0
[09:47:39][D][wifi:428]: Starting scan...
**[09:47:39][E][ld2410:336]: Error with last command : incorrect Header**
[09:47:39][D][text_sensor:064]: 'Presence Sensor Version': Sending state '1.07.22091516'
[09:47:39][D][text_sensor:064]: 'Presence Sensor MAC Address': Sending state 'A5:01:61:C9:5C:4B'
[09:47:39][D][switch:055]: 'Control Bluetooth': Sending state ON

Here is ESPHome Code:

esphome:
  name: bathroom-presence
  friendly_name: bathroom-presence

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "**********"

ota:
  password: "**********"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Bathroom-Presence"
    password: "**********"

captive_portal:

ld2410:
  uart_id: ld2410_uart
  throttle: 1500ms
  id: ld2410_comp

binary_sensor:
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target
    out_pin_presence_status:
      name: out pin presence status

sensor:
  - platform: ld2410
    light:
      name: Light
    moving_distance:
      name : "Moving distance (cm)"
    still_distance:
      name: "Still Distance (cm)"
    moving_energy:
      name: "Move Energy (%)"
    still_energy:
      name: "Still Energy (%)"
    detection_distance:
      name: "Distance Detection (cm)"
    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

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

button:
  - platform: ld2410
    factory_reset:
      name: "Factory Reset"
    restart:
      name: Restart
    query_params:
      name: "Query Params"

text_sensor:
  - platform: ld2410
    version:
      name: "Presence Sensor Version"
    mac_address:
      name: "Presence Sensor MAC Address"

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

uart:
  id: ld2410_uart
  tx_pin: 17
  rx_pin: 16
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

switch:
  - platform: ld2410
    engineering_mode:
      name: "Engineering Mode"
    bluetooth:
      name: "Control Bluetooth"



Which ESP board are you using?