[TUTO] Esp + 2 radars + température + luxmètre + Bluetooth proxy

Hello,

On peut avoir parfois besoin de plus des 120° d’un radar LD2410C et dans ce cas la solution pour ne pas multiplier les esp reste de multiplier les radars,

le yaml complet ( tous les XXX sont à remplacer )

le code
substitutions:
  name: esp-XXX
  friendly_name: esp-XXX
packages:
  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic/esp32-generic.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: XXX

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

    # Optional manual IP
  manual_ip:
    static_ip: XXX
    gateway: XXX
    subnet: XXX

i2c:
  sda: 21
  scl: 22
  scan: true
  id: bus_a

text_sensor:
  - platform: wifi_info
    ip_address:
      name: "IP Address"
    mac_address:
      name: "MAC Address"
  - platform: version
    name: "${name}_version"
  - platform: template
    name: "Uptime (Jours, Heures et Minutes)"
    lambda: |-
      int seconds = id(uptime_sensor).state;
      int days = seconds / 86400;
      seconds = seconds % 86400;
      int hours = seconds / 3600;
      seconds = seconds % 3600;
      int minutes = seconds / 60;

      // Renvoie la chaîne formatée
      return (days > 0 ? std::to_string(days) + " jours " : "") + 
             (hours > 0 ? std::to_string(hours) + " h " : "") +
             (minutes > 0 ? std::to_string(minutes) + " min" : "0 min");
    update_interval: 60s
    entity_category: "diagnostic"  

switch:
  - platform: restart
    name: "Restart"

logger:
  level: VERY_VERBOSE

esp32_ble_tracker:
  scan_parameters:
    duration: 60s
    active: true

bluetooth_proxy:
  active: true

binary_sensor:
  - platform: ble_presence
    mac_address: XXX
    name: "XXX"
    timeout: 45s # le temps avant que ca passe en absent
    min_rssi: -80dB # permet de regler la distance de detection
    id: Mi_band_laurent    
  - platform: ble_presence
    mac_address: XXX
    name: "XXX"
    timeout: 45s # le temps avant que ca passe en absent
    min_rssi: -80dB # permet de regler la distance de detection
    id: Mi_band_papa
  - platform: status
    name: "Status_g"
  - platform: ld2410
    ld2410_id: ld2410_g
    has_target:
      name: "Radar Target G"
      id: radar_has_target_salle_manger_g
    has_moving_target:
      name: "Radar Moving Target G"
      id: radar_moving_target_salle_manger_g
    has_still_target:
      name: "Radar Still Target G"
      id: radar_still_target_salle_manger_g
  - platform: status
    name: "Status_d"
  - platform: ld2410
    ld2410_id: ld2410_d
    has_target:
      name: "Radar Target D"
      id: radar_has_target_salle_manger_d
    has_moving_target:
      name: "Radar Moving Target D"
      id: radar_moving_target_salle_manger_d
    has_still_target:
      name: "Radar Still Target D"
      id: radar_still_target_salle_manger_d

uart:
  - id: ld2410_uart_g
    tx_pin: 17
    rx_pin: 16
    baud_rate: 256000
    parity: NONE
    stop_bits: 1
  - id: ld2410_uart_d
    tx_pin: 1
    rx_pin: 3
    baud_rate: 256000
    parity: NONE
    stop_bits: 1

ld2410:
  - id: ld2410_g
    uart_id: ld2410_uart_g
    throttle: 1500ms
  - id: ld2410_d
    uart_id: ld2410_uart_d
    throttle: 1500ms

