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.

LM5 Resident scripts can rarely freeze
#1
Yesterday, my client give me the feedback that function OFF isn't now working. This function works in Resident 0s and its switch off near all lights in home and delays switch off of the lights on stairs. And script was halted, its status was "green" but this was a day so if it will be switched on at day it starts, do simple job and immediately disable itself so it was not working. I've found similar issue on other LM a few times but it was connected with HTTP or calculating statuses and small CPU power of devices. At this time this occured on LM5 with 20180523 firmware. I think it should be for sure solved, at least distinguish if some script is halted.

This is a script (if during day it immediatelly should switch of):

Code:
-- Gdy noc, wtedy wyłącz całe oświetlenie wewn. oprócz korytarza i schodów, które wyłącz z opóźnieniem (od wywołania lub ostatniego ruchu w strefie dziennej).
-- Gdy dzień, wtedy całe oświetlenie wewn.

if not disableScript then
 -- wstępna konfiguracja
 disableScript = function()
   grp.checkupdate("OFF_signalling", false)
   script.disable(_SCRIPTNAME)
 end
 
 grp.checkupdate("OFF_signalling", true)
 
 grp.write("OFF_Natychmiast", false)
 grp.write("OFF_Później", not day) -- jeśli noc wtedy włącz oświetlenie orientacyjne m.in. schody
end

offset = grp.getvalue("OFF_Czas świecenia")
day = grp.getvalue("Dzień")

if day then
 disableScript()
    return    
end

waitFromLastMotion = grp.getvalue("OFF_odliczaj od ruchu")

if waitFromLastMotion then
 local motionInDayZone = grp.find("Ruch w strefie dziennej_status")
 local lastMotion = motionInDayZone.updatetime
 local motion = motionInDayZone.value
 local elapsed = os.time() - lastMotion
 
 if not motion and elapsed >= offset then
     -- wyłącz oświetlenie korytarza
   grp.write("OFF_Później", false)
   disableScript()
 elseif motion then
   os.sleep(offset + 1)
 else
   -- odczekaj tyle co pozostało do 45
   os.sleep(offset - elapsed + 1)
 end
else
 os.sleep(offset)
 -- wyłącz oświetlenie korytarza
 grp.write("OFF_Później", false)
 disableScript()
end
Done is better than perfect
Reply


Messages In This Thread
LM5 Resident scripts can rarely freeze - by buuuudzik - 05.06.2019, 03:44

Forum Jump: