
Watermeter lezen met raspberry en Inductieve NPN sensor Topic is solved
Moderators: leecollings, remb0
-
- Posts: 70
- Joined: Tuesday 28 March 2017 10:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Latest B
- Location: The Netherlands
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
My diode gives 3,3v
1,7v might be to low. Did you get the correct diode?

-
- Posts: 140
- Joined: Thursday 22 October 2015 21:14
- Target OS: Linux
- Domoticz version: 4.11539
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Well I checked the number on the diode (1n746a) and according to the specs this should be a 3,3v zener..
But it does give the readings but like a thousand to high.. (as in 0,001 reports as 1)
Hardware: Raspberry Pi 3, OTGW, 433MHz Superheterodyne 3310 RF Link
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
-
- Posts: 140
- Joined: Thursday 22 October 2015 21:14
- Target OS: Linux
- Domoticz version: 4.11539
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Could someone explain the bouncetime option ?
As my meter increases way to hard I must do some fine tuning.. And before I go and alter all kinds of options and break the whole thing....
I might have stumbled onto something. Maybe somebody can confirm..
When I enter my watermeter reading I only enter the liters not the numbers behind the comma..
As I read the first post again.. I notice that I shoul enter the whole number..
As in 592,123 meterstand = 592123 (and not what I did 592)
edit2 :
So I just did it
and with a small test it all worked just fine..
Will have to see in a few weeks if the meter is still accurate
For all the fans.. A pic
I just drilled a hole in the correct spot and bolted the sensor
Regards,
As my meter increases way to hard I must do some fine tuning.. And before I go and alter all kinds of options and break the whole thing....
I might have stumbled onto something. Maybe somebody can confirm..
When I enter my watermeter reading I only enter the liters not the numbers behind the comma..
As I read the first post again.. I notice that I shoul enter the whole number..
As in 592,123 meterstand = 592123 (and not what I did 592)
edit2 :
So I just did it

and with a small test it all worked just fine..
Will have to see in a few weeks if the meter is still accurate
For all the fans.. A pic

I just drilled a hole in the correct spot and bolted the sensor

Regards,
- Attachments
-
- IMG_0058.jpg (391.04 KiB) Viewed 3950 times
Hardware: Raspberry Pi 3, OTGW, 433MHz Superheterodyne 3310 RF Link
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
-
- Posts: 140
- Joined: Thursday 22 October 2015 21:14
- Target OS: Linux
- Domoticz version: 4.11539
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
O still one question,
Over time the meter will turn offline (red) this is just because no water has been used in a time period.
Is there some setting to set to not have the meter turn offline? (the meter will come online when water is used)
Over time the meter will turn offline (red) this is just because no water has been used in a time period.
Is there some setting to set to not have the meter turn offline? (the meter will come online when water is used)
Hardware: Raspberry Pi 3, OTGW, 433MHz Superheterodyne 3310 RF Link
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
-
- Posts: 70
- Joined: Tuesday 28 March 2017 10:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Latest B
- Location: The Netherlands
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Go to settings, meters and set the RFXMeter for water to 1000. Thats all
-
- Posts: 140
- Joined: Thursday 22 October 2015 21:14
- Target OS: Linux
- Domoticz version: 4.11539
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Well the meter is working and Have to see if the measurement is correct..( as said before I will check it after a week )
Bit different question and this may just be something cosmetic..
As seen in the picture it says I have consumed 134 Liters.. This is of course not correct (or at least I think so) I believe it should be 0,134
I say this because the total consumption seems about right..
Is this something which can be changed?
(RFXMeter is set to 1000 )
Bit different question and this may just be something cosmetic..
As seen in the picture it says I have consumed 134 Liters.. This is of course not correct (or at least I think so) I believe it should be 0,134
I say this because the total consumption seems about right..
Is this something which can be changed?
(RFXMeter is set to 1000 )
- Attachments
-
- Screen Shot 2017-11-20 at 07.42.34.png (25.69 KiB) Viewed 3913 times
Hardware: Raspberry Pi 3, OTGW, 433MHz Superheterodyne 3310 RF Link
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
- philchillbill
- Posts: 399
- Joined: Monday 12 September 2016 13:47
- Target OS: Linux
- Domoticz version: beta
- Location: Eindhoven. NL
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Your meter produces 1 pulse per liter so measuring 0,134 liters is impossible. The average water consumption per day in the Netherlands is 119 liters per person so 134 sounds dead right to me !
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
-
- Posts: 140
- Joined: Thursday 22 October 2015 21:14
- Target OS: Linux
- Domoticz version: 4.11539
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Ok Now I see what I am doing wrong..philchillbill wrote: ↑Monday 20 November 2017 15:20 Your meter produces 1 pulse per liter so measuring 0,134 liters is impossible. The average water consumption per day in the Netherlands is 119 liters per person so 134 sounds dead right to me !
I compare 1m3 with 1 liter .. and that is not correct..
1m3 = 1000 liters.. (thanks philchillbill)


