This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Resident script pump circulation
#7
Code:
-- check if previous script needs to be killed
script_pompa_circolazione_notte = 'Pompa_circolazione_notte'
pompa_notte_pid = storage.get(script_pompa_circolazione_notte)  
if pompa_notte_pid == nil then
   pompa_notte_pid_os = os.getpid()
   storage.set(script_pompa_circolazione_notte, pompa_notte_pid_os)
else
   pompa_notte_pid_os = os.getpid()  
   storage.set(script_pompa_circolazione_notte, pompa_notte_pid_os)  
   os.kill(pompa_notte_pid, signal.SIGKILL)
end

-- put here your script with os.sleep
Valvola_zona_notte = grp.getvalue('2/0/106')
os.sleep(0.5)
Valvola_bagno_zona_notte = grp.getvalue('2/0/105')
if Valvola_zona_notte or Valvola_bagno_zona_notte == true then
   os.sleep(360) -- attendi 360 secondi poi avvia la pompa di zona
grp.write('2/0/3', true)
else
 grp.write('2/0/3', false)
end

-- end of your scrript

-- clean up storage
storage.delete(script_pompa_circolazione_notte)

Surfing on the forum I found an instruction to avoid to add running script. Here above what I did.

It seems working. What I would like to do is kill the os.sleep time (360 seconds) if in the meanwhile logic OR is false.

I hope I have been cleared.

Thanks.
Reply


Messages In This Thread
RE: Resident script pump circulation - by Domoticatorino - 08.03.2018, 17:55

Forum Jump: