Garden watering Topic is solved

Moderator: leecollings

Post Reply
JuanUil
Posts: 500
Joined: Friday 22 May 2015 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11083
Location: Asten NB Nederland
Contact:

Garden watering

Post by JuanUil »

Hi Folks,

I have automated my garden watering but I am facing a problem:
I have a rainmeter and a uservariable "regenteller"
what I want is this:
when there has been no rain during the past 24 hours (derived from my rainmeter) the uservariable should be risen with 1.
when I make a script in lua where I say
if (regenmeter==0 and hour == 23 and minute== 10) then

the uservariable gets raised with about 60 (all minute 10)

when I include seconds the update sometimes fails and regenteller i not raised.

Is there a way to simply raise regenteller with 1 when there was no rain and the time is at a certain point?

thanks for your replies

Jan
Your mind is like a parachute,
It only works when it is opened!

RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
Lorccan
Posts: 32
Joined: Wednesday 21 December 2016 10:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Garden watering

Post by Lorccan »

(I think I understand you, but do post back if not!)

If your conditional test is correct, you just need to say:

regenteller = regenteller+1

If you need to use another variable to increase the value of regenteller, you need to ensure that you round up or down so that it's also an integer:

regenteller = regenteller+math.floor(othervariable)
JuanUil
Posts: 500
Joined: Friday 22 May 2015 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11083
Location: Asten NB Nederland
Contact:

Re: Garden watering

Post by JuanUil »

Hi Lorccan,

Thnx for your reply.
I do exactly what you said:
regenteller is regenteller+1

the problem is that during minute 10 regenteller is raised constantly with 1 until minute is 11 so regenteller is then 60 or so.
When I include the seconds so hour==23 minutes==10 and seconds ==1 then sometimes there is no raisng of regenteller.

jan
Your mind is like a parachute,
It only works when it is opened!

RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
Lorccan
Posts: 32
Joined: Wednesday 21 December 2016 10:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Garden watering

Post by Lorccan »

Ah, got it!

How about making a dummy switch that you turn on once a day with a timer (e.g. At sunset). Then you use a device script to catch the 'On', check your rain meter, increment the var if necessary. You can then either switch the dummy off in the script or have an auto off after some seconds in its definition.
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Garden watering

Post by Egregius »

Why not retrieve the history of your rainmeter and go from there?
I'm currently also developing something for this. All tough I don't have a rainmeter.
My plan is to store the rain predection, an average of 3 weather providers, in a SQL table. Grab the data of the last 48 hours. That combined with the rain prediction of the next 48 hours should be good enough to decide if the garden needs water or not.
zicht
Posts: 272
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: Garden watering

Post by zicht »

Code: Select all

time = os.date("*t")
if((time.min % 3)==0)then

     >>>>  yourthing to fo with if then else and counter comes here'
     regenteller=regenteller +1

end
The above works ever 3 minutes but you can use it for whatever interval you have in mind.
Just change 3 to 10 in your case.
Make sure it is in a TIME script otherwise it would fire during the minute every time a device reports it status.

Hope this helps !
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
JuanUil
Posts: 500
Joined: Friday 22 May 2015 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11083
Location: Asten NB Nederland
Contact:

Re: Garden watering

Post by JuanUil »

Thanx zicht,

that works. As soon as I have the code completew I will post it so that evrybody can use it

Jan
Your mind is like a parachute,
It only works when it is opened!

RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest