Water-meter Sensor, help configuring it

 - type: vertical-stack
    cards:
      - type: custom:card-modder
        card:
          type: custom:gauge-card
          title: Temperatura CPU
          entity: sensor.cpu_temp
          scale: 40px
          severity:
            red: 65
            green: 0
            amber: 55
        style:
          background-repeat: no-repeat
          background-color: rgba(50,50,50,0.3)
          background-size: 100% 68px
          border-radius: 12px
          border: solid 1px rgba(100,100,100,0.3)
          box-shadow: 4px 4px rgba(0,0,0,0.4)
          color: white

each card has custom-card-modder and the style shown below

yeah, I thought about that, but to be honest - my daily usage is “just for fun”, and the total counter is more important to me, as it’s the one that my water usage invoices depend on :wink: so I’m thinking about it like about a “solid number” while daily/monthly usage is just for my “internal statistics”.

on the other hand - I could set up more counters on tasmota [up to 4 in total], so maybe will use your tip with additional daily counter set up on the same wemos board, making it independent from HA

hey use this https://github.com/arendst/Sonoff-Tasmota/wiki/PZEM004T,-Wemos-D1-Mini-and-a-1602-I2C-display for monitor Power.

How did you modified your two automatisation to integrate this shell command ? I am quiet new with HA ?

Inside your configuration.yaml, you need to put these:

shell_command:
  water_meter_reset: 'curl http://sonoffIP/cm?cmnd=counter1%200'
script:
  water_meter_reset:
    sequence:
      - service: shell_command.water_meter_reset

If you already have script: or a scripts.yaml you ll need to place the code inside the correct file.
If you have everything inside your configuration.yaml then just add them there under the correct headers

yes I already did this integration yesteday but the command is not sent :frowning:
In fact, the right ssh command is more: curl “http://sonoffIP/cm?cmnd=counter1%200”, so changing water_meter_reset: ‘curl “http://sonoffIP/cm?cmnd=counter1%200”’ does not work too :frowning:

I Don’t know where the problem comes from :frowning: …. maybe I will try with a direct MQTT send command….

To be honest i dont use it anymore.
I had to run back to previous backups to find the code.
So i cant troubleshoot it for ya, perhaps the tasmota commands were changed?

no coz if I ssh the curl command directly, it’s working …… but it seems the script is not executed. I run it via the service menu of HA for testing…… and no reset command arrives in tastmota

hy cann you share the espeasy Code please ?

1 Like

I just uploaded this on thingiverse for the Elster v200 meter in case anyone is looking for a cheap and simple solution: https://www.thingiverse.com/thing:4425795

This thread goes in many directions, but I for one did not find an answer to the question I had: How to measure flow with a Hall effect flow sensor directly connected to an RPi?

FWIW, this was my solution, that seems to work (not sure yet if accurate or not):

binary_sensor:
  - platform: rpi_gpio
    ports:
      14: watermeter

sensor:
  - platform: statistics
    name: pulses_per_minute
    entity_id: binary_sensor.watermeter
    max_age:
      minutes: 1
    sampling_size: 760 # max 2 * 38 * 10 L/min
    precision: 0

  - platform: template
    sensors:
      flow_rate:
        friendly_name: "Flow Rate"
        value_template: >-
          {{(states('sensor.pulses_per_minute')|int / 76)|float|round(1)}}
        unit_of_measurement: 'L/min'
        entity_id: 
        - sensor.pulses_per_minute

My sensor’s formula is: F = 38 * Q (L/min).

Also, remove the sensor from the recorder configuration, otherwise it will litter the logbook.

2 Likes

Great work. I was hoping to do the same - I had a leak in irrigation system and paid a huge bill unfortunately :frowning: I am begginer and not much experience with Home Assistant. Can you give me a hint which Sonoff you used? And how you connect the remaining cables from the sensor? I reckon input for Sonoff you have 230V, then I see red cable that is powering the sensor with 5V from Sonoff, what about other 2 cables from the sensor?

Hey there @Grzegorz_Mikulski ,
The other two wires from the sensor should go to ground (black) and to a GPIO (colored).
The chip is a sonoff basic and it has no pins on it, just holes, where you will have to solder the pins.
Check this picture:

In my case, the sensor needed 5v to operate, so i had to find a 5v on the sonoff chip.
Some sensors operate with 3.3v so you could use the pins as displayed in the picture.

Then in the tasmota firmware you select which sensor is connected in each pin.

By the way, i ended up redoing my whole set up, bought a brass sensor (got rid of the plastic one) and wired the whole thing to an ESP32 chip flashed with ESPhome: https://esphome.io/components/sensor/pulse_counter.html

Thanks for your inputs @krash.

I was thinking about brass meter myself, but it seems more complicated. Can it be any meter with pulse counter built in? I saw they only have 2 wires, what are they for and how to connect to ESP32?

I have an ESP-WROOM-32 I wanted to use to integrate my Bluetooth temperature sensors, but range was poor so I could use it in another project.

The esp should work ok, i have something similar.
Which meter did you get with two wires? A couple i’ve used before, all had 3 wires (Positive, Ground and signal)

Hello @krash I am looking for a way to read my water meter in HA, I have this here at the end I have ordered a Nodemcu and would like to work with either Tasmota or ESPEasy. I just wonder is it that easy with the wiring or do I still need resistors etc? Otherwise i will put 1 Wire on a Gpio and the other one to gnd. I am right!?! Spewa Water Meter

Follow Details:

Maximum switching voltage DC 28 volts
Maximum switching current DC 0.1 A
Maximum switching capacity DC 3 watts
including reed contactor mounted

I’m afraid I’m not the best person to answer to you :frowning:

First of all its all German and secondly my electrical knowledge is not that good.
Try finding an English spec sheet and maybe we could have a look at it?

I was looking to do the same but with a d1mini instead of the RPI… but how are you reporting the L/m in realtime? Thats the part I’m missing, sorry prob a silly question though :smiley: Thanks

I calculated the pulses needed to fill a specific container. I think it was 5l. After 10 tries I extracted an average. It’s the /76 in my code above