Well anyway thanks for the answer

Last edited by Draakje on Tuesday 21 November 2017 16:01, edited 1 time in total.
Hardware: Raspberry Pi 3, OTGW, 433MHz Superheterodyne 3310 RF Link
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
- philchillbill
- Posts: 399
- Joined: Monday 12 September 2016 13:47
- Target OS: Linux
- Domoticz version: beta
- Location: Eindhoven. NL
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
No worries. but just to be correct: 1m3 is 1000 liters, not .001 liter. It's a cubic-meter of water. You have it the wrong way round (still).
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
-
- Posts: 204
- Joined: Monday 08 May 2017 20:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Belgium
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Hallo allemaal
Ik ben volop bezig mijn watermeter (België) uit te lezen.
Het betreft dit type meter:
. Je kan deze uitlezen met een hallsensor gezien er een uitsparing is, waarin deze past (links op de foto, zwart plastic kapje verwijderen en de op kabel gesoldeerde hall sensor inschuiven).
Ik gebruik een RPI 3. Op GPIO 21 (pin 40) steekt een KY024 (met hall sensor) dewelke een puls geeft elke keer als het meest rechtse getal (nr 2 op de foto, deciliter dus als ik het juist voor heb) 1x volledig rond gaat. Dus per liter krijg ik een puls door op mijn hall sensor. Dat werkt ook momenteel.
Ik gebruik een licht gewijzigd script;
Dit lijkt vrij goed te werken. Alleen als ik mijn kraan dichtdraai op het moment dat de magneet bij de hall sensor staat (en het ledje dus oplicht op de KY024), dan blijft de counter optellen.
Iemand enig idee aub?
Alvast bedankt!
Ik ben volop bezig mijn watermeter (België) uit te lezen.
Het betreft dit type meter:

