Pulse_meter counting withouth attached reed sensor (wemos d1 mini)

Hey guys,
i wanna use a wemos d1 mini esp32 to build a water meter. Currently i am facing the problem that it’s counting pulses without any attached sensor. Did i do sth. wrong in my config? Internal filter mode i tried with “edge” and “pulse”. Same behavior.

The reed contact will be attached to G and D1.

Here is my config…

esphome:
  name: wasserzaehler
  friendly_name: Wasserzaehler

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: 

ota:
  password: 

wifi:
  ssid:
  password: 
  domain: 

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Wasserzaehler Fallback Hotspot"
    password: 

captive_portal:

sensor:
  - platform: pulse_meter
    pin: D1
    unit_of_measurement: 'l/min'
    name: 'Wasser Durchfluss'
    internal_filter: 5000ms
    internal_filter_mode: pulse
    filters:
      - multiply: 10
    total:
      name: "Wasser Gesamtverbrauch"
      unit_of_measurement: "m³"
      device_class: water
      state_class: total_increasing
      accuracy_decimals: 3
      filters:
        - multiply: 0.01

If pin D1 is floating it could be picking up noise. Set the pin pull-down/up.

Hey Tom,
thanks for your response. I guess you mean like that, right? I can’t use this option. Pulldown gives me the error “Only GPIO16 supports pulldown.” and pullup isn’t supported on ESP8266.

sensor:
  - platform: pulse_meter
    pin: 
      number: D1
      mode:
        pulldown: true
        pullup: true
    unit_of_measurement: 'l/min'
    name: 'Wasser Durchfluss'
    internal_filter: 5000ms
    internal_filter_mode: pulse
    filters:
      - multiply: 10
    total:
      name: "Wasser Gesamtverbrauch"
      unit_of_measurement: "m³"
      device_class: water
      state_class: total_increasing
      accuracy_decimals: 3
      filters:
        - multiply: 0.01

Use a physical pull-up OR pull-down (not both) resistor. Anything from10k to 51k Ohm should do.

1 Like

Which you use depends on how you connect the switch.

Untitled

I would recommend the pull-up version. That way it is a lot harder to put a dead short on the 3.3V line if something goes wrong with your cabling to the reed switch.

1 Like

i had to edit the config. now it works with this setup.

sensor:
  - platform: pulse_meter
    pin: 
      number: D1
      mode: INPUT_PULLUP
      inverted: true
    unit_of_measurement: 'l/min'
    name: 'Wasser Durchfluss Haus'
    internal_filter: 5000ms
    internal_filter_mode: PULSE
    filters:
      - multiply: 10
    total:
      name: "Wasserverbrauch Haus Gesamt"
      unit_of_measurement: "m³"
      device_class: water
      state_class: total_increasing
      accuracy_decimals: 3
      filters:
        - multiply: 0.01
1 Like