Features Wishlist

LD2410 radar proximity

snelwegSuggested this wish Β·

I was using esphome-modular-lvgl-buttons and while it works great I found that Tessera was easier and more complete. So I want to convert all my displays (mix of CYD's and Guition's) to Tessera. For my Guition displays I mounted a LD2410 in the casing so that proximity of my hand turns the display on and the screensaver time is reset. Was rather easy to implement into esphome-modular-lvgl-buttons and works perfectly.

But I am kinda lost how to make this work in Tessera, can somebody tell me how to do it?

# Substitution variables used through the codebase
substitutions:
  device_name: OfficePanel
  text_font: nunito_18
  bg_color: black
  button_on_color: "steel_blue" #"ep_orange"
  button_off_color: "very_dark_gray"
  icon_on_color: "yellow"
  icon_off_color: "gray"
  label_on_color: "white"
  label_off_color: "gray"
  screen_width: "480"
  screen_height: "480"

  # LCD back light modes - Code in backlight_time.yaml
  display_daytime_brightness: "100%"
  display_nighttime_brightness: "50%"
  display_night_hour: "22"      # Hour for night mode (0-23)
  display_night_minute: "0"    # Minute for night mode (0-59)
  display_backlight_timeout_always_enabled: "true"  # Set true to dim/off in all modes, not just Night
  display_backlight_timeout_initial: "0.1"  # Initial backlight timeout in minutes (-1 to disable)
  # defaults for popup pages
  popup_timeout_seconds: '120'  # timeout in seconds  

esphome:
  name: "guition-4848s040"
  friendly_name: "Guition 4848s040"
  comment: "Guition ESP32-S3-4848S040 480px * 480px Smart Screen"
  platformio_options:
    board_build.flash_mode: dio   # Dit is cruciaal!
  on_boot:
    - priority: 400
      then:
        - script.execute: update_loading_page
    - priority: 250
      then:
        - switch.turn_off: ld2410_bluetooth          
esp32:
  board: esp32-s3-devkitc-1
  flash_size: 16MB              # of 8MB
  framework:
    type: esp-idf

psram:
  
logger:
  level: debug


web_server:
  port: 80
  
api:
  encryption:
    key: !secret api_encryption_key

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.1.241
    gateway:   192.168.1.1
    subnet:    255.255.255.0
    dns1:      192.168.1.1
  ap:
    ssid:      !secret ap_ssid
    password: !secret ap_password
  power_save_mode: none
 
captive_portal:
  

# Time update script - This is run once per second. Use it to update any time related labels.
script:
  # --------------------------------------------------------------------------
  # This script is called once per minute.
  # Any packages in this library will !extend time_update to update their own labels.
  # You can add code here to update your own custom labels.
  # --------------------------------------------------------------------------
  - id: time_update
    then:
      - lambda: |-
          // No operation

uart:
  id: uart_ld2410
  rx_pin: GPIO2 
  tx_pin: GPIO1
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

ld2410:
  id: ld2410_radar
  uart_id: uart_ld2410

# --- Presence / target binary sensors ---
binary_sensor:
  - platform: ld2410
    has_target:
      name: "Office Panel Aanwezigheid"
      id: ld2410_presence
      device_class: presence
      on_press:
        - then:
            - logger.log: "Beweging/Aanwezigheid gedetecteerd - Backlight AAN"
            - lvgl.resume:
            - script.execute: apply_brightness_mode
      on_release:
        - then:
            - logger.log: "Geen aanwezigheid meer - Backlight UIT"
            - light.turn_off: display_backlight
            - lvgl.pause:
                show_snow: true
    has_moving_target:
      name: "Office Panel Bewegend Doel"
    has_still_target:
      name: "Office Panel Stilstaand Doel"

