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
#34
Hi there,
I have a big problem with the script below. Please consider that I have 3 same script (obviosly with different varables) and everyting works fine. The one below does not work anymore.

I have seen in the obkect list that last update of group address 2/0/2 was dated 16th of September. The other correctly dated today. I cannot understand the reason why it does not work anymore. And nothing changed.

I tried to delate scritp and redo it without success. I tried to do again object 2/0/2 without success. Nothing group address 2/0/2 never update. Could you help me please?

Thanks.

Code:
valveStatesTagEstate = 'pompa_circolazione_mansarda_estate'
valveStatesTagInverno = 'pompa_circolazione_mansarda_inverno'
stagione = grp.getvalue('2/0/100')
pumpGA = '2/0/2'
openingValveTime = 60 -- time for fully open the valve (maximum time for next calculation)
minInterval = 30 -- minimum offset for next calculation

opened, firstTimestamp = false, 0

if stagione == false then
    valveStatesEstate = grp.tag(valveStatesTagEstate)
    for v = 1, #valveStatesEstate, 1 do
     valveStateEstate = valveStatesEstate[v]
     if valveStateEstate.value then
       opened = true
       if firstTimestamp > 0 then
         if firstTimestamp > valveStateEstate.updatetime then firstTimestamp = valveStateEstate.updatetime end
       else
         firstTimestamp = valveStateEstate.updatetime
       end
     end
 end
else
   valveStatesInverno = grp.tag(valveStatesTagInverno)
   for v = 1, #valveStatesInverno, 1 do
     valveStateInverno = valveStatesInverno[v]
     if valveStateInverno.value then
       opened = true
       if firstTimestamp > 0 then
         if firstTimestamp > valveStateInverno.updatetime then firstTimestamp = valveStateInverno.updatetime end
       else
         firstTimestamp = valveStateInverno.updatetime
       end
     end
end
end

if opened then
   fullyOpened = (os.microtime() - firstTimestamp) >= openingValveTime
   if fullyOpened then
       grp.checkwrite(pumpGA, true)
       nextCalculationAfter = minInterval
   else
       grp.checkwrite(pumpGA, false)
       nextCalculationAfter = openingValveTime + 1 - (os.microtime() - firstTimestamp) -- run a little after possible change
   end
else
   grp.checkwrite(pumpGA, false)
   nextCalculationAfter = openingValveTime + 1
end

-- log('Next calculation after: ' .. nextCalculationAfter .. 's.')
os.sleep(nextCalculationAfter)
Reply


Messages In This Thread
RE: Resident script pump circulation - by Domoticatorino - 24.10.2018, 09:26

Forum Jump: