(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