Dashboard for ESPHome + LD2410 configuration

Here’s my dashboard for configuring an LD2410-based ESPHome presence sensor. Hope you might find it useful. You might need to adjust slightly depending on your ESPHome YAML configuration.

The threshold/energy graphs are based on @athua’s post here. They require the Plotly Graph Card.

Here’s a template for the dashboard YAML (replace DEVICE with your device name):

  - type: sections
    max_columns: 4
    sections:
      - type: grid
        cards:
          - type: heading
            heading: Detection
            heading_style: title
            icon: mdi:account
            badges:
              - type: entity
                show_state: true
                show_icon: true
                entity: binary_sensor.DEVICE_presence
                name: Presence
                color: state
                state_content: name
                tap_action:
                  action: more-info
              - type: entity
                show_state: true
                show_icon: true
                entity: binary_sensor.DEVICE_moving_target
                name: Moving
                icon: mdi:run-fast
                color: state
                state_content: name
                tap_action:
                  action: more-info
              - type: entity
                show_state: true
                show_icon: true
                entity: binary_sensor.DEVICE_still_target
                name: Still
                icon: mdi:human-male
                color: state
                state_content: name
                tap_action:
                  action: more-info
          - type: history-graph
            entities:
              - entity: binary_sensor.DEVICE_presence
                name: Presence
              - entity: binary_sensor.DEVICE_moving_target
                name: Moving
              - entity: binary_sensor.DEVICE_still_target
                name: Still
            hours_to_show: 0.05
          - type: heading
            icon: mdi:cog
            heading: Configuration
            heading_style: title
          - type: tile
            entity: number.DEVICE_timeout
            features_position: inline
            vertical: false
            name: Timeout
            icon: mdi:timer
            features:
              - type: numeric-input
                style: buttons
          - features:
              - style: slider
                type: numeric-input
            type: tile
            entity: number.DEVICE_max_move_distance_gate
            features_position: inline
            vertical: false
            name: Max moving gate
            icon: mdi:gate
          - features:
              - style: slider
                type: numeric-input
            type: tile
            entity: number.DEVICE_max_still_distance_gate
            features_position: inline
            vertical: false
            name: Max still gate
            icon: mdi:gate
          - type: tile
            entity: switch.DEVICE_ld2410_engineering_mode
            features_position: bottom
            vertical: false
            name: Engineering mode
          - type: tile
            entity: button.DEVICE_ld2410_query_params
            features_position: bottom
            vertical: false
            name: Query params
            hide_state: true
        column_span: 1
      - type: grid
        cards:
          - type: heading
            icon: mdi:signal-distance-variant
            heading: Distance
            badges:
              - type: entity
                entity: select.DEVICE_distance_resolution
              - type: entity
                entity: sensor.DEVICE_detection_distance
                tap_action:
                  action: more-info
              - type: entity
                entity: sensor.DEVICE_moving_distance
                icon: mdi:run-fast
                tap_action:
                  action: more-info
              - type: entity
                entity: sensor.DEVICE_still_distance
                icon: mdi:human-male
                tap_action:
                  action: more-info
          - type: history-graph
            entities:
              - entity: sensor.DEVICE_detection_distance
                name: Detection distance
              - entity: sensor.DEVICE_moving_distance
                name: Moving distance
              - entity: sensor.DEVICE_still_distance
                name: Still distance
            hours_to_show: 0.05
          - type: heading
            icon: mdi:help
            heading_style: title
            heading: Diagnostics
          - type: tile
            entity: sensor.DEVICE_esp_temperature
            features_position: bottom
            vertical: false
            name: Internal temperature
          - type: tile
            entity: sensor.DEVICE_uptime
            features_position: bottom
            vertical: false
            name: Uptime
          - type: tile
            entity: sensor.DEVICE_wifi_rssi
            features_position: bottom
            vertical: false
            name: WiFi RSSI
      - type: grid
        cards:
          - type: heading
            heading: Moving
            heading_style: title
            icon: mdi:run-fast
            badges:
              - type: entity
                show_state: true
                show_icon: true
                entity: binary_sensor.DEVICE_moving_target
                icon: mdi:run-fast
                color: state
              - type: entity
                entity: sensor.DEVICE_moving_distance
          - type: custom:plotly-graph
            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.DEVICE_g0_move_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g1_move_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g2_move_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g3_move_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g4_move_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g5_move_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g6_move_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g7_move_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_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.DEVICE_g0_move_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g1_move_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g2_move_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g3_move_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g4_move_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g5_move_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g6_move_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g7_move_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g8_move_energy"].state
            raw_plotly_config: true
          - type: tile
            entity: number.DEVICE_g0_move_threshold
            features_position: inline
            vertical: false
            name: Gate 0 move threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g1_move_threshold
            features_position: inline
            vertical: false
            name: Gate 1 move threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g2_move_threshold
            features_position: inline
            vertical: false
            name: Gate 2 move threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g3_move_threshold
            features_position: inline
            vertical: false
            name: Gate 3 move threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g4_move_threshold
            features_position: inline
            vertical: false
            name: Gate 4 move threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g5_move_threshold
            features_position: inline
            vertical: false
            name: Gate 5 move threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g6_move_threshold
            features_position: inline
            vertical: false
            name: Gate 6 move threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g7_move_threshold
            features_position: inline
            vertical: false
            name: Gate 7 move threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g8_move_threshold
            features_position: inline
            vertical: false
            name: Gate 8 move threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: history-graph
            entities:
              - entity: sensor.DEVICE_g0_move_energy
                name: g0 move energy
              - entity: sensor.DEVICE_g1_move_energy
                name: g1 move energy
              - entity: sensor.DEVICE_g2_move_energy
                name: g2 move energy
              - entity: sensor.DEVICE_g3_move_energy
                name: g3 move energy
              - entity: sensor.DEVICE_g4_move_energy
                name: g4 move energy
              - entity: sensor.DEVICE_g5_move_energy
                name: g5 move energy
              - entity: sensor.DEVICE_g6_move_energy
                name: g6 move energy
              - entity: sensor.DEVICE_g7_move_energy
                name: g7 move energy
              - entity: sensor.DEVICE_g8_move_energy
                name: g8 move energy
            hours_to_show: 1
        visibility:
          - condition: state
            entity: switch.DEVICE_ld2410_engineering_mode
            state: 'on'
      - type: grid
        cards:
          - type: heading
            heading: Still
            heading_style: title
            icon: mdi:human-male
            badges:
              - type: entity
                show_state: true
                show_icon: true
                entity: binary_sensor.DEVICE_still_target
                color: state
                icon: mdi:human-male
              - type: entity
                entity: sensor.DEVICE_still_distance
          - type: custom:plotly-graph
            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.DEVICE_g0_still_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g1_still_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g2_still_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g3_still_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g4_still_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g5_still_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g6_still_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_g7_still_threshold"].state
                  - >-
                    $ex
                    hass.states["number.DEVICE_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.DEVICE_g0_still_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g1_still_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g2_still_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g3_still_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g4_still_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g5_still_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g6_still_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g7_still_energy"].state
                  - >-
                    $ex
                    hass.states["sensor.DEVICE_g8_still_energy"].state
            raw_plotly_config: true
          - type: tile
            entity: number.DEVICE_g0_still_threshold
            features_position: inline
            vertical: false
            name: Gate 0 still threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g1_still_threshold
            features_position: inline
            vertical: false
            name: Gate 1 still threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g2_still_threshold
            features_position: inline
            vertical: false
            name: Gate 2 still threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g3_still_threshold
            features_position: inline
            vertical: false
            name: Gate 3 still threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g4_still_threshold
            features_position: inline
            vertical: false
            name: Gate 4 still threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g5_still_threshold
            features_position: inline
            vertical: false
            name: Gate 5 still threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g6_still_threshold
            features_position: inline
            vertical: false
            name: Gate 6 still threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g7_still_threshold
            features_position: inline
            vertical: false
            name: Gate 7 still threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: tile
            entity: number.DEVICE_g8_still_threshold
            features_position: inline
            vertical: false
            name: Gate 8 still threshold
            icon: mdi:run-fast
            features:
              - style: slider
                type: numeric-input
          - type: history-graph
            entities:
              - entity: sensor.DEVICE_g0_still_energy
                name: g0 still energy
              - entity: sensor.DEVICE_g1_still_energy
                name: g1 still energy
              - entity: sensor.DEVICE_g2_still_energy
                name: g2 still energy
              - entity: sensor.DEVICE_g3_still_energy
                name: g3 still energy
              - entity: sensor.DEVICE_g4_still_energy
                name: g4 still energy
              - entity: sensor.DEVICE_g5_still_energy
                name: g5 still energy
              - entity: sensor.DEVICE_g6_still_energy
                name: g6 still energy
              - entity: sensor.DEVICE_g7_still_energy
                name: g7 still energy
              - entity: sensor.DEVICE_g8_still_energy
                name: g8 still energy
            hours_to_show: 1
        visibility:
          - condition: state
            entity: switch.DEVICE_ld2410_engineering_mode
            state: 'on'

My ESPHome YAML is based on this configuration (thanks @FriedCheese!).

2 Likes

looks great. Does the moving, still graphs update in real time like in the mobile app?

Yes, they update live. On my system they refresh approximately once per second, which is quick enough to be useful.

1 Like

Looks great! Thanks

Trying to add this to my dashboard but I’m getting errors about the yaml. Can you provide the steps to add this to a dashboard? It looks quite interesting. Thanks!

Can you be more specific about the errors you’re getting? Suspect it might be something to do with indentation, or maybe entity names (but not sure if that would prevent you from saving the dashboard).

You should be able to add the YAML as follows:

  1. Create a new dashboard tab
  2. Click the ‘Edit dashboard’ pencil icon top right
  3. Click the three dots icon top right and choose Raw configuration editor
  4. Find the dashboard tab you’ve created
  5. Paste in my YAML, taking care with the indentation

Mine is the first tab in the dashboard and the indentation looks like this i.e. the first line of my yaml has two spaces at the start.

1 Like

Thanks! I was missing the part where you need to scroll and find that particular ‘section’. I’ve got it partially working now! Just need to change all the DEVICE references.

1 Like