watermeter: reset today value?

Moderator: leecollings

Post Reply
gawel31
Posts: 10
Joined: Friday 11 July 2014 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

watermeter: reset today value?

Post by gawel31 »

hi,
I made a virtual watercounter that count rain water that i recover into a tank (with mysensors: https://www.mysensors.org/build/distance) . It is made to watering my plants. When it rains, it works fine and i can see each day volume recovered. But when it doesn't rain enough, i must refill my tank....and when i refill my tank, counter counts this volume as rain water. So i made a script to reset my counter but it only reset one value and not "Today" value...and it is this value that interest me! So i am not able to know rain water volume recovered.
Could you help me to solve my problem please?

Image

Code: Select all

volume_sensor = 'Gain Eau pluie cuve       /jour'
volume_sensor_id = 123

commandArray = {}
            if (devicechanged['Remplissage manuel cuve'] == 'On') then
            print('Remplissage manuel')
	     volume = 0
            commandArray[2] = {['UpdateDevice'] = volume_sensor_id .. "|0|" .. volume}
end

return commandArray
trixwood

Re: watermeter: reset today value?

Post by trixwood »

Try othervalues instead of devicechanged, in your code it only sets the volume to zero if you flip the switch to on... not when the switch is already on and you get new readings. You probably want something in the direction of:

Code: Select all

commandArray = {}
            if (devicechanged['Gain Eau pluie cuve'] and otherdevices['Remplissage manuel cuve'] == 'On') then
               print('Remplissage manuel')
               volume = 0
               commandArray[2] = {['UpdateDevice'] = volume_sensor_id .. "|0|" .. volume}
end

return commandArray
But then I am not sure how you implemented it but if I understand it correctly you have a (virtual) sensor that is measures the difference of the tank water height in m3 volume.(whatever source it's rain or refill).

And have a switch indicating rain/refill (or automatic/manual).

I would suggest 3 derived additional virtual sensors in addition to the "Gain Eau pluie cuve" sensor and the manual/auto switch

tank_rain
tank_refill
tank_usage

and a lue script that either updates the volume of tank_rain or tank_refill depending on the switch and the height of the water (volume) is positive.
or tank_usage if it's negative (or how you implemented it). In that way you can see all the information about your tank.

Or did you have an implementation like a water flow counter? (I mean I get confused with the distance meter, is it water flow or water height?)

Kinda curious how did you use the distance meter?
gawel31
Posts: 10
Joined: Friday 11 July 2014 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: watermeter: reset today value?

Post by gawel31 »

hi,
Thanks trixwood! This solution is nice. I'll try to make it automatic.
My sensor is really a distance sensor and not a flow sensor. It is placed at the top of the tank. A script read height values two times a day. The script knows the surface of the tank (sorry for my bad English..... :oops: ) and if i know difference of water height, i can calculate volume.
trixwood

Re: watermeter: reset today value?

Post by trixwood »

Only two times a day? For rain that is probably ok. But how to you handle refill, water usages? You have to do more readings at time like that?
btw do you have link or picture of the mysensor and how you build it?

Cuz I have been wondering myself, how to handle refill and dispense, and I like the idea of a distance sensor in the tank and two flow meters (http://www.ebay.com/itm/1PC-Water-Flow- ... 3cd68fbcf1, http://diyhacking.com/arduino-flow-rate-sensor/) for dispense and refill. I thought about 3 flow meters and no distance, but rain is to slow, so the distance meter is very nice solution indeed! Also this solution will detect leakage (if other two flow meters are 0, and tank level is lowering then there is some leakage ;-)

But then again with more readings from the distance sensor, those flow sensors might not be needed. But it is less accurate and no leak detection.

Please share your solution. very curious.
gawel31
Posts: 10
Joined: Friday 11 July 2014 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: watermeter: reset today value?

Post by gawel31 »

Yes only two times...but i am still working on this system and perahps it will evolve. For the moment i just want to know if i will save the planet with saving rain water!! :lol:
The only picture for mysensors is this one but it is closed into a waterproof box:
Image
You will find everything into those links and it is very simple to make:
- mysensors Gateway:https://www.mysensors.org/build/serial_gateway
-connecting the radio module: https://www.mysensors.org/build/connect_radio
- distance sensor: https://www.mysensors.org/build/distance

Here are my two tanks with a pump. Rain water comes from the roof of a garden shed:
Image
Image

Everything is powered by a solar panel:
Image
Image
And my plants are watered by a old system i had... Normaly it must make drops ans there is no pump (gravity) but with a pump it works great and faster!! :lol:

Image

an advertisement of this system: (it is french !!! :lol: )
Image

And i am still waiting this level sensor from china to stop the system if there is not enough water into the tank:
Image

Watering duration can be set by a switch selector:
Image

There is watering or not depending on:
- probability of rain: http://domotique.web2diz.net/?p=392
- rain already fallen: weatherunderground
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest