Installing water meter on ESPHome using Sonoff Basic R1

Hey! I need some help. I am migrating from Domoticz where I had my water meter sensor (Cyble sensor 2 wire K1) connected to Sonoff Basic R1 on GPIO14 running ESPEasy 1.20. It worked just fine, there was setting “debounce time” set for 65 ms. Nothing really more. It was reporting one pulse = 1 liter.

I have created the following code in ESPHome:

sensor:
  - platform: pulse_counter
    pin: GPIO14
    internal_filter: 65ms
    name: 'Veemõõtja'
    id: water
    unit_of_measurement: 'l'
    state_class: measurement
    device_class: water
    icon: mdi:water
    accuracy_decimals: 3

Unfortunately nothing ever gets reported. I have tried different settings, without debouncing time, still nothing. Any ideas, what could be wrong?

If your sensor is between GND and GPIO, try with this:

pin:
      number: 14
      inverted: true
      mode:
        input: true
        pullup: true

In log?

Thanks, got it working. The code is now:

sensor:
  - platform: pulse_counter
    pin:
      number: 14
      inverted: true
      mode:
        input: true
        pullup: true
    internal_filter: 65ms
    count_mode:
      rising_edge: DISABLE
      falling_edge: INCREMENT
    name: 'Veemõõtja'
    id: water
    unit_of_measurement: 'l/min'
    state_class: measurement
    device_class: water
    icon: mdi:water
    accuracy_decimals: 0
    update_interval: 60s
    total:
      name: 'Veekulu'
      unit_of_measurement: 'm³'
      state_class: total_increasing
      device_class: water
      icon: mdi:water
      accuracy_decimals: 3
      filters:
        - multiply: 0.001

Nice you got it working :+1: