Mise en œuvre capteur a ultrason type A01NYUB sur ESP32

Bonjour

dans le cadre d’un projet de mesure de hauteur d’eau d’un puits, j’ai acheté cette carte (modèle 8 relais) et ce capteur de distance (modèle UART controlé).

cela correspond respectivement (a prioris) a cela sur le site esphome

# ESP32 Relay Board x8
# A01NYUB Waterproof Ultrasonic Sensor

Mais je n’arrive pas à le mettre en oeuvre, je ne récupère aucun retour pour ce sensor :frowning:

le Brochage de l’esp32 sur la carte est comme ceci:

et voici le pinout

d’après ce que j’ai constaté au muntimètre les bornes sont cablée comme cela:

TXD carte → TXD 0 (GPIO01) ESP
RXD carte → RXD 0 (GPIO03) ESP

G16 carte → RXD 2 (GPIO16) ESP
G17 carte → TXD 2 (GPIO17) ESP

J’ai essayé les deux, mais rien ne fonctionne, d’ailleur pour l’UART 0 j’ai du commenté « improv_serial: » (je sais même sais pas à quoi cela sert lol) et désactivé le logger via UART.

le capteur est alimenté via les pin GND / 3V3 (en haut à droite sur l’image du brochage ci-dessus). Le capteur suporte un alim de 3,3V à 5V, mais je n’ai pas oser le mettre en 5V de peur de cramer l’ESP

Voici mon YAML

substitutions:
  valve_operating_time: 10s
  update_interval: 1s

esphome:
  name: gestion-bassin-et-puits
  friendly_name: Gestion bassin et puits

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: "VZLuI8t3hcPWYbC0xi8//W+Hy0L0hoFNy6uN1Gc+gBQ="

ota:
  - platform: esphome
    password: "504ebc732d2c67fa02c0f2a3034ac9d5"

external_components:
  - source: github://dentra/esphome-components
backup:

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

    # Optional manual IP
  manual_ip:
    static_ip: 192.168.1.17
    gateway: 192.168.1.254
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Gestion-Bassin-Et-Puits"
    password: "i5shqqZHcZpA"

captive_portal:

web_server:

#improv_serial:

# Status LED
light:
  - platform: status_led
    name: "LED PCB"
    restore_mode: ALWAYS_OFF
    pin:
      number: GPIO23

# 8 relay outputs, exposed as switches in Home Assistant
switch:

  # relais 1
  - platform: gpio
    pin: GPIO32 
    name: Ouverture vanne 1
    id: valve_1_open
    internal: true

  # relais 2  
  - platform: gpio
    pin: GPIO33 
    name: Fermeture vanne 1
    id: valve_1_close
    internal: true

  # relais 3  
  - platform: gpio
    pin: GPIO25
    name: Ouverture vanne 2
    id: valve_2_open
    internal: true

  # relais 4      
  - platform: gpio
    pin: GPIO26
    name: Fermeture vanne 2
    id: valve_2_close
    internal: true

  # relais 5     
  - platform: gpio
    pin: GPIO27
    name: Pompe puits
    id: relay5

  # relais 6      
  - platform: gpio
    pin: GPIO14
    name: Pompe bassin
    id: relay6

   # relais 7     
  - platform: gpio
    pin: GPIO12
    name: Aérateur Local technique
    id: relay7

  # relais 8      
  - platform: gpio
    pin: GPIO13
    name: Chauffage eau poullailler
    id: relay8

  # restart
  - platform: restart
    name: "Redémarrage"

# Assocoation sondes de température / ESP32 

# GPIO du bus one wire pour les sondes de température

one_wire:

  - platform: gpio
    pin: GPIO15

# Example configuration entry
uart:
  tx_pin: GPIO01
  rx_pin: GPIO03
  # tx_pin: GPIO17
  # rx_pin: GPIO16
  baud_rate: 9600