Ik gebruik een RPI 3. Op GPIO 21 (pin 40) steekt een KY024 (met hall sensor) dewelke een puls geeft elke keer als het meest rechtse getal (nr 2 op de foto, deciliter dus als ik het juist voor heb) 1x volledig rond gaat. Dus per liter krijg ik een puls door op mijn hall sensor. Dat werkt ook momenteel.
Ik gebruik een licht gewijzigd script;
Code: Select all
import RPi.GPIO as GPIO
import time
import urllib
import os
idx = 90
#Reset TimerKeepAlive
TimerKeepAlive = 0
#Board is pin nr, BMC is GPIO nr
#Read output from water meter op pin 40
GPIO.setmode(GPIO.BOARD)
# Set GPIO 21 (Pin 40) als Input aditional as Pullup activated
GPIO.setup(40, GPIO.IN, pull_up_down = GPIO.PUD_UP)
#Functie callback
#Funtion used by interruptcall
def Interrupt(channel):
#Send counter to domoticz JSON
global Counter
Counter = 1
httpresponse = urllib.urlopen("http://192.168.1.190:8084/json.htm?type=command¶m=udevice&idx="+str(idx)+"&svalue="+str(Counter))
#For debug => print example of JSON-call
#print "JSON call = "+ str(url1)
print "Watermeter Counter = " + str(Counter)
#Interrupt-Event, NPN off a sensor is 1 and detection is 0
#Detection is 0,falling interupt
GPIO.add_event_detect(40, GPIO.FALLING, callback = Interrupt, bouncetime = 350)
try:
while True:
#Send every 50 minutes [300sec] an update to keep sensor alive in Domoticz
TimerKeepAlive = TimerKeepAlive + 1
print "Counting time " + str(TimerKeepAlive)
if TimerKeepAlive > 1800:
httpresponse = urllib.urlopen("http://192.168.1.190:8084/json.htm?type=command¶m=udevice&idx=90&svalue=0")
#For debug => print JSON-call
#print "JSON call = "+ str(url1)
TimerKeepAlive = 0
else:
time.sleep(1)
except KeyboardInterrupt:
GPIO.cleanup()
print "\nBye"
Iemand enig idee aub?
Alvast bedankt!
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
I build a watermeter based on a NodeMCU and LJ12A3-4-Z/BX and this is working fine. However the Arduino Sketch i used boots with the counter on 0 and starts couting until the next reboot (which is fine for now)
I`m sending the data to Domoticz every 5 minutes but Domoticz is adding the values to the counter. So for example if the count is 16 Liter the value of 16.00 is send every 5 minutes. The value for Domoticz is 16.00 after 5 minutes, 32.00 after 10 minutes, 48.00 after 15 minutes.
This is wrong and i need to change the IDX to be a Delta Counter (is this possible in domoticz?)
Device Type = Counter Incremental (Water 1000/m3)
Note: In the end i need to modify the arduino sketch to just send the total usage and keep the value during reboots. But for now i want to change the domoticz IDX
I`m sending the data to Domoticz every 5 minutes but Domoticz is adding the values to the counter. So for example if the count is 16 Liter the value of 16.00 is send every 5 minutes. The value for Domoticz is 16.00 after 5 minutes, 32.00 after 10 minutes, 48.00 after 15 minutes.
This is wrong and i need to change the IDX to be a Delta Counter (is this possible in domoticz?)
Code: Select all
/json.htm?type=command¶m=udevice&idx=258&svalue=16.00
Code: Select all
/json.htm?type=devices&rid=258
{
"ActTime" : 1512119268,
"ServerTime" : "2017-12-01 10:07:48",
"Sunrise" : "08:26",
"Sunset" : "16:24",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 939827.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"Counter" : "590.002 m3",
"CounterToday" : "282.293 m3",
"CustomImage" : 0,
"Data" : "590.002 m3",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 5,
"HardwareName" : "Dummy",
"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
"HardwareTypeVal" : 15,
"HaveTimeout" : false,
"ID" : "82258",
"LastUpdate" : "2017-12-01 10:06:48",
"Name" : "Water Meter",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" : [ 0 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "Counter Incremental",
"SwitchTypeVal" : 2,
"Timers" : "false",
"Type" : "General",
"TypeImg" : "counter",
"Unit" : 1,
"Used" : 1,
"ValueQuantity" : "",
"ValueUnits" : "",
"XOffset" : "0",
"YOffset" : "0",
"idx" : "258"
}
],
"status" : "OK",
"title" : "Devices"
}
Note: In the end i need to modify the arduino sketch to just send the total usage and keep the value during reboots. But for now i want to change the domoticz IDX
-
- Posts: 204
- Joined: Monday 08 May 2017 20:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Belgium
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Micha, after failing with the Python script, I got the LUA script working and it works great!Micha123 wrote: ↑Wednesday 06 September 2017 0:13 Im set LUA to DEVICE
Im checking the names again and again. I became that error message.
Maybe i test it with an other browser to start the lua script but i dont think what the problem is....
tested again, script startet, readed the Value from virtual Counter, so i restart the pi and after a simply restart i got the error again.
Your error is shown, because you didn't make the Uservariable WaterMeter in Domoticz!
So in Domoticz > Setup > more > user variables
Name WaterMeter
type integer
value "current stand of your real meter"
Add !
-
- Posts: 204
- Joined: Monday 08 May 2017 20:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Belgium
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Louis22, the correct command is:LouiS22 wrote: ↑Monday 23 October 2017 10:19Have you found the bug yet?Trigun wrote: ↑Friday 13 October 2017 21:33something happend.but unfortunately nothing happens on the other device.Code: Select all
2017-10-13 21:29:06.049 LUA: Water usage is still 173.005m3 2017-10-13 21:29:06.050 LUA: wget http://192.168.1.94:8080/json.htm?type=command¶m=udevice&idx=157&svalue=173005 -O /dev/null 2017-10-13 21:29:06.067 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_Watermeter.lua
i just found out that I never see the following print:is this correct or should it only set once, in the beginning?Code: Select all
print("Water usage is set to " .. sWaterUsageTot / 1000 .. "m3 ");
Code: Select all
os.execute('curl "http://192.168.1.190:8084/json.htm?param=udevice&type=command&idx=91&svalue='..sWaterUsageTot..'"')
Code: Select all
os.execute('curl "http://192.168.1.190:8084/json.htm?param=udevice&type=command&idx=91&svalue='..sWaterUsageTot..' " ')
- LouiS22
- Posts: 433
- Joined: Friday 27 February 2015 13:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Budapest, Hungary
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Mate, THANK YOU! Indeed that was my problem, now it's okay and I'm happysammyke007 wrote: ↑Friday 01 December 2017 17:37Louis22, the correct command is:LouiS22 wrote: ↑Monday 23 October 2017 10:19Have you found the bug yet?Trigun wrote: ↑Friday 13 October 2017 21:33
something happend.but unfortunately nothing happens on the other device.Code: Select all
2017-10-13 21:29:06.049 LUA: Water usage is still 173.005m3 2017-10-13 21:29:06.050 LUA: wget http://192.168.1.94:8080/json.htm?type=command¶m=udevice&idx=157&svalue=173005 -O /dev/null 2017-10-13 21:29:06.067 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_Watermeter.lua
i just found out that I never see the following print:is this correct or should it only set once, in the beginning?Code: Select all
print("Water usage is set to " .. sWaterUsageTot / 1000 .. "m3 ");
the HTTP link needs to be in between " " so when I seperate it for readability:Code: Select all
os.execute('curl "http://192.168.1.190:8084/json.htm?param=udevice&type=command&idx=91&svalue='..sWaterUsageTot..'"')
Code: Select all
os.execute('curl "http://192.168.1.190:8084/json.htm?param=udevice&type=command&idx=91&svalue='..sWaterUsageTot..' " ')

