substitutions:
  devicename: ld2420
  upper_devicename: "Hi-Link LD2420"

esphome:
  name: ${devicename}
  comment: ${upper_devicename}
  
web_server:
  port: 80  

esp32:
  board: esp32dev

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
#  reboot_timeout: 0s
  ap:
    password: "admin1234"
    ap_timeout: 30s

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_key # XXX

ota:
  platform: esphome
uart:
  - id: ld2420_uart
    tx_pin:  GPIO17
    rx_pin:  GPIO16
    baud_rate: 115200
    parity: NONE
    stop_bits: 1

# LD2420 definition
ld2420:
  uart_id: ld2420_uart
  id: ld2420_sensor
  #throttle: 1000ms  

text_sensor:
  - platform: ld2420
    fw_version:
      name: LD2420 Firmware

sensor:
  - platform: ld2420
    moving_distance:
      name : Moving Distance

binary_sensor:
  - platform: ld2420
    has_target:
      name: Presence

select:
  - platform: ld2420
    operating_mode:
      name: Operating Mode

number:
  - platform: ld2420
    presence_timeout:
      name: Detection Presence Timeout
    min_gate_distance:
      name: Detection Gate Minimum
    max_gate_distance:
      name: Detection Gate Maximum
    # See "Number" section below for detail
    gate_select:
      name: Select Gate to Set
    still_threshold:
      name: Set Still Threshold Value
    move_threshold:
      name: Set Move Threshold Value

button:
  - platform: ld2420
    apply_config:
      name: Apply Config
    factory_reset:
      name: Factory Reset
    restart_module:
      name: Restart Module
    revert_config:
      name: Undo Edits