packages:
  # Generic configuration for ESP32 screens
  # Include Wi-Fi support
  wifi: !include esphome-modular-lvgl-buttons/common/wifi.yaml
  # Enable OTA updates with a status screen
  ota_screen: !include esphome-modular-lvgl-buttons/common/ota.yaml
   # Some basic sensors
  sensors: !include esphome-modular-lvgl-buttons/common/sensors_base.yaml
  # Styles + Themes + Some nice basic fonts + 1000s of glyphs + all the colors
  theme:  !include esphome-modular-lvgl-buttons/common/theme/index.yaml
  # Use this theme for debugging
  #theme:  !include esphome-modular-lvgl-buttons/common/theme/index_debug.yaml  # uncomment to enable debug outlines
  # Include if your touch screen has a backlight. Also sets the time from HA
  backlight: !include esphome-modular-lvgl-buttons/common/backlight_time.yaml
  # Popup system β€” code for popup pages lives here, but the popups themselves are defined in the UI section below
  popup_system: !include esphome-modular-lvgl-buttons/ui/popup/popup_system.yaml

  # Hardware description file
  hardware: !include
    file: esphome-modular-lvgl-buttons/hardware/guition-esp32-s3-4848s040_ton.yaml
    vars:
      rotation: "0"  # set screen rotation 0, 90, 180, 270
  # Basic boot screen with ESPHome logo and device diagnostic info
  loading_screen: !include esphome-modular-lvgl-buttons/pages/loading.yaml
  # info screen - WiFi login, IP address, MAC address etc
  info_screen: !include esphome-modular-lvgl-buttons/pages/info.yaml

  # This section will add buttons and page to your screen using the ESPHome package system.
  # Each package has all the code required for the button or page (LVGL, sensors, etc)

  slaapkamer_fan: !include
    file: esphome-modular-lvgl-buttons/ui/switch/remote.yaml
    vars:
      uid: slaapkamer_fan
      entity_id: "switch.ventilator"
      row: 0
      column: 1
      text: "Ventilator"
      icon: $mdi_fan

  office_light: !include
    file: esphome-modular-lvgl-buttons/ui/switch/remote.yaml
    vars:
      uid: office_light
      entity_id: "light.draadlamp_led_licht"
      row: 1
      column: 0
      text: "Draadlamp1"
      icon: $mdi_string_lights
      
  boven_fan: !include
    file: esphome-modular-lvgl-buttons/ui/switch/remote.yaml
    vars:
      uid: boven_fan
      entity_id: "switch.ir_paneel_schakelaar"
      row: 1
      column: 1
      text: "Ventilator"
      icon: $mdi_fan
  werklicht: !include
    file: esphome-modular-lvgl-buttons/ui/switch/remote.yaml
    vars:
      uid: werklicht_light
      entity_id: "light.werklicht_ts0001"
      row: 1
      column: 2
      text: "Werklicht test"
      icon: $mdi_ceiling_light

# This is the main LVGL section. We start with a simple 4x4 grid.
lvgl:
  pages:
    - id: main_page
      layout: 3x3 # 4x4
      styles: page_style
      <<: !include esphome-modular-lvgl-buttons/common/swipe_navigation.yaml
      widgets:
        # You can use the package section above to add prebuilt button types or build your own custom button from scratch here.
        # - container:
        #     id: button_12
        #     grid_cell_x_align: stretch
        #     grid_cell_y_align: stretch
        #     grid_cell_row_pos: 3
        #     grid_cell_column_pos: 3
        #     grid_cell_row_span: 1
        #     grid_cell_column_span: 1
        #     outline_width: 1   # debug code - This is for visualizing boundaries remove for production
        #     outline_color: red  # debug code - This is for visualizing boundaries remove for production
        #     widgets:
        #       - label:
        #           text_font: $text_font
        #           align: center
        #           text_color: white
        #           text: "Cell 3,3"

# If you want to use other icons add them to the list here
font:
  # http://materialdesignicons.com/cdn/7.4.47/
  - file: 'https://github.com/Templarian/MaterialDesign-Webfont/raw/v7.4.47/fonts/materialdesignicons-webfont.ttf'
    id: mdi_icons_40
    size: 40
    bpp: 8
    glyphs: 
      - $mdi_bed  # mdi-bed - bedroom icon
      #- $mdi_white_balance_sunny,  # mdi-white-balance-sunny - color temp/sun icon
        
                  # Main dashboard icons
      - $mdi_fan
      - $mdi_weather_windy



# # --- Meetwaarden ---
sensor:
  - platform: internal_temperature
    id: cpu_temperature
    name: "CPU Temperature"    
    unit_of_measurement: "Β°C"
    icon: mdi:thermometer
    entity_category: diagnostic
  
  - platform: ld2410
    moving_distance:
      name: "Bewegende Afstand"


# --- Firmware / MAC info ---
text_sensor:
  - platform: ld2410
    version:
      name: "LD2410 Firmware Versie"
    mac_address:
      name: "LD2410 MAC Adres"

# --- Configuratie via UART (geen app/Bluetooth nodig) ---
select:
  - platform: ld2410
    distance_resolution:
      name: "Afstandsresolutie"
    baud_rate:
      name: "Baudrate"
    light_function:
      name: "Lichtfunctie"
    out_pin_level:
      name: "Out Pin Niveau"

number:
  - platform: ld2410
    timeout:
      name: "Timeout"
    light_threshold:
      name: "Lichtdrempel"
    max_move_distance_gate:
      name: "Max Bewegingsafstand Gate"
    max_still_distance_gate:
      name: "Max Stilstandsafstand Gate"

switch:
  - platform: ld2410
    engineering_mode:
      name: "Engineering Mode"
    bluetooth:
      name: "Bluetooth"
      id: ld2410_bluetooth

button:
  - platform: ld2410
    factory_reset:
      name: "Fabrieksreset"
    restart:
      name: "Herstart"
    query_params:
      name: "Parameters Opvragen"

Discussion 0

Add a comment

Start the conversation

Share an example, ask a question or explain how you would use this.

Add your thoughts, a screenshot or a useful link.

Markdown & basic HTML
Paste or drop images Β· URLs on their own line become previews0 / 10,000
Create your account to join in

We need a verified email address to reach you about your contribution. Your address stays private.

Continue with GitHub

Your draft stays in this tab. Return here after verification.