Page 2 of 2

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Thursday 30 May 2019 19:26
by Justintime
sincze wrote: Thursday 30 May 2019 18:59 Image of your devices in espeasy would come in handy now :)

if typo then no calculation :)
I have checked typo 100 times....i just copy and pasted IDX 501 is the Incemental counter and IDX 502 dummy waterflow.

Code: Select all

On System#Boot do     							// When the ESP boots, do
   TaskValueSet 4,1,0							// TaskValueSet TASKnr,VARnr,Value, Reset the Liters counter to 0
   TaskValueSet 4,2,0							// Previous Counter used for memory 
   TimerSet,1,60      								// Set Timer 1 for the next event in 60 seconds
EndOn
 
On Watermeter#Count do						// When Pulse is detected
	if [Watermeter#Count] > 0
		TaskValueSet 4,1,[Watermeter#Count]		// Set the Pulse to the Liters dummy sensor
	endif
EndOn

on Rules#Timer=1 do  							// When Timer 1 expires, do
	if [Liters#Liters] > 0 or [Liters#Previous] > 0		// Only send value if amount of Liters > 0 else 'keep the change ;-)'
		SendToHTTP 192.168.1.XX,XX,/json.htm?type=command&param=udevice&idx=502&nvalue=0&svalue=[Liters#Liters]
		TaskValueSet 4,2,[Liters#Liters]
		TaskValueSet 4,1,0						// TaskValueSet TASKnr,VARnr,Value, Reset submitted Liters counter to 0
	endif
	TimerSet,1,60      							// Set Timer 1 for the next event in 60 seconds
endon

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Thursday 30 May 2019 19:57
by sincze
Question Why are you using:

Code: Select all

		TaskValueSet 4,2,[Liters#Liters]
		TaskValueSet 4,1,0
It seems your liters device is not at device number 4 but number 2 ?

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Thursday 30 May 2019 21:17
by Justintime
sincze wrote: Thursday 30 May 2019 19:57 Question Why are you using:

Code: Select all

		TaskValueSet 4,2,[Liters#Liters]
		TaskValueSet 4,1,0
It seems your liters device is not at device number 4 but number 2 ?
Ow mannn the lights has come on..... i am not a programmer but now you gave that hint i understand the TasksetValueSet. Again something learned.
Thanks!!! :!: :!: :!:

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Thursday 20 June 2019 21:45
by kimot
All this is very nice, I am using incremental counter for energy consumption for my el. floor heating thermostat.
I am sending values the same way. ( many of them per day ).
BUT.
Now I have got new sensor - water tank level and consumption measuring.
And because I only send one to two values ​​a day, I found wrong function for incremental counter.
You can see here:

https://www.domoticz.com/forum/viewtopi ... =6&t=28345

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Thursday 01 October 2020 22:00
by Jojik1
Please, does anyone know why I have ESP in "Generic - Dummy Device / Liters"
one VALUES item??
How can I add more?
The m3 measurement already works perfectly.
values.png
values.png (14.63 KiB) Viewed 3900 times

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Thursday 01 October 2020 22:29
by Jojik1
OK then!
Output Data Type: Triple
according to the instructions was Single

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Wednesday 30 December 2020 15:26
by lazaruss72
hello,

this thread is really very good and has helped me a lot with my project.
i used a proximity sensor LJ18A3-4-Z-BX instead of the infrared sensor TCRT5000. This works very well.

@sincze: thanks a lot for the waterflow script. that works decent too. but i have a question about that and maybe someone can help me:

The waterflow counter (dummy device in ESPEasy and domoticz) always stays at the last value, even if no water is running.
water1.png
water1.png (8.03 KiB) Viewed 3686 times
water2.png
water2.png (9.76 KiB) Viewed 3686 times

in line 17 the counter is actually reset, isn't it?
(TaskValueSet 2,1,0)

Code: Select all

On System#Boot do     							// When the ESP boots, do
   TaskValueSet 2,1,0							// TaskValueSet TASKnr,VARnr,Value, Reset the Liters counter to 0
   TaskValueSet 2,2,0							// Previous Counter used for memory 
   TimerSet,1,60      								// Set Timer 1 for the next event in 60 seconds
EndOn
 
On Watermeter#Count do							// When Pulse is detected
	if [Watermeter#Count] > 0
	   TaskValueSet 2,1,[Watermeter#Count]		// Set the Pulse to the Liters dummy sensor
	endif
EndOn

on Rules#Timer=1 do  							// When Timer 1 expires, do
	if [Liters#Liters] > 0 or [Liters#Previous] > 0		// Only send value if amount of Liters > 0 else 'keep the change ;-)'
		SendToHTTP 192.168.0.xx:8080/json.htm?type=command&param=udevice&idx=651&nvalue=0&svalue=[Liters#Liters]
		TaskValueSet 2,2,[Liters#Liters]
		TaskValueSet 2,1,0						// TaskValueSet TASKnr,VARnr,Value, Reset submitted Liters counter to 0
    	endif
       TimerSet,1,60      						// Set Timer 1 for the next event in 60 seconds
endon

Hopefully someone knows advice


many greetings
lazarus

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Wednesday 30 December 2020 15:51
by sincze
Mmm should go back to 0 indeed
Watermeter.JPG
Watermeter.JPG (90.65 KiB) Viewed 3685 times

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Wednesday 30 December 2020 16:16
by cyberclwn
Hi,

Maybe the issue is that in your screenshot the counter is called "Liter", and in script you use "Liters"?

Code: Select all

[Liters#Liters]

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Wednesday 30 December 2020 16:38
by sincze
:lol: :D excellently spotted.

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Wednesday 30 December 2020 17:44
by lazaruss72
I am such a dork :lol: :lol: :lol:
thank you very much for the help.
After the change and a reboot the correct values are displayed in the log and the variables are filled correctly.
However, I now have a very strange error message and nothing is transferred to domoticz:
water3.png
water3.png (64.4 KiB) Viewed 3677 times
the rules state it correctly

Code: Select all

on Rules#Timer=1 do  							// When Timer 1 expires, do
	if [Liters#Liters] > 0 or [Liters#Previous] > 0		// Only send value if amount of Liters > 0 else 'keep the change ;-)'
		SendToHTTP 192.168.0.23:8080/json.htm?type=command&param=udevice&idx=651&nvalue=0&svalue=[Liters#Liters]
		TaskValueSet 2,2,[Liters#Liters]
		TaskValueSet 2,1,0						// TaskValueSet TASKnr,VARnr,Value, Reset submitted Liters counter to 0
        endif
       TimerSet,1,60      							// Set Timer 1 for the next event in 60 seconds
endon
another misspelling?

i have already created a new ruleset, re-entered the command, turned rules off and on again, rebooted. nothing changes this message. as soon as values are to be transferred this error comes up....

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Wednesday 30 December 2020 18:56
by lazaruss72
I figured out that the SendToHTTP command is not necessary.
the value is already sent to the stored controller via HTTP. in the dummy sensor the IDX is specified.

I have removed the line and it runs quite well so far.
water4.png
water4.png (59.74 KiB) Viewed 3676 times

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Wednesday 30 December 2020 21:31
by cyberclwn
lazaruss72 wrote: Wednesday 30 December 2020 17:44
the rules state it correctly

Code: Select all

...
SendToHTTP 192.168.0.23:8080/json.htm?type=command&param=udevice&idx=651&nvalue=0&svalue=[Liters#Liters]
...
another misspelling?
Uh, well ... actually ... yes :lol:

I see you fixed it without the SendToHTTP, which is also good.
But if you want to use SendToHTTP again, the syntax is like:

Code: Select all

SendToHTTP 192.168.0.23,8080,/json.htm?type=command&param=udevice&idx=651&nvalue=0&svalue=[Liters#Liters]
Seperate <ip>,<port>,<url> with comma's

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Thursday 31 December 2020 0:41
by lazaruss72
Seperate <ip>,<port>,<url> with comma's
this is so diabolical
:evil: :evil:

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Thursday 02 September 2021 11:19
by lamama1234
sincze wrote: Wednesday 11 July 2018 20:30
JHO01 wrote: Tuesday 10 July 2018 23:14 Why not , do you mind sharing the code for the rules?
Sure.

Code: Select all

On System#Boot do     							// When the ESP boots, do
   TaskValueSet 4,1,0							// TaskValueSet TASKnr,VARnr,Value, Reset the Liters counter to 0
   TaskValueSet 4,2,0							// Previous Counter used for memory 
   TimerSet,1,60      								// Set Timer 1 for the next event in 60 seconds
EndOn
 
On Watermeter#Count do						// When Pulse is detected
	if [Watermeter#Count] > 0
		TaskValueSet 4,1,[Watermeter#Count]		// Set the Pulse to the Liters dummy sensor
	endif
EndOn

on Rules#Timer=1 do  							// When Timer 1 expires, do
	if [Liters#Liters] > 0 or [Liters#Previous] > 0		// Only send value if amount of Liters > 0 else 'keep the change ;-)'
		SendToHTTP 192.168.***.***,8080,/json.htm?type=command&param=udevice&idx=****&nvalue=0&svalue=[Liters#Liters]
		TaskValueSet 4,2,[Liters#Liters]
		TaskValueSet 4,1,0						// TaskValueSet TASKnr,VARnr,Value, Reset submitted Liters counter to 0
	endif
	TimerSet,1,60      							// Set Timer 1 for the next event in 60 seconds
endon
Remember that you need an additional device to do the counting!
Wemos_Domoticz.JPG
Hi sincze & sorry for resuscitating this old post.

I followed your good guidelines, but noticed that your ESPEasy code only send actual water usage data to Domoticz. Did you have add data for water flow, i.e. liters per minutes?

Thanks

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Thursday 02 September 2021 16:00
by sincze
Yes every minute I send the used amount of liters (= volume).
In domoticz I add that amount to the watermeter value for the total counter to be increased.

Re: Water meter ESPeasy Wemos TCRT5000 WIFI

Posted: Friday 03 September 2021 16:42
by azonneveld
I recently switched from using a prox (hall sensor) to this infrared version.
At first the counts were off but after changing settings, the reading is now accurate.
Settings are in the attachment.

I am using espeasy on a nodemcu v2 to read the sensor.
ESP software: ESP_Easy_mega_20210503_normal_ESP8266_4M1M