sensor:

  # Sonde de niveau à ultrason

  - platform: "a01nyub"
    name: "Hauteur d'eau puits"
    id: well_water_level
    state_class: "measurement"
    device_class: "distance"
    unit_of_measurement: "cm"
    filters:
      - throttle: 5s

  - platform: template
    name: "Water Tank Level"
    state_class: "measurement"
    unit_of_measurement: "cm"
    icon: "mdi:waves"
    update_interval: 5s
    accuracy_decimals: 0
    lambda: |-
      return id(well_water_level).state;
    
  # - platform: ultrasonic
  #   trigger_pin: GPIO01
  #   echo_pin: GPIO03
  #   name: "Hauteur d'eau puits"
  #   update_interval: 10s
  #   id: utlrasonic_sensor_puits

  # - platform: "hrxl_maxsonar_wr"
  #   name: "hauteur d'eau puits"
  #   update_interval: 10s

  # Sonde de température eau du puits
  - platform: dallas_temp
    address: 0x5800000036de9d28
    name: "Température puits"
    update_interval: 10s

  # Sonde de température eau du puits
  - platform: dallas_temp
    address: 0xc700000059a9d928
    name: "Température bassin"
    update_interval: 10s

  # Sonde de température eau du puits
  - platform: dallas_temp
    address: 0x150000003582fb28
    name: "Température Extérieure"
    update_interval: 10s


  # WiFi Signal     
  - platform: wifi_signal
    name: "Signal WIFI"
    id: wifisignal
    update_interval: 20s

      
  # Temps de fonctionnement
  - platform: uptime
    name: "Allumé depuis (s)"
    id: uptime_sec
    internal: true

# Transformation des secondes en jours
text_sensor:

  - platform: template
    name: "Allumé depuis (j)"
    lambda: |-
      int seconds = (id(uptime_sec).state);
      int days = seconds / (24 * 3600);
      seconds = seconds % (24 * 3600); 
      int hours = seconds / 3600;
      seconds = seconds % 3600;
      int minutes = seconds /  60;
      seconds = seconds % 60;
      return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };          
    icon: mdi:clock-start
    update_interval: 10s    


valve:

  # Vanne arrivée eau du puits

  - platform: template
    name: "Vanne Puits"
    device_class: water
    id: valve_water_well
    restore_mode: RESTORE

    open_action:
      - switch.turn_off: valve_1_close # on coupe l'autre relais au cas ou une manoeuvre est en cours
      - switch.turn_on: valve_1_open
      - delay: ${valve_operating_time}
      - switch.turn_off: valve_1_open
    close_action:
      - switch.turn_off: valve_1_open # on coupe l'autre relais au cas ou une manoeuvre est en cours
      - switch.turn_on: valve_1_close
      - delay: ${valve_operating_time}
      - switch.turn_off: valve_1_close
    optimistic: true


  # Vanne départ eau du puits vers la maisson

  - platform: template
    name: "Vanne EDP"
    device_class: water
    id: valve_water_to_home
    restore_mode: RESTORE

    open_action:
      - switch.turn_off: valve_2_close # on coupe l'autre relais au cas ou une manoeuvre est en cours
      - switch.turn_on: valve_2_open
      - delay: ${valve_operating_time}
      - switch.turn_off: valve_2_open
    close_action:
      - switch.turn_off: valve_2_open # on coupe l'autre relais au cas ou une manoeuvre est en cours
      - switch.turn_on: valve_2_close
      - delay: ${valve_operating_time}
      - switch.turn_off: valve_2_close
    optimistic: true




voila ce que remonte le serveur web de l’ESP

et enfin le log

