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
#17
Code:
valveStatesTag = 'pompa_circolazione_giorno'
pumpGA = '2/0/1'

opened, first_timestamp = false, 0

valveStates = grp.tag(valveStatesTag)
for v = 1, #valveStates, 1 do
 valveState = valveStates[v]
 if valveState.value then
   opened = true
   if first_timestamp > 0 then
       if first_timestamp > valveState.updatetime then first_timestamp = valveState.updatetime end
   else
       first_timestamp = valveState.updatetime
   end
 end
end

if opened then
   opened_5_minutes = (os.microtime() - first_timestamp) >= 120
   if opened_5_minutes then
       grp.checkwrite(pumpGA, true)
   else
       grp.checkwrite(pumpGA, false)
   end
else
   grp.checkwrite(pumpGA, false)
end

Hi, I use this script above and it seems does not work. I use 120 sec to check without loosing too time. Unfortunately Pump does not start.
What do you think?
Thanks.
Reply


Messages In This Thread
RE: Resident script pump circulation - by Domoticatorino - 10.03.2018, 16:29

Forum Jump: