TillFleisch / ESPHome-HLK-LD2450

ESPHome support for the HI-Link HLK-LD2450 millimeter wave sensor (external component) with support for custom zones using convex polygons.
MIT License
105 stars 19 forks source link

Howto install on ESPHome? #27

Closed fpibbs closed 2 months ago

fpibbs commented 2 months ago

Could seem a dumb question, but I face many problems integrating this feature on the esphome in home assistant. Could you please briefly describe?

Thanks

TillFleisch commented 2 months ago

I would first recommended getting familiar with ESPHome and how you can integrate ESPHome device into Home Assistant. Here is the official guide, which you can use to get an ESP up and running with Home Assistant.

Once you've done that you can add this repository as a custom component using:

external_components:
  - source: github://TillFleisch/ESPHome-HLK-LD2450@main

Wire up the sensor to the ESP while making sure that the EPSs RX pin is connected to the LD2450s TX pin and vice versa for the other UART line(ground to ground, 5V to 5V). Add a UART configuration to your yaml config like this and make sure you are using the correct pins for your ESP:

uart:
  id: uart_bus
  rx_pin: 
    number: GPIO16
    mode:
      input: true
      pullup: true
  tx_pin: 
    number: GPIO17
    mode:
      input: true
      pullup: true
  baud_rate: 256000
  parity: NONE
  stop_bits: 1
  data_bits: 8

Then you can proceed to add a configuration for the LD2450 sensor. The following basics config was stolen form the basic example:

LD2450:
  uart_id: uart_bus
  max_detection_distance:
    name: "Max Distance"
    initial_value: 4m
  #max_detection_distance: 1.5m
  occupancy:
    name: Occupancy

This should provide you with a single binary sensor which activates if movement is detected within the sensors field of view (limited to 4m distance). (Make sure to update the ESPs firmware, for instance using the OTA-update functionality.)

Once you've got this running, you can proceed to build a more complicated configuration based on the documentation provided within this repository.

fpibbs commented 2 months ago

It's working like a charm both in Home Assistant too... :) Thanks for this cool work!