LD2410 esphome tips

my question did concern interference between sensors as jcastro indicated, and yes there is indeed a problem there. Maybe the sensor signal can be modulated in the future so that this can be solved.

1 Like

Nice work, the chart looks really cool and we would like to experience it tomorrow.
It would also seem nice to have some animation effects and something close to the hi-link app.
That way there is some sort of consistency.
Maybe refer to the app’s settings when it comes to colors.

I have updated the colours in the charts to be similar to those of the HLKRadarTool app.
Also the charts do update like the app showing you the energy levels as you move about.

2 Likes

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
6 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!