number:
  # Configuration pour le capteur gauche (G)
  - platform: ld2410
    ld2410_id: ld2410_g
    timeout:
      name: Radar Timeout G
    max_move_distance_gate:
      name: Radar Max Move Distance G
    max_still_distance_gate:
      name: Radar Max Still Distance G
    g0:
      move_threshold:
        name: g0 move threshold G
      still_threshold:
        name: g0 still threshold G
    g1:
      move_threshold:
        name: g1 move threshold G
      still_threshold:
        name: g1 still threshold G
    g2:
      move_threshold:
        name: g2 move threshold G
      still_threshold:
        name: g2 still threshold G
    g3:
      move_threshold:
        name: g3 move threshold G
      still_threshold:
        name: g3 still threshold G
    g4:
      move_threshold:
        name: g4 move threshold G
      still_threshold:
        name: g4 still threshold G
    g5:
      move_threshold:
        name: g5 move threshold G
      still_threshold:
        name: g5 still threshold G
    g6:
      move_threshold:
        name: g6 move threshold G
      still_threshold:
        name: g6 still threshold G
    g7:
      move_threshold:
        name: g7 move threshold G
      still_threshold:
        name: g7 still threshold G
    g8:
      move_threshold:
        name: g8 move threshold G
      still_threshold:
        name: g8 still threshold G

  # Configuration pour le capteur droit (D)
  - platform: ld2410
    ld2410_id: ld2410_d
    timeout:
      name: "Radar Timeout D"
    max_move_distance_gate:
      name: "Radar Max Move Distance D"
    max_still_distance_gate:
      name: "Radar Max Still Distance D"
    g0:
      move_threshold:
        name: g0 move threshold D
      still_threshold:
        name: g0 still threshold D
    g1:
      move_threshold:
        name: g1 move threshold D
      still_threshold:
        name: g1 still threshold D
    g2:
      move_threshold:
        name: g2 move threshold D
      still_threshold:
        name: g2 still threshold D
    g3:
      move_threshold:
        name: g3 move threshold D
      still_threshold:
        name: g3 still threshold D
    g4:
      move_threshold:
        name: g4 move threshold D
      still_threshold:
        name: g4 still threshold D
    g5:
      move_threshold:
        name: g5 move threshold D
      still_threshold:
        name: g5 still threshold D
    g6:
      move_threshold:
        name: g6 move threshold D
      still_threshold:
        name: g6 still threshold D
    g7:
      move_threshold:
        name: g7 move threshold D
      still_threshold:
        name: g7 still threshold D
    g8:
      move_threshold:
        name: g8 move threshold D
      still_threshold:
        name: g8 still threshold D

