Page 1 of 1

Water usage meter using esp8266 and proximity sensor

Posted: Tuesday 12 May 2020 11:09
by azonneveld
Perhaps this post is useful for those measuring waterconsumption, or those who want to measure their waterconsumption

To measure the waterusage, I have implemented the watermeter as described here

Initially I used the 'puls counter' in ESPEASY as described by the obove example, but this generated false readings.
The false reading, are caused by the debounce timer. This timer is not restarted when a puls is received during the debounce time.

Therefor I changed the counting to normal switches, using rules.

Code: Select all

On System#Boot do
	timerset,6,30 // Data send Timer
Endon
On Rules#Timer=6 do //send data to domoticz
        timerset,6,10 // reset data send timer
	SendToHTTP <domoticz-ip,port>,/json.htm?type=command&param=udevice&idx=<meterIDX>&svalue=[Waterteller#Count]  //send update to domoticz
	TaskValueSet,2,1,0  //reset waterpuls counter
Endon

On Waterpuls#State do
	timerset,7,1
endon

On Rules#Timer=7 do
   	TaskValueSet,2,1,[Waterteller#Count]+1
endon
full description on how to make the watermeter, is available here as PDF

PS how to configure domoticz is not included yet

Re: Water usage meter using esp8266 and proximity sensor

Posted: Wednesday 13 May 2020 8:37
by jeroenkl
thxs!

Re: Water usage meter using esp8266 and proximity sensor

Posted: Friday 25 March 2022 21:46
by THBR
Hello,

I also use the 'puls counter' in ESPEASY as described by the above example, and also many false readings (high value peaks). Tried many settings without positive results.

So I disabled the counter in ESPEASY and made the two new devices as described in the attached PDF. However In Domoticz I get no readings of waterusage.

What's going wrong?

Thanks.

Re: Water usage meter using esp8266 and proximity sensor

Posted: Thursday 14 April 2022 16:59
by Gravityz
i think this design is not the best one.
also when you copy espeasy scripts you can not use them 1:1 if the setup is different.

i am using the pulsecounter without any problems but you need to know what is causing the false or spike pulses.
most of the time this is hardware related.

to help you out
i see 2 things which definately are not right.

TaskValueSet,2,1,0 writes value 0 into task 2, first entry(in your case DHT22 Temperatrure)
so this needs to be
TaskValueSet,4,1,0 (set the state back to zero.

the other
TaskValueSet,2,1,[Waterteller#Count]+1
needs to be
TaskValueSet,5,1,[Waterteller#Count]+1 (the counter is incremented.


personaly i do not think you need al those timers

if you get a pulse
go increment the counter
send that counter to domoticz

i think the Waterpulse state follows the state of the switch so if the switch is on it is 1, if not it is 0

so the trigger should be
On Waterpuls#State=1 do
increment counter
send it to domoticz
reset the state to zero so it does not get triggered multiple times

also on the switch you created you ned to specify a debounce time otherwise if keeps on bouncing
start with 100ms
hope this helps

Re: Water usage meter using esp8266 and proximity sensor

Posted: Sunday 01 May 2022 20:13
by THBR
Hi Gravityz,

Thanks for the info and sorry for the late response.

I am a rookie in this field...

I have implemented your tips and changes and in esp easy both devices seem to work fine now. Used liters are now displayed in esp easy under "count:".

However, the data (used liters) is not visible in Domoticz. There the counter remains at zero/is not updated?

But if I in the browser e.g. input
192.***.*.***:8080/json.htm?type=command&param=udevice&idx=141&svalue=15 results a status/title "ok"/"updated" and then the water counter in Domoticz is updated fine!

Furthermore, no errors in the logs of ESP easy and Domoticz. I am using version ESP_Easy_mega_20220328_normal_ESP8266_4M1M Mar 28 2022.

The other devices in esp easy (P1 en DHT22 work fine).

Any idea what could be the cause of this?

Regards, Theo.

Re: Water usage meter using esp8266 and proximity sensor

Posted: Monday 02 May 2022 12:50
by Gravityz
and if you try this

SendToHTTP 192.168.1.xx,8080,/json.htm?type=command&param=udevice&idx=141&nvalue=0&svalue=[Waterteller#Count]

Re: Water usage meter using esp8266 and proximity sensor

Posted: Monday 02 May 2022 20:04
by THBR
Yes, that worked!

But, pff... now the actual value of the count in esp asy, e.g. 852, keeps increasing the waterteller in domoticz with 852 every 7? seconds without consuming water (a kind of loop). So in Domoticz its continues to increase by 852 liters every 7? second


My updated rules (devices unchanged):

On System#Boot do
timerset,6,30 // Data send Timer
Endon
On Rules#Timer=6 do //send data to domoticz
timerset,6,10 // reset data send timer
SendToHTTP 192.168.0.144,8080,/json.htm?type=command&param=udevice&idx=141&nvalue=0&svalue=[Waterteller#Count]
TaskValueSet,4,1,0 //reset waterpuls counter
Endon

On Waterpuls#State do
timerset,7,1
endon

On Rules#Timer=7 do
TaskValueSet,5,1,[Waterteller#Count]+1
endon


A part of the esp easy log (debug), see attachment.

Thanks again!