Mmwave SEN0623 C1001 for esphome

Anybody has a code for the SEN0623 C1001 on a esp32 board and running esphome? I made the code bellow, I wonder if anybody have a better one using templates.

esphome:
  name: mmwave_sensor
  platform: ESP32
  board: esp32dev

wifi:
  ssid: "your_wifi_ssid"
  password: "your_wifi_password"

logger:

api:

ota:

uart:
  rx_pin: GPIO16  # Adjust according to your wiring
  tx_pin: GPIO17  # Adjust according to your wiring
  baud_rate: 115200

sensor:
  - platform: custom
    lambda: |-
      auto my_sensor = new SEN0623();
      App.register_component(my_sensor);
      return {
        my_sensor->get_distance(),
        my_sensor->get_speed(),
        my_sensor->get_output_latency(),
        my_sensor->get_sensitivity()
      };
    sensors:
      - name: "mmWave Distance"
        unit_of_measurement: "m"
        accuracy_decimals: 2
      - name: "mmWave Speed"
        unit_of_measurement: "m/s"
        accuracy_decimals: 2
      - name: "mmWave Output Latency"
        unit_of_measurement: "ms"
        accuracy_decimals: 2
      - name: "mmWave Sensitivity"
        unit_of_measurement: ""
        accuracy_decimals: 0

    update_interval: 1s

    # Parameters to configure the sensor
    output_latency: 50  # Adjust as needed
    sensitivity: 1      # Adjust as needed

1 Like