sensor:
  - platform: ld2410
    ld2410_id: ld2410_g
    moving_distance:
      name: "Radar Moving Distance G"
      id: moving_distance_g
    still_distance:
      name: "Radar Still Distance G"
      id: still_distance_g
    moving_energy:
      name: "Radar Move Energy G"
    still_energy:
      name: "Radar Still Energy G"
    detection_distance:
      name: "Radar Detection Distance G"
      id: radar_detection_distance_g
    g0:
      move_energy:
        name: "g0 Move Energy G"
      still_energy:
        name: "g0 Still Energy G"
    g1:
      move_energy:
        name: "g1 Move Energy G"
      still_energy:
        name: "g1 Still Energy G"
    g2:
      move_energy:
        name: "g2 Move Energy G"
      still_energy:
        name: "g2 Still Energy G"
    g3:
      move_energy:
        name: "g3 Move Energy G"
      still_energy:
        name: "g3 Still Energy G"
    g4:
      move_energy:
        name: "g4 Move Energy G"
      still_energy:
        name: "g4 Still Energy G"
    g5:
      move_energy:
        name: "g5 Move Energy G"
      still_energy:
        name: "g5 Still Energy G"
    g6:
      move_energy:
        name: "g6 Move Energy G"
      still_energy:
        name: "g6 Still Energy G"
    g7:
      move_energy:
        name: "g7 Move Energy G"
      still_energy:
        name: "g7 Still Energy G"
    g8:
      move_energy:
        name: "g8 Move Energy G"
      still_energy:
        name: "g8 Still Energy G"

  - platform: ld2410
    ld2410_id: ld2410_d
    moving_distance:
      name: "Radar Moving Distance D"
      id: moving_distance_d
    still_distance:
      name: "Radar Still Distance D"
      id: still_distance_d
    moving_energy:
      name: "Radar Move Energy D"
    still_energy:
      name: "Radar Still Energy D"
    detection_distance:
      name: "Radar Detection Distance D"
      id: radar_detection_distance_d
    g0:
      move_energy:
        name: "g0 Move Energy D"
      still_energy:
        name: "g0 Still Energy D"
    g1:
      move_energy:
        name: "g1 Move Energy D"
      still_energy:
        name: "g1 Still Energy D"
    g2:
      move_energy:
        name: "g2 Move Energy D"
      still_energy:
        name: "g2 Still Energy D"
    g3:
      move_energy:
        name: "g3 Move Energy D"
      still_energy:
        name: "g3 Still Energy D"
    g4:
      move_energy:
        name: "g4 Move Energy D"
      still_energy:
        name: "g4 Still Energy D"
    g5:
      move_energy:
        name: "g5 Move Energy D"
      still_energy:
        name: "g5 Still Energy D"
    g6:
      move_energy:
        name: "g6 Move Energy D"
      still_energy:
        name: "g6 Still Energy D"
    g7:
      move_energy:
        name: "g7 Move Energy D"
      still_energy:
        name: "g7 Still Energy D"
    g8:
      move_energy:
        name: "g8 Move Energy D"
      still_energy:
        name: "g8 Still Energy D"

  - platform: template
    id: esp_memory
    icon: mdi:memory
    name: ESP Free Memory
    lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
    unit_of_measurement: 'kB'
    state_class: measurement
    entity_category: "diagnostic"
  - platform: internal_temperature
    name: "intern_temp"
  - platform: uptime
    name: "Uptime Raw"
    id: uptime_sensor
  - platform: wifi_signal
    name: "WiFi Signal Strength"
    update_interval: 60s

  - platform: dht
    pin: 27
    temperature:
      name: "Temperature"
      accuracy_decimals: 2
      device_class: "temperature"
      filters:
        - offset: -3.0
         
    humidity:
      name: "Humidite"
      accuracy_decimals: 2
      device_class: "humidity"
    update_interval: 20s

  - platform: bh1750
    name: "Lumiere"
    device_class: "illuminance"
    address: 0x23
    update_interval: 60s

cIqluhvjjbZBBYra-a

le rendu brut

cdt

1 « J'aime »

Bonjour,
Merci pour le partage. Je viens aussi à l’instant de finir un détecteur de présence ld2410 avec case 3D pour mon établi, c’est la période bricolage :blush:. Il remplace un détecteur sonoff SNZB-06P qui marche vraiment mal, remisé au placard.

2 « J'aime »

Pour quel usage/type d’installation ?

Hello,

Detection de personne, grande pièce accès des 2 côtés, j’aurai aussi pu mettre 2 esp mais à quoi bon si on peut le faire en 1. Après ça remonte dans ESPhome, ça sert principalement pour mon éclairage automatique.

cdt

1 « J'aime »

Bonjour @freetronic,

Tu utilises quelle sonde de température / humidité ? Sais-tu s’il existe une sonde utilisable en extérieur (à l’abri de la pluie type boitier de carte de portail Avidsen V300) ?

Hello,

Je n’utilise que du DHT22 à l’abri des éléments, à mon avis il vaut mieux éviter ce type de capteur, en extérieur parce que ça impliquerait probablement de le mettre dans la boite étanche de l’esp. L’esp chauffant, ça sera un enfer à régler, et les valeurs seront potentiellement partiellement fausses, peut être les sondes de réfrigérateur, DS18B20 dans ma mémoire, il doit y en avoir d’autres

cdt

1 « J'aime »

Salut,
Moi sur un esp j’avais testé un bm280, il a pas tenu. Pourtant je pensais avoir géré l’oxydation.
J’ai donc depuis mis une ds18b20 étanche, je n’ai pas l’humidité mais ça ne me dérange pas.