- LouiS22
- Posts: 433
- Joined: Friday 27 February 2015 13:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Budapest, Hungary
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
And the last question: which virtual sensor should I use on my Master? Counter or Counter incremental?
-
- Posts: 204
- Joined: Monday 08 May 2017 20:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Belgium
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Just create it with the JSON command from the first page of this post. Don't forget to change the IP!
I'll write a full guide tomorrow if OK for the authors because everything is spread now...
I'll write a full guide tomorrow if OK for the authors because everything is spread now...
- philchillbill
- Posts: 399
- Joined: Monday 12 September 2016 13:47
- Target OS: Linux
- Domoticz version: beta
- Location: Eindhoven. NL
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Go to Setup -> Settings -> Other -> Sensor Timeout and set a value that's long enough for you. I have 4320 which is 72 hours = 3 days.
Alexa skills author: EvoControl, Statereport, MediaServer, LMS-lite
-
- Posts: 140
- Joined: Thursday 22 October 2015 21:14
- Target OS: Linux
- Domoticz version: 4.11539
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Thanks!philchillbill wrote: ↑Tuesday 05 December 2017 9:32
Go to Setup -> Settings -> Other -> Sensor Timeout and set a value that's long enough for you. I have 4320 which is 72 hours = 3 days.
Hardware: Raspberry Pi 3, OTGW, 433MHz Superheterodyne 3310 RF Link
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
Software: Ubuntu 16.04, Domoticz v3.5468, WiringPi, rc-switch
-
- Posts: 390
- Joined: Wednesday 30 November 2016 11:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Watermeter lezen met raspberry en Inductieve NPN sensor
Hi Sammyke007,sammyke007 wrote:Just create it with the JSON command from the first page of this post. Don't forget to change the IP!
I'll write a full guide tomorrow if OK for the authors because everything is spread now...
I followed your feedback for a while and just wanted to say thanks! It’s been a great help!!
I am looking forward to your guide!
Grtz
Sent from my iPhone using Tapatalk
-
- Posts: 204
- Joined: Monday 08 May 2017 20:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Belgium
- Contact:
Who is online
Users browsing this forum: No registered users and 1 guest