Skip to content

Instantly share code, notes, and snippets.

@Onefabis
Created January 19, 2024 20:44
Show Gist options
  • Save Onefabis/cd198c694a80801d0e5104d0f76e6221 to your computer and use it in GitHub Desktop.
Save Onefabis/cd198c694a80801d0e5104d0f76e6221 to your computer and use it in GitHub Desktop.
substitutions:
devicename: ld2450
upper_devicename: "Hi-Link LD2450"
esphome:
name: wd-presense
friendly_name: wd_presense
includes:
- ld2450_uart.h
esp32:
board: esp32dev
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "############### entere api key here ##############"
ota:
password: "########## enter ota password here or delete it ##########"
wifi:
ssid: ###### your wifi name here #####
password: ###### your wifi password here ######
captive_portal:
uart:
id: uart_ld2450
tx_pin: TX
rx_pin: RX
baud_rate: 256000
parity: NONE
stop_bits: 1
# debug:
# direction: BOTH
# dummy_receiver: false
custom_component:
- lambda: |-
return {new LD2450(id(uart_ld2450))};
components:
- id: ld2450
sensor:
- platform: custom
lambda: |-
auto uart_component = static_cast<LD2450 *>(ld2450);
return {uart_component->target1Resolution, uart_component->target1Speed, uart_component->target1X, uart_component->target1Y,
uart_component->target2Resolution, uart_component->target2Speed, uart_component->target2X, uart_component->target2Y,
uart_component->target3Resolution, uart_component->target3Speed, uart_component->target3X, uart_component->target3Y,
};
sensors:
- name: "Target1 Resolution"
unit_of_measurement: "nm"
accuracy_decimals: 0
icon: mdi:artboard
- name: "Target1 Speed"
unit_of_measurement: "cm/s"
accuracy_decimals: 0
icon: mdi:speedometer
- name: "Target1 X"
unit_of_measurement: "cm"
accuracy_decimals: 0
icon: mdi:map-marker-right
- name: "Target1 Y"
unit_of_measurement: "cm"
accuracy_decimals: 0
icon: mdi:map-marker-down
- name: "Target2 Resolution"
unit_of_measurement: "nm"
accuracy_decimals: 0
icon: mdi:artboard
- name: "Target2 Speed"
unit_of_measurement: "cm/s"
accuracy_decimals: 0
icon: mdi:speedometer
- name: "Target2 X"
unit_of_measurement: "cm"
accuracy_decimals: 0
icon: mdi:map-marker-right
- name: "Target2 Y"
unit_of_measurement: "cm"
accuracy_decimals: 0
icon: mdi:map-marker-down
- name: "Target3 Resolution"
unit_of_measurement: "nm"
accuracy_decimals: 0
icon: mdi:artboard
- name: "Target3 Speed"
unit_of_measurement: "cm/s"
accuracy_decimals: 0
icon: mdi:speedometer
- name: "Target3 X"
unit_of_measurement: "cm"
accuracy_decimals: 0
icon: mdi:map-marker-right
- name: "Target3 Y"
unit_of_measurement: "cm"
accuracy_decimals: 0
icon: mdi:map-marker-down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment