Juil 212026
 

A long time ago i had set a water mater which i used from jeedom.

Looking past, it was overkill : an arduino + a sdcard reader + an ethernet port + a cpl to plug back to my network.

Too many possible failures, too man,y restart/fixing.

Since i dropped jeedom and moved on with Homeassistant, i decided to rebuild my water meter.

This time i used a simple esp32 card (with builtin wifi), flashed esphome (from my windows and python esphome library) and used the simple yaml below.

and here it is : a simple integration in homeassistant.

esphome:
  name: web-ca9a1c

esp32:
  board: esp32dev
  framework:
    type: arduino

wifi:
  ssid: "dd-wrt24iot"
  password: "mypassword"
  min_auth_mode: WPA
  fast_connect: true

  manual_ip:
    static_ip: 192.168.1.244
    gateway: 192.168.1.250
    subnet: 255.255.255.0

api:

ota:
  - platform: esphome

web_server:
  port: 80

sensor:
  # 1. Compteur d'eau (Débit + Totalisateur intégré)
  - platform: pulse_counter
    pin:
      number: GPIO12
      mode: INPUT_PULLUP
    use_pcnt: false # Obligatoire pour dépasser les 13us sous ESP-IDF
    name: "Débit d'eau instantané"
    id: debit_eau_brut
    update_interval: 60s
    internal_filter: 50ms # Filtre antirebond physique pour l'ampoule Reed
    count_mode:
      rising_edge: DISABLE   # On ignore quand le contact s'ouvre
      falling_edge: INCREMENT # On compte UNIQUEMENT quand l'aimant ferme le contact (passage à la masse)
    filters:
      - multiply: 1.0 # 1 impulsion/min = 1 L/min (K=1)
    unit_of_measurement: "L/min"
    
    total:
      name: "Compteur d'Eau Index Total Eau"
      unit_of_measurement: "L"
      state_class: total_increasing
      device_class: water
      icon: mdi:pulse

  # 2. Force du signal Wi-Fi (dBm)
  - platform: wifi_signal
    name: "Signal Wi-Fi Garage"
    update_interval: 60s

  # 3. Durée de fonctionnement brute (secondes)
  - platform: uptime
    name: "Uptime Garage"
    id: uptime_sensor
    update_interval: 60s

text_sensor:
  # 4. Conversion de l'Uptime en format lisible, compatible avec ESP-IDF
  - platform: template
    name: "En ligne depuis"
    lambda: |-
      int seconds = id(uptime_sensor).state;
      int days = seconds / 86400;
      seconds %= 86400;
      int hours = seconds / 3600;
      seconds %= 3600;
      int minutes = seconds / 60;
      return esphome::str_sprintf("%dd %02dh %02dm", days, hours, minutes);
    icon: mdi:clock-start
    update_interval: 60s

The esphome webpage.

The HA integration.