INFO ESPHome 2024.12.2
INFO Reading configuration /config/esphome/gestion-bassin-et-puits.yaml...
WARNING GPIO12 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO15 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Starting log output from 192.168.1.17 using esphome API
INFO Successfully connected to gestion-bassin-et-puits @ 192.168.1.17 in 0.035s
INFO Successful handshake with gestion-bassin-et-puits @ 192.168.1.17 in 0.097s
[18:38:49][I][app:100]: ESPHome version 2024.12.2 compiled on Jan 21 2025, 18:14:47
[18:38:49][C][status_led:065]: Status Led Light:
[18:38:49][C][status_led:066]:   Pin: GPIO23
[18:38:49][C][wifi:600]: WiFi:
[18:38:50][C][wifi:428]:   Local MAC: F8:B3:B7:20:FC:A0
[18:38:50][C][wifi:433]:   SSID: 'Freebox-seb'[redacted]
[18:38:50][C][wifi:436]:   IP Address: 192.168.1.17
[18:38:50][C][wifi:440]:   BSSID: 3A:07:16:90:59:80[redacted]
[18:38:50][C][wifi:441]:   Hostname: 'gestion-bassin-et-puits'
[18:38:50][C][wifi:443]:   Signal strength: -83 dB ▂▄▆█
[18:38:50][C][wifi:447]:   Channel: 6
[18:38:50][C][wifi:448]:   Subnet: 255.255.255.0
[18:38:50][C][wifi:449]:   Gateway: 192.168.1.254
[18:38:50][C][wifi:450]:   DNS1: 0.0.0.0
[18:38:50][C][wifi:451]:   DNS2: 0.0.0.0
[18:38:50][C][logger:185]: Logger:
[18:38:50][C][logger:186]:   Level: DEBUG
[18:38:50][C][switch.gpio:068]: GPIO Switch 'Fermeture vanne 1'
[18:38:50][C][switch.gpio:031]:   Pin: GPIO33
[18:38:50][C][switch.gpio:068]: GPIO Switch 'Ouverture vanne 2'
[18:38:50][C][switch.gpio:091]:   Restore Mode: always OFF
[18:38:50][C][switch.gpio:068]: GPIO Switch 'Fermeture vanne 2'
[18:38:50][C][switch.gpio:031]:   Pin: GPIO26
[18:38:50][C][switch.gpio:091]:   Restore Mode: always OFF
[18:38:50][C][switch.gpio:068]: GPIO Switch 'Pompe bassin'
[18:38:50][C][switch.gpio:091]:   Restore Mode: always OFF
[18:38:50][C][switch.gpio:091]:   Restore Mode: always OFF
[18:38:50][C][switch.gpio:068]: GPIO Switch 'Chauffage eau poullailler'
[18:38:51][C][switch.gpio:091]:   Restore Mode: always OFF
[18:38:51][C][uptime.sensor:033]:   Unit of Measurement: 's'
[18:38:51][C][uptime.sensor:033]:   Accuracy Decimals: 0
[18:38:51][C][uptime.sensor:033]:   Icon: 'mdi:timer-outline'
[18:38:51][C][template.text_sensor:020]:   Icon: 'mdi:clock-start'
[18:38:51][C][template.valve:068]:   Device Class: 'water'
[18:38:51][C][template.valve:069]:   Has position: NO
[18:38:51][C][template.valve:070]:   Optimistic: YES
[18:38:51][C][light:092]: Light 'LED PCB'
[18:38:51][C][restart:068]: Restart Switch 'Redémarrage'
[18:38:51][C][restart:070]:   Icon: 'mdi:restart'
[18:38:51][C][restart:091]:   Restore Mode: always OFF
[18:38:51][C][a01nyub.sensor:041]: A01nyub Sensor 'Hauteur d'eau puits'
[18:38:51][C][a01nyub.sensor:041]:   Device Class: 'distance'
[18:38:51][C][a01nyub.sensor:041]:   Accuracy Decimals: 3
[18:38:51][C][a01nyub.sensor:041]:   Icon: 'mdi:arrow-expand-vertical'
[18:38:51][C][dallas.temp.sensor:035]:   Resolution: 12 bits
[18:38:51][C][dallas.temp.sensor:035]:   Resolution: 12 bits
[18:38:51][C][dallas.temp.sensor:036]:   Update Interval: 10.0s
[18:38:51][C][dallas.temp.sensor:036]:   Update Interval: 10.0s
[18:38:51][C][web_server:153]: Web Server:
[18:38:51][C][safe_mode:018]: Safe Mode:
[18:38:51][C][safe_mode:021]:   Invoke after 10 boot attempts
[18:38:51][C][safe_mode:023]:   Remain in safe mode for 300 seconds
[18:38:51][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:38:51][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:38:51][C][api:140]: API Server:
[18:38:51][C][api:141]:   Address: 192.168.1.17:6053
[18:38:51][C][api:143]:   Using noise encryption: YES
[18:38:51][C][wifi_signal.sensor:010]: WiFi Signal 'Signal WIFI'
[18:38:51][C][wifi_signal.sensor:010]:   Device Class: 'signal_strength'
[18:38:51][C][wifi_signal.sensor:010]:   State Class: 'measurement'
[18:38:51][C][wifi_signal.sensor:010]:   Unit of Measurement: 'dBm'
[18:38:51][C][wifi_signal.sensor:010]:   Accuracy Decimals: 0
[18:38:52][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:38:52][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:38:52][D][sensor:094]: 'Température Extérieure': Sending state 24.43750 °C with 1 decimals of accuracy
[18:38:54][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.2°C
[18:38:54][D][sensor:094]: 'Température bassin': Sending state 24.18750 °C with 1 decimals of accuracy
[18:38:57][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:01][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 21m 33s'
[18:39:01][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:39:01][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:39:02][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:02][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:39:02][D][sensor:094]: 'Température Extérieure': Sending state 24.43750 °C with 1 decimals of accuracy
[18:39:04][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.2°C
[18:39:04][D][sensor:094]: 'Température bassin': Sending state 24.18750 °C with 1 decimals of accuracy
[18:39:07][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:11][D][sensor:094]: 'Signal WIFI': Sending state -84.00000 dBm with 0 decimals of accuracy
[18:39:11][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 21m 33s'
[18:39:11][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:39:11][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:39:12][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:12][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:39:12][D][sensor:094]: 'Température Extérieure': Sending state 24.43750 °C with 1 decimals of accuracy
[18:39:14][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:39:14][D][sensor:094]: 'Température bassin': Sending state 24.12500 °C with 1 decimals of accuracy
[18:39:17][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:21][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 21m 33s'
[18:39:21][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:39:21][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:39:22][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:22][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:39:22][D][sensor:094]: 'Température Extérieure': Sending state 24.43750 °C with 1 decimals of accuracy
[18:39:24][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.2°C
[18:39:24][D][sensor:094]: 'Température bassin': Sending state 24.18750 °C with 1 decimals of accuracy
[18:39:27][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:31][D][sensor:094]: 'Signal WIFI': Sending state -85.00000 dBm with 0 decimals of accuracy
[18:39:31][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 21m 33s'
[18:39:31][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:39:31][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:39:32][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:32][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:39:32][D][sensor:094]: 'Température Extérieure': Sending state 24.43750 °C with 1 decimals of accuracy
[18:39:34][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.2°C
[18:39:34][D][sensor:094]: 'Température bassin': Sending state 24.18750 °C with 1 decimals of accuracy
[18:39:37][D][sensor:094]: 'Allumé depuis (s)': Sending state 1353.41296 s with 0 decimals of accuracy
[18:39:37][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:41][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 22m 33s'
[18:39:41][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:39:41][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:39:42][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:42][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:39:42][D][sensor:094]: 'Température Extérieure': Sending state 24.43750 °C with 1 decimals of accuracy
[18:39:44][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:39:44][D][sensor:094]: 'Température bassin': Sending state 24.12500 °C with 1 decimals of accuracy
[18:39:47][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:51][D][sensor:094]: 'Signal WIFI': Sending state -84.00000 dBm with 0 decimals of accuracy
[18:39:51][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 22m 33s'
[18:39:51][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:39:51][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:39:52][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:39:52][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:39:52][D][sensor:094]: 'Température Extérieure': Sending state 24.43750 °C with 1 decimals of accuracy
[18:39:54][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:39:54][D][sensor:094]: 'Température bassin': Sending state 24.12500 °C with 1 decimals of accuracy
[18:39:57][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:01][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 22m 33s'
[18:40:01][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:40:01][D][sensor:094]: 'Température puits': Sending state 21.43750 °C with 1 decimals of accuracy
[18:40:02][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:02][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:40:02][D][sensor:094]: 'Température Extérieure': Sending state 24.43750 °C with 1 decimals of accuracy
[18:40:04][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:40:04][D][sensor:094]: 'Température bassin': Sending state 24.12500 °C with 1 decimals of accuracy
[18:40:07][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:11][D][sensor:094]: 'Signal WIFI': Sending state -84.00000 dBm with 0 decimals of accuracy
[18:40:11][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 22m 33s'
[18:40:11][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:40:11][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:40:12][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:12][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:40:12][D][sensor:094]: 'Température Extérieure': Sending state 24.37500 °C with 1 decimals of accuracy
[18:40:14][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:40:14][D][sensor:094]: 'Température bassin': Sending state 24.12500 °C with 1 decimals of accuracy
[18:40:17][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:21][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 22m 33s'
[18:40:21][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:40:21][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:40:22][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:22][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:40:22][D][sensor:094]: 'Température Extérieure': Sending state 24.43750 °C with 1 decimals of accuracy
[18:40:24][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:40:24][D][sensor:094]: 'Température bassin': Sending state 24.12500 °C with 1 decimals of accuracy
[18:40:27][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:31][D][sensor:094]: 'Signal WIFI': Sending state -86.00000 dBm with 0 decimals of accuracy
[18:40:31][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 22m 33s'
[18:40:32][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:40:32][D][sensor:094]: 'Température puits': Sending state 21.43750 °C with 1 decimals of accuracy
[18:40:32][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:32][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:40:32][D][sensor:094]: 'Température Extérieure': Sending state 24.43750 °C with 1 decimals of accuracy
[18:40:34][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:40:34][D][sensor:094]: 'Température bassin': Sending state 24.12500 °C with 1 decimals of accuracy
[18:40:37][D][sensor:094]: 'Allumé depuis (s)': Sending state 1413.41394 s with 0 decimals of accuracy
[18:40:37][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:41][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 23m 33s'
[18:40:41][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:40:41][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:40:42][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:42][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:40:42][D][sensor:094]: 'Température Extérieure': Sending state 24.37500 °C with 1 decimals of accuracy
[18:40:44][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:40:44][D][sensor:094]: 'Température bassin': Sending state 24.12500 °C with 1 decimals of accuracy
[18:40:47][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:51][D][sensor:094]: 'Signal WIFI': Sending state -81.00000 dBm with 0 decimals of accuracy
[18:40:51][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 23m 33s'
[18:40:51][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:40:51][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:40:52][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:40:52][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:40:52][D][sensor:094]: 'Température Extérieure': Sending state 24.37500 °C with 1 decimals of accuracy
[18:40:54][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:40:54][D][sensor:094]: 'Température bassin': Sending state 24.12500 °C with 1 decimals of accuracy
[18:40:57][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:41:01][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 23m 33s'
[18:41:01][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:41:01][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:41:02][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:41:02][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:41:02][D][sensor:094]: 'Température Extérieure': Sending state 24.37500 °C with 1 decimals of accuracy
[18:41:04][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:41:04][D][sensor:094]: 'Température bassin': Sending state 24.12500 °C with 1 decimals of accuracy
[18:41:07][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:41:11][D][sensor:094]: 'Signal WIFI': Sending state -83.00000 dBm with 0 decimals of accuracy
[18:41:11][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 23m 33s'
[18:41:11][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:41:11][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:41:12][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:41:12][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:41:12][D][sensor:094]: 'Température Extérieure': Sending state 24.37500 °C with 1 decimals of accuracy
[18:41:14][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:41:14][D][sensor:094]: 'Température bassin': Sending state 24.06250 °C with 1 decimals of accuracy
[18:41:17][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:41:21][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 23m 33s'
[18:41:21][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:41:21][D][sensor:094]: 'Température puits': Sending state 21.43750 °C with 1 decimals of accuracy
[18:41:22][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:41:22][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:41:22][D][sensor:094]: 'Température Extérieure': Sending state 24.37500 °C with 1 decimals of accuracy
[18:41:24][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:41:24][D][sensor:094]: 'Température bassin': Sending state 24.06250 °C with 1 decimals of accuracy
[18:41:27][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:41:31][D][sensor:094]: 'Signal WIFI': Sending state -80.00000 dBm with 0 decimals of accuracy
[18:41:31][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 23m 33s'
[18:41:31][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:41:31][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:41:32][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:41:32][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:41:32][D][sensor:094]: 'Température Extérieure': Sending state 24.37500 °C with 1 decimals of accuracy
[18:41:34][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:41:34][D][sensor:094]: 'Température bassin': Sending state 24.06250 °C with 1 decimals of accuracy
[18:41:37][D][sensor:094]: 'Allumé depuis (s)': Sending state 1473.41394 s with 0 decimals of accuracy
[18:41:37][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:41:41][D][text_sensor:064]: 'Allumé depuis (j)': Sending state '0d 0h 24m 33s'
[18:41:41][D][dallas.temp.sensor:054]: 'Température puits': Got Temperature=21.4°C
[18:41:41][D][sensor:094]: 'Température puits': Sending state 21.37500 °C with 1 decimals of accuracy
[18:41:42][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy
[18:41:42][D][dallas.temp.sensor:054]: 'Température Extérieure': Got Temperature=24.4°C
[18:41:42][D][sensor:094]: 'Température Extérieure': Sending state 24.37500 °C with 1 decimals of accuracy
[18:41:44][D][dallas.temp.sensor:054]: 'Température bassin': Got Temperature=24.1°C
[18:41:44][D][sensor:094]: 'Température bassin': Sending state 24.06250 °C with 1 decimals of accuracy
[18:41:47][D][sensor:094]: 'Water Tank Level': Sending state nan cm with 0 decimals of accuracy

j’ai essayé d’inverser tx et rx aussi.

quelqu’un à un idée ?

Je vien de tester avec un autre ESP32, idem

soit mon YAML est pas bon, soit le capteur est défaillant

quelque’un aurait déja utilisé ce genre de catpeur ?

Salut,
tu vois ton sujet ?

Pas bien compris ce sujet ???

en fait quand je vais dans les nouveau sujet, je ne le vois pas, ça m’a étonné, mais peut-etre que mes propre sujet n’apparaisse pas (pour moi) dans la liste

tu parles de nouveau en haut ?
image
Oui, tu ne vois pas ton sujet.

Si tu recherches un sujet à toi, va dans ton profil / activité et onglet sujet.

yes, merci pour l’info

Aujour’hui j’ai testé une autre méthode, en ecrivant un ptit bout de code en C++ pour écouter la liaison série de l’ESP32, et devinez quoi, je ne reçois toutjours pas d’info du capteur…

Hum, ça sent le capteur déffectueux quand même, je vais contactacter le vendeur

d’autant que sur les diverses vidéos que j’ai pu voir, la led du clapteur clignotte dans tous les sens, et le mien flash un coup, quand on met l’alim de l’esp, et basta…

1 « J'aime »

Bonjour à tous,

Je viens vous donner des nouvelles, après changement de capteur (j’ai finalement acheté le A01NYUB de df robot) qui est cité sur la doc esphome # A01NYUB Waterproof Ultrasonic Sensor

Au niveau du cablage sur l’ESP32:

TX capteur → GPIO16 (RXD 2 )
RX capteur → GPIO17 (TXD 2)
VCC capteur → 3,3V
GND capteur → GND

Il faut bien croiser TX / RX, ce que je n’avais pas fait au départ; cela dit mon premier capteur était probablement défectueux car la led ne cliniotait pas, alors que sur le nouveau elle clignotte en permanence dès lors qu’on alimente.

voici mon code yaml pour la partie capteur


uart:
   tx_pin: GPIO17
   rx_pin: GPIO16
   baud_rate: 9600 
   id: uartbus

sensor:

  # Sonde de niveau à ultrason

  - platform: "a01nyub"
    name: "Hauteur mesurée par le capteur à urtrason"
    id: well_water_level_sensor
    state_class: "measurement"
    device_class: "distance"
    uart_id: uartbus
    unit_of_measurement: 'm'
    accuracy_decimals: 2
    filters:
      - throttle: ${update_interval_distance_measurement}
      - heartbeat: ${update_interval_distance_measurement}
      - quantile:
          window_size: 7
          send_every: 4
          send_first_at: 3
          quantile: .9
      - lambda: |-
          if (x == NAN) 
            {
            return 0.0;
            }
          else
            {
            return x;  
            }
       - debounce: 0.1s

  - platform: template
    name: "hauteur d'eau puits"
    id: current_water_level
    lambda: |-
      if (id(well_water_level_sensor).state != NAN) 
        {
        float sensorToGroundDisctance = 7.0; // distance entre capteur et sol en m

        return sensorToGroundDisctance - id(well_water_level_sensor).state;
        } 
      else 
        {
        return 0;
        }
    accuracy_decimals: 2
    update_interval: 1s 

  - platform: template
    name: "Volume d'eau total du puits"
    id: wellTotalWaterVolume
    state_class: "measurement"
    unit_of_measurement: "L"
    accuracy_decimals: 0
    icon: "mdi:waves"
    lambda: |-
      if (id(well_water_level_sensor).state != NAN) 
        {
        float distanceToWater = id(well_water_level_sensor).state ; // distance entre capteur et eau en m

        float sensorToGroundDisctance = 7.0; // distance entre capteur et sol en m

        float wellRadius = 0.50; // rayon du puits en m

        float water_level = sensorToGroundDisctance - distanceToWater;
        
        return 3.14159 * (wellRadius*wellRadius) * water_level * 1000;
        } 
      else 
        {
        return 0;
        }
    update_interval: ${update_interval_distance_measurement}

  - platform: template
    name: "Volume d'eau utile du puits"
    id: wellUsfulllWaterVolume
    state_class: "measurement"
    unit_of_measurement: "L"
    icon: "mdi:waves"
    accuracy_decimals: 0
    lambda: |-
      if (id(well_water_level_sensor).state != NAN) 
        {
        float distanceToWater = id(well_water_level_sensor).state ; // distance entre capteur et eau en m

        float sensorToGroundDisctance = 7.0; // distance entre capteur et sol en m

        float pumpSecurityLevel = 0.40; // hauteur d'eau minimum pour le pompage en m

        float wellRadius = 0.50; // rayon du puits en m

        float water_level_usefull = sensorToGroundDisctance - pumpSecurityLevel - distanceToWater;

        return 3.14159 * (wellRadius*wellRadius) * water_level_usefull * 1000;
        } 
      else 
        {
        return 0;
        }
    update_interval: ${update_interval_distance_measurement}       

  - platform: template
    name: "Taux de remplissage puits"
    unit_of_measurement: "%"
    accuracy_decimals: 0
    state_class: "measurement"
    lambda: |-
      if (id(well_water_level_sensor).state != NAN) 
        {
        float distanceToWater = id(well_water_level_sensor).state ; // distance entre capteur et eau en m

        float sensorToGroundDisctance = 7.0; // distance entre capteur et sol en m

        float cur_water_level = sensorToGroundDisctance - distanceToWater;

        float max_well_water_level = 6.5;  // hauteur d'eau max du puits en m

        float min_well_water_level = 0.4;  // hauteur d'eau minimum pour le pompage en m

        float percentage = 100.0 * (1.0 - (cur_water_level - max_well_water_level) / (min_well_water_level - max_well_water_level));

        if (percentage < 0) 
          {
          return 0.0;
          }
        else if (percentage > 100) 
          {
          return 100.0;
          }
        
        return percentage;
        } 
      else 
        {
        return 0;
        }
    
    update_interval: ${update_interval_distance_measurement}

et voici ce que cela donne coté HA:

Malheuresement, ce capteur n’est au final pas du tout adapté à mon besoin. Mon puits est un cylindre béton de 7m de profonteur et 0,8 m de diamètre, le niveau d’eau est entre 1 et 3m jusqu’ici; l’angle mini du capteur et de 40°, ce qui représente une zone de détection théorique de 5 m de diamètre à 7m, donc entre les parois du puits, les tuyaux de pompage, la profondeur renvoyée est toujours de +/- 2m.

Je vous met donc tout cela à titre d’info, défois que cela puisse sercir un jour a quelqu’un.