08.03.2018, 17:55
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.