18.10.2016, 11:46
(03.08.2016, 06:19)admin Wrote: You can create a sequence with any number of outputs this way, just modify the parameters and object list to suit your needs:
Code:mintimer = 5 -- minimum timer value in seconds
maxtimer = 60 -- maximum timer value in seconds
objects = {
{
output = '1/1/1',
timer = '2/1/1',
},
{
output = '1/1/2',
timer = '2/1/2',
},
{
output = '1/1/3',
timer = '2/1/3',
}
}
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
sleep(timer)
end
end
for _, item in ipairs(objects) do
grp.write(item.output, true)
dosleep(item.timer)
grp.write(item.output, false)
end
Thank you but in case I would like to increase the time per zone? I mean that timer has to be from 1 minute to 30 minutes. How can I do that?
Thanks.