23.04.2020, 14:45
Hi Hosutech,
I once made a very simple script for this. Please find a copy below. It's a start of what you need but you need to extend it with some extra functionality but that al are simple conditions i would say..
start_stop = grp.getvalue('15/2/0') -- start stop
minuten = grp.getvalue('15/2/1') -- time per section (minutes, byte value)
sectie_1 = grp.getvalue('15/2/3') -- section 1
sectie_2 = grp.getvalue('15/2/4') -- section 2
sectie_3 = grp.getvalue('15/2/5') -- section 3
sectie_4 = grp.getvalue('15/2/7') -- section 4
minuten = minuten * 60 -- time calculation to minutes
stored_pomp_pid = storage.get('storage_pomp_pid')
if stored_pomp_pid == nil then
pid = os.getpid()
storage.set('storage_pomp_pid', pid)
else
pid = os.getpid()
storage.set('storage_pomp_pid', pid)
os.kill(stored_pomp_pid, signal.SIGKILL)
end
if start_stop == true then
if sectie_1 == true then
grp.write('0/2/3', true) -- section 1
os.sleep(minuten) -- time per section
grp.write('0/2/3', false) -- section 1
end
if sectie_2 == true then
grp.write('0/2/4', true) -- section 2
os.sleep(minuten) -- time per section
grp.write('0/2/4', false) -- section 2
end
if sectie_3 == true then
grp.write('0/2/5', true) -- section 3
os.sleep(minuten) -- time per section
grp.write('0/2/5', false) -- section 3
end
if sectie_4 == true then
grp.write('0/2/7', true) -- section 4
os.sleep(minuten) -- time per section
grp.write('0/2/7', false) -- section 4
end
else
grp.write('0/2/3', false) -- section 1
grp.write('0/2/4', false) -- section 2
grp.write('0/2/5', false) -- section 3
grp.write('0/2/7', false) -- section 4
end
I once made a very simple script for this. Please find a copy below. It's a start of what you need but you need to extend it with some extra functionality but that al are simple conditions i would say..
start_stop = grp.getvalue('15/2/0') -- start stop
minuten = grp.getvalue('15/2/1') -- time per section (minutes, byte value)
sectie_1 = grp.getvalue('15/2/3') -- section 1
sectie_2 = grp.getvalue('15/2/4') -- section 2
sectie_3 = grp.getvalue('15/2/5') -- section 3
sectie_4 = grp.getvalue('15/2/7') -- section 4
minuten = minuten * 60 -- time calculation to minutes
stored_pomp_pid = storage.get('storage_pomp_pid')
if stored_pomp_pid == nil then
pid = os.getpid()
storage.set('storage_pomp_pid', pid)
else
pid = os.getpid()
storage.set('storage_pomp_pid', pid)
os.kill(stored_pomp_pid, signal.SIGKILL)
end
if start_stop == true then
if sectie_1 == true then
grp.write('0/2/3', true) -- section 1
os.sleep(minuten) -- time per section
grp.write('0/2/3', false) -- section 1
end
if sectie_2 == true then
grp.write('0/2/4', true) -- section 2
os.sleep(minuten) -- time per section
grp.write('0/2/4', false) -- section 2
end
if sectie_3 == true then
grp.write('0/2/5', true) -- section 3
os.sleep(minuten) -- time per section
grp.write('0/2/5', false) -- section 3
end
if sectie_4 == true then
grp.write('0/2/7', true) -- section 4
os.sleep(minuten) -- time per section
grp.write('0/2/7', false) -- section 4
end
else
grp.write('0/2/3', false) -- section 1
grp.write('0/2/4', false) -- section 2
grp.write('0/2/5', false) -- section 3
grp.write('0/2/7', false) -- section 4
end