Code pour esp 32 +ld2410

Mon problème

Bonjour
Je voulait faire le détecteur de.mouvement des frère poulain, https://youtu.be/DjN9L8Cagnw?si=sZGyhFYB9atp-Ff_
Le problème est qu’il ne donne pas de code, j’ai repris le même matériel à l’identique, et c’est et essayer à partir de la documentation ESP de faire le code sans grand succès puisque ça ne fonctionne pas, est-ce que je pourrais avoir votre aide ?
Mickael

Ma configuration


[center]## System Information

version core-2024.1.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 6.1.63-haos-raspi
arch aarch64
timezone Europe/Paris
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.33.0
Stage running
Available Repositories 1378
Downloaded Repositories 63
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 11.4
update_channel stable
supervisor_version supervisor-2023.12.0
agent_version 1.6.0
docker_version 24.0.7
disk_total 228.5 GB
disk_used 37.0 GB
healthy true
supported true
board rpi4-64
supervisor_api ok
version_api ok
installed_addons Samba share (12.2.0), Terminal & SSH (9.8.1), File editor (5.7.0), Duck DNS (1.15.0), Node-RED (17.0.2), AdGuard Home (5.0.2), VLC (0.3.0), Z-Wave JS (0.4.3), Tailscale (0.14.0), Mosquitto broker (6.4.0), Studio Code Server (5.15.0), Tor (5.0.0), Vaultwarden (Bitwarden) (0.21.0), motionEye (0.20.0), ESPHome (2023.12.6), room-assistant (2.20.0), Frigate (Full Access) (0.12.1), Piper (1.4.0), Whisper (1.0.2)
Dashboards
dashboards 3
resources 26
views 15
mode storage
Recorder
oldest_recorder_run 7 janvier 2024 à 00:47
current_recorder_run 15 janvier 2024 à 16:27
estimated_db_size 274.53 MiB
database_engine sqlite
database_version 3.41.2
[/center]

Bj

direction le discord , c’est dans les com

Salut,

Voila mon code fonctionnel (pompé a G et à D)!
Penses a changer le board en fonction de ta carte moi c’est un wemos D1 mini

Code

esphome:
name: esphome-web-d22267
friendly_name: WEMOS Capt millimetrique

esp8266:
board: d1_mini

Enable logging

logger:

Enable Home Assistant API

api:
encryption:
key: " ton code "

ota:

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

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: « Esphome-Web-D22267 »
password: « xxxxx »

captive_portal:
web_server:

Example configuration entry

ld2410:

uart:
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 256000
parity: NONE
stop_bits: 1

binary_sensor:

  • platform: ld2410
    has_target:
    name: Presence
    has_moving_target:
    name: Moving Target
    has_still_target:
    name: Still Target
    out_pin_presence_status:
    name: out pin presence status

sensor:

  • platform: ld2410
    light:
    name: light
    moving_distance:
    name : Moving Distance
    still_distance:
    name: Still Distance
    moving_energy:
    name: Move Energy
    still_energy:
    name: Still Energy
    detection_distance:
    name: Detection Distance
    g0:
    move_energy:
    name: g0 move energy
    still_energy:
    name: g0 still energy
    g1:
    move_energy:
    name: g1 move energy
    still_energy:
    name: g1 still energy
    g2:
    move_energy:
    name: g2 move energy
    still_energy:
    name: g2 still energy
    g3:
    move_energy:
    name: g3 move energy
    still_energy:
    name: g3 still energy
    g4:
    move_energy:
    name: g4 move energy
    still_energy:
    name: g4 still energy
    g5:
    move_energy:
    name: g5 move energy
    still_energy:
    name: g5 still energy
    g6:
    move_energy:
    name: g6 move energy
    still_energy:
    name: g6 still energy
    g7:
    move_energy:
    name: g7 move energy
    still_energy:
    name: g7 still energy
    g8:
    move_energy:
    name: g8 move energy
    still_energy:
    name: g8 still energy

