Short version of using a Toon optical (gas)sensor to read your watermeter.
The full description and flow source can be found here:
flows.nodered.org
Place de optical sensor on the water meter (I have a sensus 620 from Vitens):

It does take some tinkering to get it positioned right, but the way it is positioned in above picture works for me.
The 3.5 mm jack electrical assignment:

I used a 3.5 mm female jack connector and soldered some Dupont jumper wires onto it, with the colors in the picture.
Then just plug the original white wire that came with the sensor in the sensor and the female jack.
Connect jumper wires to the Pi:

Using Dupont jumper wires might not be the best kind of wires to use, since they are very thin and are susceptible to electrical interference causing false readings.
Now I use Node-red to receive and convert the information from the sensor, but that's just how I do it.
In Node-red add a
pi gpiod node and configure like below:

Make sure you set the resistor to Pull-up and give enough Debounce time.
Change the host to whatever IP address your Pi is running at or use the
rpi-gpio in node if the pins are local to Node-red.
This will give you a 1 or 0 as output from the node everytime the metal part on the wheel in the meter passes along the optical sensor.
The sensor will generate a pulse when going from red plastic to metal and vice versa.
This means that 2 pulses equal 1 liter of water, so remember to divide the number of pulses by 2 to get water consumption in liters.
I also incorporated the P1 data into my Node-red flow, which I need to convert to DSMR 2.2 to feed my Meetmodule.
And since we have all the data at hand, why not output it over a TCP connection and MQTT as well.
This is what my flow looks like:
I don't think this forum is the right place to go into detail about this flow, but this is what happens:
- The PIN 7 feeds the counterGlobal with pulses and these are added up to the meter total and stored in memory
- From that total the previous reading from 15 seconds ago is subtracted, giving us the usage in liters
- This usage is multiplied by 4 to get a flowrate of liters per minute, which is also stored in memory
- Whenever the http in node receives a request, the stored values are returned as a JSON string: {"waterflow":"0","waterquantity":"438730"}
So besides feeding Toon with data this way, I can feed any number of devices with data.
Like for example Domoticz:

Or my Node-red Dashboard:
That's all folks!
