![]() |
|
Irrigation program - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Irrigation program (/showthread.php?tid=362) Pages:
1
2
|
Irrigation program - Domoticatorino - 01.08.2016 Hi all, any experience script about timer to manage an irrigation system with knx? I have 10 irrigation valves which I control by knx. At starting time valves must open and closed step by step and when timer for one zone is expired start the followed zone. The user must choose the working time for each valves and user can select which valves have to work. What do you suggest? Thanks. RE: Irrigation program - Domoticatorino - 02.08.2016 In order to simplify the question what is your idea to realize a countdown starting with a time insert by user? Thanks. RE: Irrigation program - admin - 03.08.2016 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)
endRE: Irrigation program - Domoticatorino - 18.10.2016 (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: 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. RE: Irrigation program - admin - 18.10.2016 If you're fine with having timer resolution in minutes not seconds, this should work: Code: mintimer = 1 -- minimum timer value in minutes
maxtimer = 30 -- maximum timer value in minutes
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 * 60) -- minutes -> seconds
end
end
for _, item in ipairs(objects) do
grp.write(item.output, true)
dosleep(item.timer)
grp.write(item.output, false)
endRE: Irrigation program - Domoticatorino - 20.04.2018 Hi admin, I finally test it and it is work fine. What I would like to do is add, for every step an enable. I mean that it enable object is =1 then system active the output for the time declared otherwise syste shift to the next step. What lua instruction I could use? Thanks. RE: Irrigation program - admin - 25.04.2018 Code: mintimer = 1 -- minimum timer value in minutes
maxtimer = 30 -- maximum timer value in minutes
objects = {
{
output = '1/1/1',
timer = '2/1/1',
enable = '3/1/1',
},
{
output = '1/1/2',
timer = '2/1/2',
enable = '3/1/3',
},
{
output = '1/1/3',
timer = '2/1/3',
enable = '3/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 * 60) -- minutes -> seconds
end
end
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)
end
endRE: Irrigation program - Udelae - 11.03.2019 Hi all in case of needing to interrupt sequence (raining at that moment), how should we modify the code? RE: Irrigation program - admin - 12.03.2019 Are you using a scheduled script for this? RE: Irrigation program - Udelae - 12.03.2019 (12.03.2019, 07:35)admin Wrote: Are you using a scheduled script for this? yes. but I need the sequence stops when it's raining to save water RE: Irrigation program - admin - 12.03.2019 There's no built-in way to stop a scheduled script, but you can use this script (change script name to your scheduled script name): Code: name = 'my script name'
item = script.get(name)
script.disable(name)
os.execute('pkill -f "scripting-scheduled.lua ' .. item.id .. '"')You should also add sending 0 to all outputs. RE: Irrigation program - Udelae - 12.03.2019 (12.03.2019, 08:30)Thanks!!. Works welladmin Wrote: There's no built-in way to stop a scheduled script, but you can use this script (change script name to your scheduled script name): RE: Irrigation program - Udelae - 12.03.2019 Thanks !!! RE: Irrigation program - DanielB - 21.03.2019 hi, Is it possible to enable a delay on each of these timers? I mean on the output:-) Daniel RE: Irrigation program - CristianAgata - 30.06.2021 (12.03.2019, 08:30)admin Wrote: There's no built-in way to stop a scheduled script, but you can use this script (change script name to your scheduled script name):Hi, I've found this script to stop an event scripting, I've tested but if the scripting is running it doesn't stop. Or better the led of status passes red and doesn't start in next event occured. Is It possible stop the event? Best regards Cristian RE: Irrigation program - Daniel - 30.06.2021 https://forum.logicmachine.net/showthread.php?tid=2955&pid=19051#pid19051 RE: Irrigation program - CristianAgata - 30.06.2021 (30.06.2021, 14:57)Daniel. Wrote: https://forum.logicmachine.net/showthread.php?tid=2955&pid=19051#pid19051 Thanks RE: Irrigation program - costelservice@gmail.com - 11.05.2022 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! RE: Irrigation program - balatis - 12.05.2022 (11.05.2022, 11:42)costelservice@gmail.com Wrote: Hello! 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
endRE: Irrigation program - David - 24.10.2023 Hello, I tried to use this script by event but there's no way to stop the script once started. Code: name = 'my script name'
item = script.get(name)
script.disable(name)
os.execute('pkill -f "scripting-scheduled.lua ' .. item.id .. '"')I used the script you suggested before but didn't work for me. I'm using a group address to trigger the event script with value 1 and would like to use the same group address with value 0 to stop the script. Do you know what could be happening? Thank you. |