Skip to content

Instantly share code, notes, and snippets.

@mikesmitty
Last active April 1, 2023 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikesmitty/4047a1ffd925953ef552299a91c3b610 to your computer and use it in GitHub Desktop.
Save mikesmitty/4047a1ffd925953ef552299a91c3b610 to your computer and use it in GitHub Desktop.
Hydrated ESPHome example configs for LD2410 mmWave presence sensors
substitutions:
friendly_name: Basement Presence
name: pres01
esphome:
friendly_name: ${friendly_name}
name: ${name}
esp8266:
board: d1_mini
restore_from_flash: true
preferences:
flash_write_interval: 10min
# Enable logging
logger:
baud_rate: 0 # (Disable UART logging on the hardware UART pins)
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${name} Fallback Hotspot"
password: !secret wifi_fallback_password
# Enable Home Assistant API
api:
encryption:
key: !secret api_encryption_key
ota:
password: !secret api_password
text_sensor:
- platform: version
name: ESPHome Version
sensor:
- platform: uptime
name: Uptime
update_interval: 60s
- platform: wifi_signal
name: WiFi Signal
update_interval: 60s
icon: mdi:wifi
binary_sensor:
- platform: status
name: Status
button:
- platform: restart
id: restart_button
name: Restart
- platform: safe_mode
id: power_button
name: Restart in Safe Mode
- platform: shutdown
id: shutdown_button
name: Shutdown
uart:
# D1 Mini pin reference: https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP8266-WeMos-D1-Mini-pinout-gpio-pin.png
# Only one hardware UART is available on ESP8266 boards which is shared with the USB port.
# Wiring layout: https://community-assets.home-assistant.io/original/4X/a/1/b/a1b936a4114ba55a71098150277605e296d8fa54.jpeg
# Connect the RX pin on the LD2410 to the "TX" pin on the D1 Mini board,
# TX on the LD2410 to the D1 Mini "RX" pin,
# VCC on the LD2410 to Vin on the D1 Mini, and
# ground (GND) to ground (GND)
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 256000
parity: NONE
stop_bits: 1
binary_sensor:
- platform: ld2410
has_target:
name: Presence
has_moving_target:
name: Moving Target
has_still_target:
name: Still Target
ld2410:
# Gates:
# ld2410 sensors group distances into up to 9 "gates" that are 0.75 meters deep.
# For example, gate 0 is 0 to 0.75 meters away from the sensor, gate 1 is 0.75 to
# 1.5 meters, etc. up to gate 8 at 6 to 6.75 meters. If there is motion from a
# person between 0.75 and 1.5 meters, it will be measured against the gate 1
# energy level thresholds.
# Energy Levels
# Each gate has a measured "energy level" for moving and still objects that
# essentially measures how fast a person is moving or how much activity is in
# that gate. Energy levels are on a scale from 0-100, measured at each distance
# gate simultaneously.
# Move and Still Thresholds
# The sensor must first detect a moving object before the Still Threshold comes
# into play. Once the Move Threshold for a gate is met, the sensor will continue to
# detect presence until the "energy level" drops below both the Move and Still
# Thresholds for all gates, up to the configured max distance.
# Tuning
# The bluetooth ld2410 sensors are very helpful for tuning because you can adjust
# thresholds and read the Move and Still energy levels at all gates, compared to
# the configured threshold. The android app can be found here:
# https://community.home-assistant.io/t/ld2410-esphome-tips/477058/27
#
# First enable engineering mode, which shows energy level updates in the app more
# quickly. Then begin tuning the Move thresholds for each of the distances that
# you want to detect until you're detected at a movement speed you're happy with.
# Once that's done configure the Still thresholds of each gate to make sure you're
# reliably detected.
# Timeout
# The timeout is fairly self-explanatory. When the ld2410 stops detecting presence
# it waits the duration of the timeout before it signals no presence detected.
# A longer timeout makes the sensor more stable, but also slower to stop detecting.
# More info:
# https://esphome.io/components/sensor/ld2410.html
# https://community.home-assistant.io/t/ld2410-esphome-tips/477058
# https://peyanski.com/detect-human-presence-with-ld2410b-and-home-assistant/
# https://community.home-assistant.io/t/mmwave-wars-one-sensor-module-to-rule-them-all/453260
timeout: 5s
# Limit max sensing distance in increments of 0.75 meters, up to the max of 8 gates
max_move_distance : 6m # (8 gates) default is 4.5m (6 gates)
max_still_distance: 6m # (8 gates) default is 4.5m (6 gates)
# Each of these are the gates
g0_move_threshold: 80
g1_move_threshold: 80
g2_move_threshold: 80
g3_move_threshold: 80
g4_move_threshold: 80
g5_move_threshold: 80
g6_move_threshold: 80
g7_move_threshold: 80
g8_move_threshold: 80
g0_still_threshold: 20
g1_still_threshold: 20
g2_still_threshold: 20
g3_still_threshold: 20
g4_still_threshold: 20
g5_still_threshold: 20
g6_still_threshold: 20
g7_still_threshold: 20
g8_still_threshold: 20
substitutions:
friendly_name: Basement Presence
name: pres01
esphome:
friendly_name: ${friendly_name}
name: ${name}
esp32:
board: nodemcu-32s
variant: esp32
preferences:
flash_write_interval: 10min
# Enable logging
logger:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${name} Fallback Hotspot"
password: !secret wifi_fallback_password
# Enable Home Assistant API
api:
encryption:
key: !secret api_encryption_key
ota:
password: !secret api_password
text_sensor:
- platform: version
name: ESPHome Version
sensor:
- platform: uptime
name: Uptime
update_interval: 60s
- platform: wifi_signal
name: WiFi Signal
update_interval: 60s
icon: mdi:wifi
binary_sensor:
- platform: status
name: Status
button:
- platform: restart
id: restart_button
name: Restart
- platform: safe_mode
id: power_button
name: Restart in Safe Mode
- platform: shutdown
id: shutdown_button
name: Shutdown
uart:
# Nodemcu ESP32 pin reference: https://content.instructables.com/FOL/YWLI/JEOILQ5U/FOLYWLIJEOILQ5U.png?auto=webp&fit=bounds&frame=1&width=1024
# Connect the RX pin on the LD2410 to the TX pin on the NodeMCU ESP32 board (labeled GPIO17),
# TX on the LD2410 to the NodeMCU RX pin (labeled GPIO16),
# VCC on the LD2410 to Vin on the NodeMCU, and
# ground (GND) to ground (GND)
# https://community-assets.home-assistant.io/original/4X/9/0/6/9064de2a2f1edb56593c48f6eb3cc847a35ba8d5.jpeg
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 256000
parity: NONE
stop_bits: 1
binary_sensor:
- platform: ld2410
has_target:
name: Presence
has_moving_target:
name: Moving Target
has_still_target:
name: Still Target
ld2410:
# Gates:
# ld2410 sensors group distances into up to 9 "gates" that are 0.75 meters deep.
# For example, gate 0 is 0 to 0.75 meters away from the sensor, gate 1 is 0.75 to
# 1.5 meters, etc. up to gate 8 at 6 to 6.75 meters. If there is motion from a
# person between 0.75 and 1.5 meters, it will be measured against the gate 1
# energy level thresholds.
# Energy Levels
# Each gate has a measured "energy level" for moving and still objects that
# essentially measures how fast a person is moving or how much activity is in
# that gate. Energy levels are on a scale from 0-100, measured at each distance
# gate simultaneously.
# Move and Still Thresholds
# The sensor must first detect a moving object before the Still Threshold comes
# into play. Once the Move Threshold for a gate is met, the sensor will continue to
# detect presence until the "energy level" drops below both the Move and Still
# Thresholds for all gates, up to the configured max distance.
# Tuning
# The bluetooth ld2410 sensors are very helpful for tuning because you can adjust
# thresholds and read the Move and Still energy levels at all gates, compared to
# the configured threshold. The android app can be found here:
# https://community.home-assistant.io/t/ld2410-esphome-tips/477058/27
#
# First enable engineering mode, which shows energy level updates in the app more
# quickly. Then begin tuning the Move thresholds for each of the distances that
# you want to detect until you're detected at a movement speed you're happy with.
# Once that's done configure the Still thresholds of each gate to make sure you're
# reliably detected.
# Timeout
# The timeout is fairly self-explanatory. When the ld2410 stops detecting presence
# it waits the duration of the timeout before it signals no presence detected.
# A longer timeout makes the sensor more stable, but also slower to stop detecting.
# More info:
# https://esphome.io/components/sensor/ld2410.html
# https://community.home-assistant.io/t/ld2410-esphome-tips/477058
# https://peyanski.com/detect-human-presence-with-ld2410b-and-home-assistant/
# https://community.home-assistant.io/t/mmwave-wars-one-sensor-module-to-rule-them-all/453260
timeout: 5s
max_move_distance : 6m # (8 gates) default is 4.5m (6 gates)
max_still_distance: 6m # (8 gates) default is 4.5m (6 gates)
g0_move_threshold: 80
g1_move_threshold: 80
g2_move_threshold: 80
g3_move_threshold: 80
g4_move_threshold: 80
g5_move_threshold: 80
g6_move_threshold: 80
g7_move_threshold: 80
g8_move_threshold: 80
g0_still_threshold: 20
g1_still_threshold: 20
g2_still_threshold: 20
g3_still_threshold: 20
g4_still_threshold: 20
g5_still_threshold: 20
g6_still_threshold: 20
g7_still_threshold: 20
g8_still_threshold: 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment