hugokernel / esphome-water-meter

Measurement of water consumption directly from your water meter with a TCRT5000 like sensor and ESPHome.
MIT License
64 stars 10 forks source link

2 Pulses per liter #3

Closed bonon closed 2 years ago

bonon commented 2 years ago

How should i edit code if my meter have 2 pulses per liter?

hugokernel commented 2 years ago

Hi,

You can try to edit watermeter.yaml and add filter like that:

  # TCRT5000 pulse counter
  # IO18 / GPIO18
  - platform: pulse_counter
    id: water_pulse_counter
    name: "${friendly_name} water consumption"
    pin: GPIO18
    update_interval: 2sec
    internal_filter: 10us
    unit_of_measurement: "L/min"
    accuracy_decimals: 0
    icon: "mdi:water"
    filters:
      # Divide by 60
      - multiply: 0.0167
      - multiply: 0.5
      - lambda: return abs(x);