Logic Machine Forum
irrigazione con sensore pioggi - Printable Version

+- Logic Machine 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: irrigazione con sensore pioggi (/showthread.php?tid=2609)



irrigazione con sensore pioggi - Hosutech - 23.04.2020

Good morning everyone,
I ask you top experts if there is a preconfigured script (macro) for the management of 4/8 irrigation areas that provides the possibility of:
- schedule the start of the irrigation cycle for each zone and for a defined time for each individual zone, a sort of sequence scenario that starts the zones active in the cycle successively one after the other,
- insert a block for each zone to allow one or more specific zones to be blocked in the cycle,
- activate the irrigation block according to the rain sensor (1bit from a digital input),
- insert a filter for each zone that brings a reduction in the preset irrigation time based on comparison with a soil humidity sensor (example: zone 1 - time 10 'if soil moisture value> 40% 20% reduction .. then will be 8 '),

I await kind support and feedback, thank you


RE: irrigazione con sensore pioggi - admin - 23.04.2020

Here's a similar script that has configurable enable and timer value via objects:
https://forum.logicmachine.net/showthread.php?tid=362&pid=8161#pid8161


RE: irrigazione con sensore pioggi - Joep - 23.04.2020

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


RE: irrigazione con sensore pioggi - Hosutech - 27.04.2020

(23.04.2020, 14:45)Joep Wrote: 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
Thanks JOEP
I try your script and let you know.
To make good

(23.04.2020, 14:42)admin Wrote: Here's a similar script that has configurable enable and timer value via objects:
https://forum.logicmachine.net/showthread.php?tid=362&pid=8161#pid8161
well thanks, I try it and let you know