Skip to content

Instantly share code, notes, and snippets.

@amcfague
Last active January 23, 2025 15:23
Show Gist options
  • Save amcfague/2cebeaf2076ce16d4dad5143a97971d1 to your computer and use it in GitHub Desktop.
Save amcfague/2cebeaf2076ce16d4dad5143a97971d1 to your computer and use it in GitHub Desktop.
substitutions:
friendly_name: Screek Human Presence Sensor 2A
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
esphome:
name: screek-human-sensor-2a
friendly_name: ${friendly_name}
name_add_mac_suffix: False
platformio_options:
board_build.flash_mode: dio
project:
name: Screek.Human_Presence_Sensor
version: 2A
external_components:
- source: github://pr#5674
components: [ ld2450 ]
refresh: 0s
preferences:
flash_write_interval: 60s
esp32:
board: lolin_c3_mini
variant: esp32c3
framework:
type: esp-idf
version: recommended
sdkconfig_options:
CONFIG_COMPILER_OPTIMIZATION_PERF: y
ota:
- platform: esphome
captive_portal:
web_server:
port: 80
time:
- platform: sntp
id: time_now
logger:
uart:
id: uart_ld2450
tx_pin:
number: 5
mode:
input: true
pullup: true
rx_pin:
number: 4
mode:
input: true
pullup: true
baud_rate: 256000
parity: NONE
stop_bits: 1
data_bits: 8
i2c:
sda: GPIO7
scl: GPIO11
scan: true
id: bus_a
ld2450:
id: ld2450_radar
uart_id: uart_ld2450
throttle: 100ms
binary_sensor:
- platform: ld2450
ld2450_id: ld2450_radar
has_target:
name: Presence
has_moving_target:
name: Moving Target
has_still_target:
name: Still Target
number:
- platform: ld2450
ld2450_id: ld2450_radar
presence_timeout:
name: "Timeout"
zone_1:
x1:
name: Zone1 X-Begin
mode: box
y1:
name: Zone1 Y-Begin
mode: box
x2:
name: Zone1 X-End
mode: box
y2:
name: Zone1 Y-End
mode: box
zone_2:
x1:
name: Zone2 X-Begin
mode: box
y1:
name: Zone2 Y-Begin
mode: box
x2:
name: Zone2 X-End
mode: box
y2:
name: Zone2 Y-End
mode: box
zone_3:
x1:
name: Zone3 X-Begin
mode: box
y1:
name: Zone3 Y-Begin
mode: box
x2:
name: Zone3 X-End
mode: box
y2:
name: Zone3 Y-End
mode: box
switch:
- platform: ld2450
ld2450_id: ld2450_radar
bluetooth:
name: "Bluetooth"
multi_target:
name: "Multi Target Tracking"
select:
- platform: ld2450
ld2450_id: ld2450_radar
zone_type:
name: "Zone Type"
button:
- platform: ld2450
ld2450_id: ld2450_radar
factory_reset:
name: "LD2450 Factory Reset"
entity_category: "config"
restart:
name: "LD2450 Restart"
entity_category: "config"
text_sensor:
- platform: ld2450
ld2450_id: ld2450_radar
version:
name: "LD2450 Firmware"
mac_address:
name: "LD2450 BT MAC"
target_1:
direction:
name: "Target1 Direction"
target_2:
direction:
name: "Target2 Direction"
target_3:
direction:
name: "Target3 Direction"
sensor:
- platform: ld2450
ld2450_id: ld2450_radar
target_count:
name: Presence Target Count
still_target_count:
name: Still Target Count
moving_target_count:
name: Moving Target Count
target_1:
x:
name: Target1 X
y:
name: Target1 Y
speed:
name: Target1 Speed
angle:
name: Target1 Angle
distance:
name: Target1 Distance
resolution:
name: Target1 Resolution
target_2:
x:
name: Target-2 X
y:
name: Target-2 Y
speed:
name: Target-2 Speed
angle:
name: Target-2 Angle
distance:
name: Target-2 Distance
resolution:
name: Target-2 Resolution
target_3:
x:
name: Target3 X
y:
name: Target3 Y
speed:
name: Target3 Speed
angle:
name: Target3 Angle
distance:
name: Target3 Distance
resolution:
name: Target3 Resolution
zone_1:
target_count:
name: Zone1 All Target Count
still_target_count:
name: Zone1 Still Target Count
moving_target_count:
name: Zone1 Moving Target Count
zone_2:
target_count:
name: Zone2 All Target Count
still_target_count:
name: Zone2 Still Target Count
moving_target_count:
name: Zone2 Moving Target Count
zone_3:
target_count:
name: Zone3 All Target Count
still_target_count:
name: Zone3 Still Target Count
moving_target_count:
name: Zone3 Moving Target Count
- platform: bh1750
name: "Illuminance"
accuracy_decimals: 1
id: bh1750_light
update_interval: 1s
force_update: true
@klkohl
Copy link

klkohl commented Oct 22, 2024

I'm not seeing entities in Home Assistant. I can see the device. Using Visit on the device page takes me to the device webpage and everything appears to be fine there. If I try to look at the logs wirelessly, I get the following:

INFO ESPHome 2024.10.1
INFO Reading configuration /config/esphome/screek.yaml...
INFO Updating https://github.com/esphome/esphome.git@pull/5674/head
INFO Detected timezone 'America/Los_Angeles'
ERROR No remote or local logging method configured (api/mqtt/logger)

Any idea what might be wrong?

@klkohl
Copy link

klkohl commented Oct 22, 2024

Never mind. I added

api:

to the yaml and everything appears to be working.

@amcfague
Copy link
Author

amcfague commented Oct 22, 2024

EDIT: nevermind, you fixed it!

ERROR No remote or local logging method configured (api/mqtt/logger)

If you're using this with Home Assistant, it's likely you don't have an api: config specified. You will need to put your specific encryption key, i.e.:

api:
  encryption:
    key: "blah"

@klkohl
Copy link

klkohl commented Oct 22, 2024

New issue. Zones aren't registering. I can see Target X and Y and I defined the zones, but the Zone Target Count isn't showing anything for any of the Zones.

Also, I'm not sure what the Zone Type should be set to (Disabled, Detection, Filtered). Where would I find documentation that spells this out?

@klkohl
Copy link

klkohl commented Oct 22, 2024

Never mind again. I just realized that the Target X and Y are inches and that the Zones are defined in mm. I did the conversion and it appears to be working. Sorry to keep bothering you.

@amcfague
Copy link
Author

Never mind again. I just realized that the Target X and Y are inches and that the Zones are defined in mm. I did the conversion and it appears to be working. Sorry to keep bothering you.

haha, it's no worries--I'm sure someone else will have the same question eventually!

@KTibow
Copy link

KTibow commented Dec 13, 2024

This is great. However, compared to the stock firmware, it sometimes randomly reboots and doesn't seem to have as much range. Anyone know what's going on?

Edit: This seems mostly fixed after I pressed the factory reset button through HA

@amcfague
Copy link
Author

amcfague commented Dec 27, 2024

I updated the device using the ESPHome Builder in Home Assistant and now the only sensor I see is Illuminance. All the other sensors are shown as "Unknown". Any idea what I can do to fix this?

I did notice that it's showing "Moving Target" and "Still Target" as OFF.

@klkohl Can you upload your complete xml as a paste? I am on the latest ESPHome and it is surfacing all the fields correctly.

@klkohl
Copy link

klkohl commented Dec 27, 2024

It turns out the usb cable was loose and not fully inserted in the device. I really need to remember to check the simple things first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment