This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Irrigation program
#19
(11.05.2022, 11:42)costelservice@gmail.com Wrote: Hello!
How do I start this script at a certain time, selecting the days of the week? The selection will be made by the user.
Thank you!

Hi , you can creat a new object and on the new object creat a scheduler then remote irrigation script.
Code:
[code]value = event.getvalue()
if value == true then
  os.sleep(3)
  grp.write("8/0/8",false)
end
function dosleep(obj)
  local timer = grp.getvalue(obj)
  timer = tonumber(timer)
  if timer then
    if timer < mintimer then
      timer = mintimer
    elseif timer > maxtimer then
      timer = maxtimer
       
    end
    os.sleep(timer *60 ) -- minutes -> seconds
  end
end


mintimer = 0.1 -- minimum timer value in minutes
maxtimer = 30 -- maximum timer value in minutes

objects = {
      {
    output = '8/2/0',
    timer = '33/5/8',   
    enable = '33/5/9',



  }
}


for _, item in ipairs(objects) do
  if grp.getvalue(item.enable) then
    grp.write(item.output, true)
    dosleep(item.timer)
    grp.write(item.output, false)
    grp.write('8/1/0',false)

   

 
  end
end
Reply


Messages In This Thread
Irrigation program - by Domoticatorino - 01.08.2016, 22:34
RE: Irrigation program - by Domoticatorino - 02.08.2016, 19:59
RE: Irrigation program - by admin - 03.08.2016, 06:19
RE: Irrigation program - by Domoticatorino - 18.10.2016, 11:46
RE: Irrigation program - by admin - 18.10.2016, 12:02
RE: Irrigation program - by Domoticatorino - 20.04.2018, 23:21
RE: Irrigation program - by admin - 25.04.2018, 06:21
RE: Irrigation program - by Udelae - 11.03.2019, 17:17
RE: Irrigation program - by admin - 12.03.2019, 07:35
RE: Irrigation program - by Udelae - 12.03.2019, 08:11
RE: Irrigation program - by admin - 12.03.2019, 08:30
RE: Irrigation program - by Udelae - 12.03.2019, 13:18
RE: Irrigation program - by CristianAgata - 30.06.2021, 14:36
RE: Irrigation program - by Udelae - 12.03.2019, 14:36
RE: Irrigation program - by DanielB - 21.03.2019, 11:22
RE: Irrigation program - by Daniel - 30.06.2021, 14:57
RE: Irrigation program - by CristianAgata - 30.06.2021, 16:12
RE: Irrigation program - by balatis - 12.05.2022, 11:47
RE: Irrigation program - by David - 24.10.2023, 08:29
RE: Irrigation program - by Daniel - 24.10.2023, 08:38
RE: Irrigation program - by David - 24.10.2023, 08:47
RE: Irrigation program - by admin - 24.10.2023, 08:50
RE: Irrigation program - by josep - 24.10.2023, 09:17
RE: Irrigation program - by admin - 24.10.2023, 09:18
RE: Irrigation program - by David - 24.10.2023, 09:39
RE: Irrigation program - by admin - 24.10.2023, 09:45

Forum Jump: