{"id":2641,"date":"2026-07-21T18:54:49","date_gmt":"2026-07-21T16:54:49","guid":{"rendered":"https:\/\/labalec.fr\/erwan\/?p=2641"},"modified":"2026-07-21T18:54:50","modified_gmt":"2026-07-21T16:54:50","slug":"water-meter","status":"publish","type":"post","link":"https:\/\/labalec.fr\/erwan\/?p=2641","title":{"rendered":"water meter"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/labalec.fr\/erwan\/?p=1594\" data-type=\"link\" data-id=\"https:\/\/labalec.fr\/erwan\/?p=1594\" target=\"_blank\" rel=\"noreferrer noopener\">A long time ago<\/a> i had set a water mater which i used from jeedom.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Looking past, it was overkill : an arduino + a sdcard reader + an ethernet port + a cpl to plug back to my network.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Too many possible failures, too man,y restart\/fixing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since i dropped jeedom and moved on with Homeassistant, i decided to rebuild my water meter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">and here it is : a simple integration in homeassistant.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>esphome:\n  name: web-ca9a1c\n\nesp32:\n  board: esp32dev\n  framework:\n    type: arduino\n\nwifi:\n  ssid: \"dd-wrt24iot\"\n  password: \"mypassword\"\n  min_auth_mode: WPA\n  fast_connect: true\n\n  manual_ip:\n    static_ip: 192.168.1.244\n    gateway: 192.168.1.250\n    subnet: 255.255.255.0\n\napi:\n\nota:\n  - platform: esphome\n\nweb_server:\n  port: 80\n\nsensor:\n  # 1. Compteur d'eau (D\u00e9bit + Totalisateur int\u00e9gr\u00e9)\n  - platform: pulse_counter\n    pin:\n      number: GPIO12\n      mode: INPUT_PULLUP\n    use_pcnt: false # Obligatoire pour d\u00e9passer les 13us sous ESP-IDF\n    name: \"D\u00e9bit d'eau instantan\u00e9\"\n    id: debit_eau_brut\n    update_interval: 60s\n    internal_filter: 50ms # Filtre antirebond physique pour l'ampoule Reed\n    count_mode:\n      rising_edge: DISABLE   # On ignore quand le contact s'ouvre\n      falling_edge: INCREMENT # On compte UNIQUEMENT quand l'aimant ferme le contact (passage \u00e0 la masse)\n    filters:\n      - multiply: 1.0 # 1 impulsion\/min = 1 L\/min (K=1)\n    unit_of_measurement: \"L\/min\"\n    \n    total:\n      name: \"Compteur d'Eau Index Total Eau\"\n      unit_of_measurement: \"L\"\n      state_class: total_increasing\n      device_class: water\n      icon: mdi:pulse\n\n  # 2. Force du signal Wi-Fi (dBm)\n  - platform: wifi_signal\n    name: \"Signal Wi-Fi Garage\"\n    update_interval: 60s\n\n  # 3. Dur\u00e9e de fonctionnement brute (secondes)\n  - platform: uptime\n    name: \"Uptime Garage\"\n    id: uptime_sensor\n    update_interval: 60s\n\ntext_sensor:\n  # 4. Conversion de l'Uptime en format lisible, compatible avec ESP-IDF\n  - platform: template\n    name: \"En ligne depuis\"\n    lambda: |-\n      int seconds = id(uptime_sensor).state;\n      int days = seconds \/ 86400;\n      seconds %= 86400;\n      int hours = seconds \/ 3600;\n      seconds %= 3600;\n      int minutes = seconds \/ 60;\n      return esphome::str_sprintf(\"%dd %02dh %02dm\", days, hours, minutes);\n    icon: mdi:clock-start\n    update_interval: 60s<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The esphome webpage.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"217\" src=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-1024x217.png\" alt=\"\" class=\"wp-image-2642\" srcset=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-1024x217.png 1024w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-300x63.png 300w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-768x162.png 768w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-1536x325.png 1536w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-2048x433.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The HA integration.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"414\" src=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-1-1024x414.png\" alt=\"\" class=\"wp-image-2643\" srcset=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-1-1024x414.png 1024w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-1-300x121.png 300w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-1-768x310.png 768w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-1-1536x621.png 1536w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2026\/07\/image-1-2048x828.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>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 <a href='https:\/\/labalec.fr\/erwan\/?p=2641' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[151,152],"tags":[],"class_list":["post-2641","post","type-post","status-publish","format-standard","hentry","category-esphome","category-homeassistant","category-151-id","category-152-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2641"}],"version-history":[{"count":1,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2641\/revisions"}],"predecessor-version":[{"id":2644,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2641\/revisions\/2644"}],"wp:attachment":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}