number:

  • platform: ld2410
    timeout:
    name: timeout
    light_threshold:
    name: light threshold
    max_move_distance_gate:
    name: max move distance gate
    max_still_distance_gate:
    name: max still distance gate
    g0:
    move_threshold:
    name: g0 move threshold
    still_threshold:
    name: g0 still threshold
    g1:
    move_threshold:
    name: g1 move threshold
    still_threshold:
    name: g1 still threshold
    g2:
    move_threshold:
    name: g2 move threshold
    still_threshold:
    name: g2 still threshold
    g3:
    move_threshold:
    name: g3 move threshold
    still_threshold:
    name: g3 still threshold
    g4:
    move_threshold:
    name: g4 move threshold
    still_threshold:
    name: g4 still threshold
    g5:
    move_threshold:
    name: g5 move threshold
    still_threshold:
    name: g5 still threshold
    g6:
    move_threshold:
    name: g6 move threshold
    still_threshold:
    name: g6 still threshold
    g7:
    move_threshold:
    name: g7 move threshold
    still_threshold:
    name: g7 still threshold
    g8:
    move_threshold:
    name: g8 move threshold
    still_threshold:
    name: g8 still threshold

Mdr, je comprends pas l’intérêt de faire des vidéos et de pas partager les codes. AH si , faire des vues et de la tunes ( avec leur lien, sponsor et co ).
Un pote ma fais la même remarque sur leur vidéo, je lui est dit « ta qu’a leur demander au frère Poulain! » :rofl:

C’est pas les vidéos de @Tedour , super bien expliquer avec les codes fournies.

6 « J'aime »

On vie dans un monde de pub , de partout aujourd’hui

Merci ++
Je vais essayer

Salut,
il a fait une erreur de copier coller:

uart:
  tx_pin: GPIO18
  rx_pin: GPIO33
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

c’est pas le GPIO 01 et 03:

  tx_pin: GPIO1
  rx_pin: GPIO3

Je te remercie beaucoup

si si avec un Wemos pas d’autre choix que ces GPIO 1 et 3

Ok, c’est pas un Wemos S2 Mini ( j’aurais pu le voir dans la YAML :frowning:). Autant pour moi, car la vidéo des frères poulain parle d’un Wemos S2 Mini.
Pour le Wemos S2 Mini c’est le GPIO 018 et 033.

1 « J'aime »

Oui puis j’avais pas precisé non plus que le code fourni était pour un wemos D1.
Je vais editer mon message initial pour ceux qui passeront plus tard sur le sujet.

Bonjour
Le code est parfait ! Success…
Mais y a un souci lesp ne se connecte pas.,.elle reste rouge sur l esphome de ha .
Je n’arrive pas a m’y connecter pour récupérer le log

« INFO ESPHome 2023.12.8
INFO Reading configuration /config/esphome/detect-human-1.yaml…
INFO Starting log output from detect-human-1.local using esphome API WARNING Can’t connect to ESPHome API for detect-human-1.local: Error resolving IP address: [Errno -5] No address associated with hostname (APIConnectionError) INFO Trying to connect to detect-human-1.local in the background »

??

Salut,
ta configurer une ip static ou pas ?
Ta bien informer ton SSID et pass de ta box ?

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.1.60
    gateway: !secret wifi_gtw
    subnet: !secret wifi_sub
    dns1: !secret wifi_dns1

Salut
Pour la wifi c’est bon
Je n ai est pas créer d IP static, comment fait on ca?
M

C’est dans le code :wink:

# Example configuration entry
wifi:
  ssid: MyHomeNetwork
  password: VerySafePassword

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.0.123
    gateway: 192.168.0.1
    subnet: 255.255.255.0

Marche pas
voici mon code

esphome:
  name: detect-human-1
  friendly_name: Detect human 1

esp32:
  board: esp32-s2-saola-1
  framework:
    type: arduino

# Enable logging
logger:


# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxx"

ota:
  password: "xxxxxxxxx"

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

  manual_ip:
    static_ip: 192.168.0.123
    gateway: 192.168.0.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Detect-Human-1 Fallback Hotspot"
    password: "xxxxxxxx"

captive_portal:
web_server:

ld2410:

uart:
  tx_pin: GPIO18
  rx_pin: GPIO33
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

binary_sensor:
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target
    out_pin_presence_status:
      name: out pin presence status
    
sensor:
  - platform: ld2410
    light:
      name: light
    moving_distance:
      name : Moving Distance
    still_distance:
      name: Still Distance
    moving_energy:
      name: Move Energy
    still_energy:
      name: Still Energy
    detection_distance:
      name: Detection Distance
    g0:
      move_energy:
        name: g0 move energy
      still_energy:
        name: g0 still energy
    g1:
      move_energy:
        name: g1 move energy
      still_energy:
        name: g1 still energy
    g2:
      move_energy:
        name: g2 move energy
      still_energy:
        name: g2 still energy
    g3:
      move_energy:
        name: g3 move energy
      still_energy:
        name: g3 still energy
    g4:
      move_energy:
        name: g4 move energy
      still_energy:
        name: g4 still energy
    g5:
      move_energy:
        name: g5 move energy
      still_energy:
        name: g5 still energy
    g6:
      move_energy:
        name: g6 move energy
      still_energy:
        name: g6 still energy
    g7:
      move_energy:
        name: g7 move energy
      still_energy:
        name: g7 still energy
    g8:
      move_energy:
        name: g8 move energy
      still_energy:
        name: g8 still energy


number:
  - platform: ld2410
    timeout:
      name: timeout
    light_threshold:
      name: light threshold
    max_move_distance_gate:
      name: max move distance gate
    max_still_distance_gate:
      name: max still distance gate
    g0:
      move_threshold:
        name: g0 move threshold
      still_threshold:
        name: g0 still threshold
    g1:
      move_threshold:
        name: g1 move threshold
      still_threshold:
        name: g1 still threshold
    g2:
      move_threshold:
        name: g2 move threshold
      still_threshold:
        name: g2 still threshold
    g3:
      move_threshold:
        name: g3 move threshold
      still_threshold:
        name: g3 still threshold
    g4:
      move_threshold:
        name: g4 move threshold
      still_threshold:
        name: g4 still threshold
    g5:
      move_threshold:
        name: g5 move threshold
      still_threshold:
        name: g5 still threshold
    g6:
      move_threshold:
        name: g6 move threshold
      still_threshold:
        name: g6 still threshold
    g7:
      move_threshold:
        name: g7 move threshold
      still_threshold:
        name: g7 still threshold
    g8:
      move_threshold:
        name: g8 move threshold
      still_threshold:
        name: g8 still threshold

C’était un exemple, faut bien mettre ton ip de ta box ( gateway ) et une ip libre pour ton esp ( static_ip ).
Par défaut une box internet a l’ip 192.168.1.1

Pour être sur, dans ton fichier secret tu a mis le SSID et mot de passe de ta box ?

Regarde ce post ESP32-S2 - Où est le wifi et le port com?
As tu bien mis ton esp en mode download , avant de le flasher?

desolé j suis pas tres bon :smiley:j

je vais regarder
mode dld , je ne sais pas par contre , ca ecrit bien sur la carte lors de la programmation

quand tu met !secret , ca va chercher les informations dans le fichier secret.yaml de ESPHome.
Dans le dashboard ESPHome en haut a droite ta secret, tu clic dessus et peut éditer le fichier.
il te faut ceci dedans:

wifi_ssid: "xxxxxxxxxxxxxxxx"  #Le SSiD de ta box
wifi_password: "xxxxxxxxxxxxxxxxxxxx"  #ton MDP WiFi de la box

oui cest ca (j ai deja utilisé le fichier secret), ca a bien fonctionner

J ai remplacé lip par celle de la box (gateway) dans le code

lorsque j’essai de connecter en mode download, l’ordi reconnait l’appareil mais impossible de se connecter :


puis connecting …
et enfin

Et lorsque je programme la carte par Wirelessly :
voici le log
"INFO ESPHome 2023.12.9
INFO Reading configuration /config/esphome/redcam.yaml…
INFO Generating C++ source…
INFO Compiling app…
Processing detect-human-1 (board: esp32-s2-saola-1; framework: arduino; platform: platformio/espressif32@5.4.0)

HARDWARE: ESP32S2 240MHz, 320KB RAM, 4MB Flash

  • toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
  • toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch5
    Dependency Graph
    |-- AsyncTCP-esphome @ 2.0.1
    |-- WiFi @ 2.0.0
    |-- FS @ 2.0.0
    |-- Update @ 2.0.0
    |-- ESPAsyncWebServer-esphome @ 3.1.0
    |-- DNSServer @ 2.0.0
    |-- ESPmDNS @ 2.0.0
    |-- noise-c @ 0.1.4
    |-- ArduinoJson @ 6.18.5
    RAM: [= ] 13.9% (used 45488 bytes from 327680 bytes)
    Flash: [===== ] 50.8% (used 932546 bytes from 1835008 bytes)
    ========================= [SUCCESS] Took 31.77 seconds =========================
    INFO Successfully compiled program.
    INFO Connecting to 192.168.0.123
    ERROR Connecting to 192.168.0.123:3232 failed: timed out"